How to understand what XML to send to an ASMX web service?

为君一笑 提交于 2019-12-25 04:17:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!