I created a WcfService....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Luuk
    Recognized Expert Top Contributor
    • Mar 2012
    • 1043

    I created a WcfService....

    The result looks like this
    Code:
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
       <s:Body>
          <testResponse xmlns="http://tempuri.org/">
             <testResult>
                <resultaat xmlns="">
                   <Nummer>105095306</Nummer>
                </resultaat>
             </testResult>
          </testResponse>
       </s:Body>
    </s:Envelope>
    I want to remove 2 out if 3 tags from the result from
    <testResponse xmlns="http://tempuri.org/">
    <testResult>
    <resultaat xmlns="">

    How should i do that?

    My code looks likethis
    Code:
     [ServiceContract]
        public interface IService1
        {
            // TODO: Add your service operations here
            [OperationContract(Name = "test")]
            XmlElement GetData2(string value);
    
        }
  • pod
    Contributor
    • Sep 2007
    • 298

    #2
    Look into regular expressions

    Comment

    • Luuk
      Recognized Expert Top Contributor
      • Mar 2012
      • 1043

      #3
      Can you explain how regular expressions would help in this case?

      i.e. give an example of how this could be solved with regular expression?

      Comment

      • pod
        Contributor
        • Sep 2007
        • 298

        #4
        yeah, I just looked a little more into WCFServices and the control seems to be somewhat limited over the output format, it is a bit more complicated than I thought, I need more experience since I will need to get some ready soon for my own purposes. Although I did try one tutorial, a MVC Web API and the output is very flexible; can be JSON upon request from a web page and XML by default...

        It may be not what you are looking for but I hope it helps


        check it out

        tutorial-your-first-web-api


        Code:
        <EcProject xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/WebApi.Models">
         <EcProjectID>6</EcProjectID>
         <EcpDescriptionE>Something</EcpDescriptionE>
         <EcpDescriptionF>Quelque chose</EcpDescriptionF>
         <EcpEnd>2016-05-04T00:00:00</EcpEnd>
         <EcpStart>2016-05-03T00:00:00</EcpStart>
         <EcpSynopsisE>Little thing</EcpSynopsisE>
         <EcpSynopsisF>Petite chose</EcpSynopsisF>
         <EcpTitleE>Thing</EcpTitleE>
         <EcpTitleF>Chose</EcpTitleF>
         <FinCodeACT>21</FinCodeACT>
         <ProgramID>3</ProgramID>
         <ProjectBranch>My branch</ProjectBranch>
         <ProjectGroup>MY Group</ProjectGroup>
         <ProjectManager>My manager</ProjectManager>
         <StatusID>3</StatusID>
         <SubmissionID>11</SubmissionID>
         <Username>pod</Username>
         <created i:nil="true"/>
         <modified>2016-05-25T08:58:39</modified>
        </EcProject>
        Last edited by pod; Jun 2 '16, 12:18 PM. Reason: adding to it

        Comment

        • Luuk
          Recognized Expert Top Contributor
          • Mar 2012
          • 1043

          #5
          WCF and ASP.NET Web API
          "WCF is Microsoft’s unified programming model for building service-oriented applications"
          ...
          "Web API is an ideal platform for building RESTful applications on the .NET Framework"

          short conclusion: the difference is too big, I need SOAP, I do not know WCF good enough to solve my problem, it cannot be done using WebAPI

          Comment

          Working...