Apache SOAP 2.2 Overview Page 12

Executing the Program

Executing the client program sends the HTTP-SOAP stream to the server indicated by the program. We have asked the server to calculate a sum for us:

java webservice.CalculatorClient 6 + 5 

The stream is made up of an HTTP Header, followed by a SOAP envelope.

HTTP Header:

 POST /soap/servlet/rpcrouter HTTP/1.0 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: 463 SOAPAction: "" 

SOAP envelope:

 <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/ envelope/"xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <ns1:add xmlns:ns1="urn:Calculator" SOAP-ENV:encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/"> <nbr1 xsi:type="xsd:long">6</nbr1> <nbr2 xsi:type="xsd:long">5</nbr2> </ns1:add> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 

The server receives the SOAP request and sends back the results of this addition:

HTTP Header

 HTTP/1.0 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: 451 Set-Cookie2: JSESSIONID=8qilh88em1;Version=1;Discard;Path="/soap" Set-Cookie: JSESSIONID=8qilh88em1;Path=/soap Servlet-Engine: Tomcat Web Server/3.2.2 (JSP 1.1; Servlet 2.2; 
Java 1.3.0; Windows 2000 5.0 x86; java.vendor=Sun Microsystems Inc.)

SOAP envelope

 <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap /envelope/"xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <ns1:addResponse xmlns:ns1="urn:Calculator" SOAP- ENV:encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/"> <return xsi:type="xsd:long">11</return> </ns1:addResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 

This article was originally published on Mar 8, 2002

Thanks for your registration, follow us on our social networks to keep up-to-date