问题
I am trying to consume some .asmx service in a console application (I will later use the code to make a dll and use it somewhere else).
But I don't know what the schema of the web service is. I just know the URL of the service which on navigating using the browser gives a page which enlists the functions of the web service. On clicking on a function I get a page with this written under the heading
SOAP 1.1:
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
And after this there is some XML with tags like <soap:Envelope>
, <soap:body>
etc. But I can't use those XMLs...
How do I understand the XML required for a call having only this info?
回答1:
You need to look for the "Service Description" link in that page.
ASP.NET generates those pages to allow you to test the service. In the pages there is a link to the WSDL of the web service (normally the endpoint address with ?wsdl
appended to it).
The WSDL is all you need to generate a client to interact with the web service. Feed that to a tool like svcutil and you get back client code and configuration.
来源:https://stackoverflow.com/questions/16919404/how-to-understand-what-xml-to-send-to-an-asmx-web-service