I am writing a web service that accepts and returns an XML message - I know
the issues behind this but want to be able to process the messages
generically using XSD / XSLT.
My problem occurs with the way the .NET framework appears to handle the
XmlNode, in particular the generation of the WSDL. The details follow:
I define the code behind method as
[WebMethod]
public XmlNode Operation(xmlNode request)
However when I look at the WSDL generated I see the following for the input
XML Message:
<element name="Operation">
<complexType>
<sequence>
<element minOccurs="0" maxOccurs="1" name="request">
<complexType mixed="true">
<sequence>
<any />
</sequence>
</complexType>
</element>
</sequence>
</element>
Which results in the XML in the SOAP:Body looking like like this when called
using the reference.cs generated interface:
<Operation xmlns="..">
<request>
.... I can place the XML I require here
</request>
</Operation>
So the .NET framework - or is it the WSDL - has inserted an extra node
<request> in the XML that I do not require.
Does anyone know how to define this so that THE COMPLETE XML DOCUMENT in the
SOAP:Body is handled by the XmlNode defined in the code behind without it
inserting its own nodes?
TFAH
Paul
PaulF - 25 May 2005 19:07 GMT
I have found a solution. Specify the following just above the [WebMethod]
[SoapDocumentMethod{ParameterStyle =
System.Web.Services.Protocols.SoapParameterStyle.Bare)]
Finally make sure that the variable name for the parameter of the XmlNode on
the WebMethod is the same as the root node of your XML in the SOAP:Body. The
XML is now starting to look like what you require.
> I am writing a web service that accepts and returns an XML message - I know
> the issues behind this but want to be able to process the messages
[quoted text clipped - 42 lines]
>
> Paul