469,906 Members | 2,218 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,906 developers. It's quick & easy.

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

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

<Request xmlns="urn:test:test">

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

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/"

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

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,Par ameterStyle=SoapParameterStyle.Bare,RoutingStyle=S oapServiceRoutingStyle.RequestElement)]
public class TestOne : System.Web.Services.WebService
public TestOne()
protected override void Dispose( bool disposing )
if(disposing && components != null)

[ WebMethod ]
[ 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
public string ID;

public class RequestClass
public string ID;

public RequestClass()
Nov 21 '05 #1
0 2040

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.