ASMX web service, external WSDLs *without* wsdl.exe
I'm working on some legacy code, and I need an asmx to implement a particular wsdl, which is being provided to me.
I would like to receive 开发者_运维知识库the root element of the message as either an XmlDocument or XmlNode, rather than the wsdl.exe generated object graph. Is this even possible?
First of all, you should use svcutil.exe, not wsdl.exe, unless you have no other choices.
Second, you don't need either program to implement an external WSDL. Just go write your service so that the XML Serializer will properly serialize and deserialize the incoming message. In particular, if you like processing XML, try this:
[WebMethod]
public XmlElement SomeOperation(XmlElement parameter)
{
}
I believe that the same works with the newer XElement
class.
In WCF (which is what you should be using, since Microsoft now considers ASMX web services to be "legacy technology"), I believe you should use the Message
type:
[OperationContract]
Message SomeOperation(Message parameter);
精彩评论