The first step, right-click on the site to add a new item, select Web Service:
The second step, write the address of the published WebService and the method called in the WebService.cs file generated below App_Code, write this as an example of the Add () method in business logic:
Third, the local test to see if the call effect succeeds, enter the values of Y and Z respectively 30 and 33 to return the result:
This XML file does does appear to has any style information associated with it. The document tree is shown below.
<int xmlns= "http://domain/WebService2" ></int>
The build solution publishes to the server and browses:
* The default access page must be specified. My start did not specify that garbled characters appear. The code is set below the Webconfig system.web:
<globalization fileencoding= "UTF-8" requestencoding= "UTF-8" responseencoding= "UTF-8" culture= "ZH-CN"/>
When I look directly at the WebService method, I am prompted that the test form can only be used for requests from the local computer.
Workaround: Also add the Protocol node to the system.web configuration node in Webconfig to access the following code:
<webServices>
<protocols>
<add name= "HttpSoap"/>
<add name= "HttpPost"/>
<add name= "HttpGet"/>
<add name= "Documentation"/>
</protocols>
</webServices>
Fifth, in another local project, right-click to add a service reference: In the Address column, write your WebService path and click Go to find your own method published on IIS:
Where found is the search local WebService method. The namespace at the bottom is the namespace you want to call:
Sixth, create a new test.aspx file directly in the background test call the WebService method:
Seventh, review the results with reference to the relevant documents, WebService simple use process is complete:
* Note that when you repeat or modify the relevant reference webservice, the following error occurs: The cause is that the modified configuration file does not have a timely automatic update to be manually modified.
The method load contract is the endpoint configuration portion of "Servicereference1.webservicesoap" because multiple endpoint configurations for the contract have been found. Please indicate the preferred endpoint configuration section by name.
The workaround is to generate more than one <endpoint > node in the configuration file, and remove the deletion.
WebService Simple Practice