problem with prefixed elemets in the <SOAP-ENV:Body>, namespaces and not using the SOAPAction header

From: Michael Jackson (syadvada_at_hotmail.com)
Date: 10/25/04


Date: 25 Oct 2004 15:09:17 -0700

I have attempted to mark up a service and it's methods so that it
doesn't require the SOAPAction HTTP header to resolve the methods
being called, this is done from first element in <SOAP-ENV:Body> and
the request and responses are not suffixed with Request and Response.
Is there some more I could do with the attributes on the class that
defines the WS and on the methods. the code for the WS etc is below.

This I can get to work

POST /TestWS/TestOne.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: http://www.test.org/test/test
Content-Length: 184
Expect: 100-continue
Host: localhost

<SOAP-ENV:Envelope
   xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
  <SOAP-ENV:Body>
      <Request xmlns="urn:test:test">
          <ID>32432</ID>
      </Request>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

But I have 3 questions or issues.

1) Why is it the name of the parameter and not its type that is used
to map the element in the <SOAP-ENV:Body> on to the method in the c#
class and is it possible to change this?

2)Why does this:

POST /TestWS/TestOne.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: http://www.test.org/test/test
Content-Length: 199
Expect: 100-continue
Host: localhost

<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'><SOAP-ENV:Body><tt:Request
xmlns:tt="urn:test:test"><tt:ID>32432</tt:ID></tt:Request></SOAP-ENV:Body></SOAP-ENV:Envelope>

raise and error and is it possible to get it working short of writing
my own HTTPHandler. And can I the web service to acknowledge to
namespaces used to prefix multiple elements?

3) How can I control the response so that it looks like this:

<?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>
        <rr:Response
xmlns:rr="urn:test:test:response"><rr:ID>32432</rr:ID></rr:Response></soap:Body></soap:Envelope>

I need to be able to have multiple prefixes in the response. Is this
possible?

Any help would be greatly appreciated. I don't want to give up on what
is provided in .Net in terms of WS support and start writing this
stuff using an HTTPHandler. I have included the code that defines the
WS below:

[WebService(Name="RoutingStyleService", Namespace="urn:test:test")]
[SoapDocumentService(Use=SoapBindingUse.Literal,ParameterStyle=SoapParameterStyle.Bare,RoutingStyle=SoapServiceRoutingStyle.RequestElement)]
        public class TestOne : System.Web.Services.WebService
        {
                public TestOne()
                {
                      InitializeComponent();
                }
                protected override void Dispose( bool disposing )
                {
                        if(disposing && components != null)
                        {
                                components.Dispose();
                        }
                        base.Dispose(disposing);
                }
        
                [ WebMethod ]
                [SoapDocumentMethod(Action="")]
                [ return: XmlElement("Response",IsNullable=false)]
                public ResponseClass GetRequest(RequestClass Request)
                {
                        ResponseClass t1 = new ResponseClass();
                        t1.ID= Request.ID;
                        return t1;
                }
        }

And two classes that define the types used in messages.

        public class ResponseClass
        {
                [XmlElement(ElementName="ID")]
                public string ID;
        }

        public class RequestClass
        {
                [XmlElement(ElementName="ID")]
                public string ID;

                public RequestClass()
                {
                }
        }



Relevant Pages

  • Re: Beating the spam filter ...
    ... To Bill Cole: caffine is not your friend dude... ... It is dead wrong to have multiple CNAME records for one name. ... DNS load balancing for mail can lead to oversize responses if not done ... to use A recordthat resolve to the IP addressof the current mail ...
    (comp.mail.sendmail)
  • Life as an attorney
    ... THIRD REQUEST FOR PRODUCTION AND BRIEF IN SUPPORT TO THE HONORABLE ... Responses to Defendants’ Third Request for Production. ... Plaintiff has been specifically advised as to the defects in the ...
    (rec.games.chess.politics)
  • Re: SBS Unable to resolve domain but Bind can?
    ... The SBS server is unable to resolve some domains ... Using bind or forwarders is out of the question as I would like to ... increases efficiency by allowing DNS to resolve larger DNS responses without ... Large DNS responses are answers that have several CNAME or MX ...
    (microsoft.public.windows.server.dns)
  • Re: timeout problems
    ... a set of values to service getnext request for a table. ... loop-prevention mechanism and refuse get-next responses that don't ... to tell a manager that it needs more ... SNMP agents and SNMP agent toolkits handle this in general. ...
    (comp.protocols.snmp)
  • [ANN] rack-cache 0.3.0
    ... Responses marked as explicitly public are cached even when the ... request includes an Authorization or Cookie header. ... BUG: ...
    (comp.lang.ruby)

Loading