WSDL Tutorials - Herong's Tutorial Examples - Version 2.03, by Dr. Herong Yang
Capturing the HTTP Request from an Axis2 Client Program
This section provides a tutorial example on how to capture the HTTP request generated from an Axis2 client program with the socket server test program.
In order to run SocketRequestResponseServer.java to serve Axis2GetExchangeRateClient.java, I need to do these steps:
1. Prepare a mock HTTP response file, GetExchangeRate_WSDL_11_SOAP_11_RPC.res, to be used by SocketRequestResponseServer.java:
HTTP/1.0 200 OK Server: SocketRequestResponseServer.java Content-Length: 514 Connection: close Content-Type: text/html;charset=utf-8 <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hy="http://www.herongyang.com/Service/"> <soapenv:Header/> <soapenv:Body> <hy:GetExchangeRateResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <hy:ratePart xsi:type="xsd:decimal">123.14</hy:ratePart> </hy:GetExchangeRateResponse> </soapenv:Body> </soapenv:Envelope>
2. Run SocketRequestResponseServer.java in separate command line window to wait for the client program:
C:\herong>\local\jdk\bin\java SocketRequestResponseServer GetExchangeRate_WSDL_11_SOAP_11_RPC.res server.req Listening at 8888
3. Change the local WSDL document, /herong/GetExchangeRate_WSDL_11_SOAP_11_RPC.wsdl, to use the local address location:
<soap:address location= "http://localhost:8888/"/>
4. Run Axis2GetExchangeRateClient.java again in a different command line window:
C:\herong>\local\jdk\bin\java -Djava.ext.dirs=\local\axis2\lib\ Axis2GetExchangeRateClient 123.14
5. Go to the SocketRequestResponseServer.java window and check the output file:
C:\herong>\local\jdk\bin\java SocketRequestResponseServer GetExchangeRate_WSDL_11_SOAP_11_RPC.res server.req Listening at 8888 Connection received from /127.0.0.1 Request length: 507 Response length: 654 C:\herong>type server.req POST / HTTP/1.1 Content-Type: text/xml; charset=UTF-8 SOAPAction: "http://www.herongyang.com/Service/getExchangeRate" User-Agent: Axis2 Host: localhost:8888 Content-Length: 322 <?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <GetExchangeRate xmlns="http://www.herongyang.com/Service/"> <arg0 xmlns="">USD</arg0> <arg1 xmlns="">JPY</arg1> <arg2 xmlns="">2007-07-07</arg2> </GetExchangeRate> </soapenv:Body> </soapenv:Envelope>
Now I can see what Axis2GetExchangeRateClient.java is doing in HTTP request:
Last update: 2009.
Table of Contents
WSDL 2.0 Document Structure and Syntax
WSDL Version 2.0 Part 2: Adjuncts
WSDL 2.0 Document Examples with SOAP Binding
WSDL 20 Programming APIs and Testing Tools
WSDL 1.1 Document Structure and Syntax
WSDL 1.1 Binding Extension for SOAP 1.1
soapUI 3.0.1 - Web Service Testing Tool
WSDL 1.1 and SOAP 1.1 Examples - Document and RPC Styles
PHP SOAP Extension in PHP 5.3.1
Using WSDL in Perl with SOAP::Lite 0.710
►Using WSDL Document in Java with Axis2 1.4.1
Downloading and Installing Axis2/Java 1.4.1
org.apache.axis2.client.ServiceClient Class
Creating Service Client with WSDL Document
org.apache.axis2.client.Options - Operation Client Options
sendReceive() Method - Invoking a Named Operation
Turning Off the Chunked HTTP Flag
Axis2RegistrationClient.java - document/literal Style
Axis2GetSpeechClient.java - document/literal Style
org.apache.axis2.rpc.client.RPCServiceClient Class
Axis2GetExchangeRateClient.java - rpc/encoded Style
SocketRequestResponseServer.java - Socket Server Testing Program
►Capturing the HTTP Request from an Axis2 Client Program
Using WSDL2Java to Generate Web Service Stub Classes
WSDL 1.1 Binding Extension for SOAP 1.2
WSDL 1.1 and SOAP 1.2 Examples - Document and RPC Styles