Professional Documents
Culture Documents
Web Services can convert your application into a Web-application, which can
publish its function or message to the rest of the world. Web Services are
published, found, and used through the Web.
Before you continue, you should have a basic understanding of the following:
HTML
XML
XML provides a language which can be used between different platforms and programming languages
and still express complex messages and functions.
What is SOAP?
SOAP is an XML-based protocol to let applications exchange information over HTTP.
What is WSDL?
WSDL is an XML-based language for locating and describing Web services.
What is UDDI?
UDDI is a directory service where companies can register and search for Web services.
An XML parser converts an XML document into an XML DOM object - which can then
be manipulated with a JavaScript.
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","books.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
txt="<bookstore><book>";
txt=txt+"<title>Everyday Italian</title>";
txt=txt+"<author>Giada De Laurentiis</author>";
txt=txt+"<year>2005</year>";
txt=txt+"</book></bookstore>";
if (window.DOMParser)
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(txt,"text/xml");
}
else // Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(txt);
}
Note: Internet Explorer uses the loadXML() method to parse an XML string, while other browsers use
the DOMParser object.
A DOM (Document Object Model) defines a standard way for accessing and
manipulating documents.
All elements can be accessed through the DOM tree. Their content (text and attributes) can be
modified or deleted, and new elements can be created. The elements, their text, and their attributes
are all known as nodes.
SOAP
SOAP is a simple XML-based protocol that allows applications to exchange information over HTTP.
If you want to learn more about SOAP, please visit our SOAP tutorial.
Web Services
A better way to communicate between applications is over HTTP, because HTTP is supported by all
Internet browsers and servers. SOAP was created to accomplish this.
SOAP provides a way to communicate between applications running on different operating systems,
with different technologies and programming languages.
Binding
ple SOAP Syntax
mary « Previous Next Chapter »
SOAP Building Blocks
A SOAP message is an ordinary XML document containing the following elements:
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
...
</soap:Header>
<soap:Body>
...
<soap:Fault>
...
</soap:Fault>
</soap:Body>
</soap:Envelope>
A SOAP Example
In the example below, a GetStockPrice request is sent to a server. The request has a StockName
parameter, and a Price parameter that will be returned in the response. The namespace for the
function is defined in "http://www.example.org/stock".
A SOAP request:
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>
</soap:Body>
</soap:Envelope>
Test Harness
A software tool that enables the testing of software components that links test capabilities to
perform specific tests, accept program inputs, simulate missing components, compare actual
outputs with expected outputs to determine correctness, and report discrepancies.
What should a test harness include?
The SOAP Test Harness is an ASP.NET application created in VS.NET that allows technical and
functional personnel to test Web Services
SOAP Test Harness user enters the URL of the WSDL document and then selects the specific Web
method that needs to be tested. The user then enters values for the method parameters. Code is
generated for
SoapUI is a useful tool for testing web services. Not only makes it possible to test deployed web
services, but it also offers the possibility to mock any "external" service needed by the service
you want to test. As a result, you can test your web service independently from any other
external service.