Using SOAP 1.2
Using SOAP 1.2 is very similar to using SOAP 1.1. Here's a sample request:
POST /iptocountry.asmx HTTP/1.1
Host: www.ecubicle.net
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<FindCountryAsXml xmlns="http://www.ecubicle.net/webservices/">
<V4IPAddress>string</V4IPAddress>
</FindCountryAsXml>
</soap12:Body>
</soap12:Envelope>
The SOAP response for SOAP 1.2 would be:
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<FindCountryAsXmlResponse
xmlns="http://www.ecubicle.net/webservices/">
<FindCountryAsXmlResult>xml result</FindCountryAsXmlResult>
</FindCountryAsXmlResponse>
</soap12:Body>
</soap12:Envelope>
Using HTTP GET
For many web services, if you do not want to use SOAP, you can often use the simpler HTTP GET method. Here's the format to send a GET request:
GET /iptocountry.asmx/FindCountryAsXml?V4IPAddress=string HTTP/1.1
Host: www.ecubicle.net
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
Take note of the following:
- The URL for the web service is http://www.ecubicle.net/iptocountry.asmx/FindCountryAsXml?V4IPAddress=string.
- The Content-Type for the request is text/xml; charset=utf-8.
- The Content-Length for the request is 0, because you don't need to send anything separately (everything gets sent through the query string).
- The HTTP method is GET.
The web service will return its result in the following format:
<?xml version="1.0"?>
xml result
Using HTTP POST
In addition to using HTTP GET, you can also use HTTP POST. Here's the format for sending the request:
POST /iptocountry.asmx/FindCountryAsXml HTTP/1.1
Host: www.ecubicle.net
Content-Type: application/x-www-form-urlencoded
Content-Length: length
V4IPAddress=string
Take note of the following:
- The URL for the web service is http://www.ecubicle.net/iptocountry.asmx/FindCountryAsXml.
- The Content-Type for the request is application/x-www-form-urlencoded.
- The Content-Length for the request is the length of V4IPAddress=string.
- The HTTP method is POST.
The web service returns the following result:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0"?>
xml result