Loading ...
Sorry, an error occurred while loading the content.
 

Control the SOAP Response on the Server Code in C#

Expand Messages
  • mahesh2115
    I have a question regarding Soap Response. My C# Web Services Server code looks like this [WebMethod] public XmlDocument NodePing(string strXml) { code parses
    Message 1 of 4 , Apr 8, 2003
      I have a question regarding Soap Response.

      My C# Web Services Server code looks like this

      [WebMethod]
      public XmlDocument NodePing(string strXml)
      {
      code parses the string and responds to Client.
      }

      In the SOAP Response, I am seeing the following SOAP message.

      <?xml version="1.0" encoding="utf-8"?><soap:Envelope
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><NodePingRespo
      nse
      xmlns="http://localhost/NetworkNode"><NodePingResult><tns:PingResponse
      xmlns:tns="http://www.neien.rg/schema/v1.0/cdx.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      soapenv:encodingStyle="http://schema.xmlsoap.org/soap/encoding/"
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><return
      type="xsd:string"
      xmlns="">Ready</return></tns:PingResponse></NodePingResult></NodePingR
      esponse></soap:Body></soap:Envelope>

      My requirement is, I should somehow not to send <NodePingResponse>
      and <NodePingResult> tags in the SOAP Body. I should control this on
      the Server code itself.

      Can anyone answer this please ?

      Thanks,
      Mahesh
    • Eric Rajkovic
      Mahesh, I have done some experiment with .Net WSE 1.0 SP1 and it looks like you can achive some of this using specific attributes
      Message 2 of 4 , Apr 8, 2003
        Mahesh,

        I have done some experiment with .Net WSE 1.0 SP1 and it looks like you can achive some
        of this using specific attributes

        ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped
        vs.
        ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare

        will control the presence of the wrapper element on the request/response

        MessageName="ChangeIt"
        will enable you to overwrite the value of Ping

        I have not find a way to change the name of the inner element (either PingResult or ChangeItResult)

        Here is how ny C# code look:

        [WebMethod(MessageName="ChangeIt")]
        //[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://xmlsoap.org/Ping", ResponseNamespace="http://xmlsoap.org/Ping", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        //[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://xmlsoap.org/Ping", ResponseNamespace="http://xmlsoap.org/Ping",ResponseElementName="MyPingElement", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
        [System.Web.Services.Protocols.SoapDocumentMethod(ResponseNamespace="http://xmlsoap.org/Ping",ResponseElementName="MyCustomResponseElement", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
        public string Ping( string text)
        {

        In this sample, the commented line was to try to remove the SOAPAction as well.

        hope this helps.

        eric

        mahesh2115 wrote:
        > I have a question regarding Soap Response.
        >
        > My C# Web Services Server code looks like this
        >
        > [WebMethod]
        > public XmlDocument NodePing(string strXml)
        > {
        > code parses the string and responds to Client.
        > }
        >
        > In the SOAP Response, I am seeing the following SOAP message.
        >
        > <?xml version="1.0" encoding="utf-8"?><soap:Envelope
        > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><NodePingRespo
        > nse
        > xmlns="http://localhost/NetworkNode"><NodePingResult><tns:PingResponse
        > xmlns:tns="http://www.neien.rg/schema/v1.0/cdx.xsd"
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        > soapenv:encodingStyle="http://schema.xmlsoap.org/soap/encoding/"
        > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><return
        > type="xsd:string"
        > xmlns="">Ready</return></tns:PingResponse></NodePingResult></NodePingR
        > esponse></soap:Body></soap:Envelope>
        >
        > My requirement is, I should somehow not to send <NodePingResponse>
        > and <NodePingResult> tags in the SOAP Body. I should control this on
        > the Server code itself.
        >
        > Can anyone answer this please ?
        >
        > Thanks,
        > Mahesh
        >
        >
        >
        >
        >
        >
        > *Yahoo! Groups Sponsor*
        > <http://us.ard.yahoo.com/M=249982.3083889.4452939.1728375/D=egroupweb/S=1705701014:HM/A=1524963/R=0/*http://hits.411web.com/cgi-bin/autoredir?camp=556&llineid=3083889&prop=egroupweb&pos=HM>
        >
        >
        >
        > -----------------------------------------------------------------
        > This group is a forum for builders of SOAP implementations to discuss
        > implementation and interoperability issues. Please stay on-topic.
        >
        > To unsubscribe from this group, send an email to:
        > soapbuilders-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
        > <http://docs.yahoo.com/info/terms/>.
      • Mahesh Vijay
        Eric, Thanks. I am a part-time programmer. I will try this code today and let you know the results. Thanks again. Mahesh Eric Rajkovic
        Message 3 of 4 , Apr 10, 2003

          Eric,

          Thanks.  I am a part-time programmer.  I will try this code today and let you know the results.

          Thanks again.

          Mahesh

           Eric Rajkovic <eric.rajkovic@...> wrote:

          Mahesh,

          I have done some experiment with .Net WSE 1.0 SP1 and it looks like you can achive some
          of this using specific attributes

          ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped
            vs.
          ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare

          will control the presence of the wrapper element on the request/response

          MessageName="ChangeIt"
            will enable you to overwrite the value of Ping

          I have not find a way to change the name of the inner element (either PingResult or ChangeItResult)

          Here is how ny C# code look:

                [WebMethod(MessageName="ChangeIt")]
                //[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://xmlsoap.org/Ping", ResponseNamespace="http://xmlsoap.org/Ping", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
                //[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://xmlsoap.org/Ping", ResponseNamespace="http://xmlsoap.org/Ping",ResponseElementName="MyPingElement", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
                [System.Web.Services.Protocols.SoapDocumentMethod(ResponseNamespace="http://xmlsoap.org/Ping",ResponseElementName="MyCustomResponseElement", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
                public string Ping( string text)
                {

          In this sample, the commented line was to try to remove the SOAPAction as well.

          hope this helps.

          eric

          mahesh2115 wrote:
          > I have a question regarding Soap Response.
          >
          > My C# Web Services Server code looks like this
          >
          > [WebMethod]
          > public XmlDocument NodePing(string strXml)
          > {
          >    code parses the string and responds to Client.
          > }
          >
          > In the SOAP Response, I am seeing the following SOAP message.
          >
          > <?xml version="1.0" encoding="utf-8"?><soap:Envelope
          > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
          > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          > xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><NodePingRespo
          > nse
          > xmlns="http://localhost/NetworkNode"><NodePingResult><tns:PingResponse
          > xmlns:tns="http://www.neien.rg/schema/v1.0/cdx.xsd"
          > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          > soapenv:encodingStyle="http://schema.xmlsoap.org/soap/encoding/"
          > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><return
          > type="xsd:string"
          > xmlns="">Ready</return></tns:PingResponse></NodePingResult></NodePingR
          > esponse></soap:Body></soap:Envelope>
          >
          > My requirement is, I should somehow not to send <NodePingResponse>
          > and <NodePingResult> tags in the SOAP Body.  I should control this on
          > the Server code itself.
          >
          > Can anyone answer this please ?
          >
          > Thanks,
          > Mahesh
          >
          >
          >
          >
          >
          >
          > *Yahoo! Groups Sponsor*
          > <http://us.ard.yahoo.com/M=249982.3083889.4452939.1728375/D=egroupweb/S=1705701014:HM/A=1524963/R=0/*http://hits.411web.com/cgi-bin/autoredir?camp=556&llineid=3083889&prop=egroupweb&pos=HM>
          >
          >
          >
          > -----------------------------------------------------------------
          > This group is a forum for builders of SOAP implementations to discuss
          > implementation and interoperability issues.  Please stay on-topic.
          >
          > To unsubscribe from this group, send an email to:
          > soapbuilders-unsubscribe@yahoogroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
          > <http://docs.yahoo.com/info/terms/>.



          -----------------------------------------------------------------
          This group is a forum for builders of SOAP implementations to discuss implementation and interoperability issues.  Please stay on-topic.

          To unsubscribe from this group, send an email to:
          soapbuilders-unsubscribe@yahoogroups.com



          Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



          Do you Yahoo!?
          Yahoo! Tax Center - File online, calculators, forms, and more

        • mahesh2115
          Eric, I tried with your code, the PingResponse tag is gone now. But, I am still getting the PingResult tag. I tried with different options but still
          Message 4 of 4 , Apr 10, 2003
            Eric,

            I tried with your code, the "PingResponse" tag is gone now. But, I
            am still getting the "PingResult" tag.

            I tried with different options but still getting the same result.

            Any idea ?

            Thanks,
            Mahesh


            --- In soapbuilders@yahoogroups.com, Eric Rajkovic
            <eric.rajkovic@o...> wrote:
            > Mahesh,
            >
            > I have done some experiment with .Net WSE 1.0 SP1 and it looks like
            you can achive some
            > of this using specific attributes
            >
            >
            ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrappe
            d
            > vs.
            > ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare
            >
            > will control the presence of the wrapper element on the
            request/response
            >
            > MessageName="ChangeIt"
            > will enable you to overwrite the value of Ping
            >
            > I have not find a way to change the name of the inner element
            (either PingResult or ChangeItResult)
            >
            > Here is how ny C# code look:
            >
            > [WebMethod(MessageName="ChangeIt")]
            > //[System.Web.Services.Protocols.SoapDocumentMethodAttribute
            ("", RequestNamespace="http://xmlsoap.org/Ping",
            ResponseNamespace="http://xmlsoap.org/Ping",
            Use=System.Web.Services.Description.SoapBindingUse.Literal,
            ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrappe
            d)]
            > //[System.Web.Services.Protocols.SoapDocumentMethodAttribute
            ("", RequestNamespace="http://xmlsoap.org/Ping",
            ResponseNamespace="http://xmlsoap.org/Ping",ResponseElementName="MyPin
            gElement",
            Use=System.Web.Services.Description.SoapBindingUse.Literal,
            ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
            > [System.Web.Services.Protocols.SoapDocumentMethod
            (ResponseNamespace="http://xmlsoap.org/Ping",ResponseElementName="MyCu
            stomResponseElement",
            ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
            > public string Ping( string text)
            > {
            >
            > In this sample, the commented line was to try to remove the
            SOAPAction as well.
            >
            > hope this helps.
            >
            > eric
            >
            > mahesh2115 wrote:
            > > I have a question regarding Soap Response.
            > >
            > > My C# Web Services Server code looks like this
            > >
            > > [WebMethod]
            > > public XmlDocument NodePing(string strXml)
            > > {
            > > code parses the string and responds to Client.
            > > }
            > >
            > > In the SOAP Response, I am seeing the following SOAP message.
            > >
            > > <?xml version="1.0" encoding="utf-8"?><soap:Envelope
            > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
            > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            > >
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><NodePingRespo
            > > nse
            > >
            xmlns="http://localhost/NetworkNode"><NodePingResult><tns:PingResponse
            > > xmlns:tns="http://www.neien.rg/schema/v1.0/cdx.xsd"
            > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            > > soapenv:encodingStyle="http://schema.xmlsoap.org/soap/encoding/"
            > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><return
            > > type="xsd:string"
            > >
            xmlns="">Ready</return></tns:PingResponse></NodePingResult></NodePingR
            > > esponse></soap:Body></soap:Envelope>
            > >
            > > My requirement is, I should somehow not to send <NodePingResponse>
            > > and <NodePingResult> tags in the SOAP Body. I should control
            this on
            > > the Server code itself.
            > >
            > > Can anyone answer this please ?
            > >
            > > Thanks,
            > > Mahesh
            > >
            > >
            > >
            > >
            > >
            > >
            > > *Yahoo! Groups Sponsor*
            > >
            <http://us.ard.yahoo.com/M=249982.3083889.4452939.1728375/D=egroupweb/
            S=1705701014:HM/A=1524963/R=0/*http://hits.411web.com/cgi-
            bin/autoredir?camp=556&llineid=3083889&prop=egroupweb&pos=HM>
            > >
            > >
            > >
            > > -----------------------------------------------------------------
            > > This group is a forum for builders of SOAP implementations to
            discuss
            > > implementation and interoperability issues. Please stay on-topic.
            > >
            > > To unsubscribe from this group, send an email to:
            > > soapbuilders-unsubscribe@yahoogroups.com
            > >
            > >
            > >
            > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
            Service
            > > <http://docs.yahoo.com/info/terms/>.
          Your message has been successfully submitted and would be delivered to recipients shortly.