Package examples.webservices.client.dynamic_no_wsdl
This example shows how to create a dynamic client application that invokes a non-WebLogic Web service published at the following URL: TheMain
client application uses thejavax.xml.rpc.Call
JAX-RPC class to dynamically discover the operations of the Web service, as well as its parameters, and then call it with the appropriate values.See:
Class Summary
Main This class demonstrates a java client invoking a WebService. Package examples.webservices.client.dynamic_no_wsdl Description
This example shows how to create a dynamic client application that invokes a non-WebLogic Web service published at the following URL:
http://www.xmethods.com:9090/soapThe
Main
client application uses thejavax.xml.rpc.Call
JAX-RPC class to dynamically discover the operations of the Web service, as well as its parameters, and then call it with the appropriate values. The client application does not use the WSDL of the Web service to find this information.The build.xml file sets the runtime property
weblogic.webservice.verbose
to true to provide additional information, useful for debugging.
Additional Resources for examples.webservices.client.dynamic_no_wsdl
build.xml The Java Ant build script that runs the client application. Main.java The client application that invokes the Web service.
The following sections describe how to build and run the example.
Prerequisites
Before you run this example, you need:
- WebLogic Server Version 8.1
Build the Example
To build the example, follow these steps:
- Set up your development shell as described in Quick Start.
- Change to the $SAMPLES_HOME\server\examples\src\examples\webservices\client\dynamic_no_wsdl directory, where SAMPLES_HOME refers to the main WebLogic Server examples directory, such as d:\beahome\weblogic81\samples.
- Assemble and compile the example by executing the Java ant utility at the command line:
prompt> ant
Run the Example
In your development shell, run the Main Java application using the following command:prompt> ant runNOTE: You do not need to start WebLogic Server because the application invokes a Web service from a different vendor rather than one running on WebLogic Server.
Check the Output
If the example executes successfully, you will see the following output in the command window from which you ran the example:Buildfile: build.xml run: [java] <!-------------------- REQUEST ----------------> [java] URL : http://www.xmethods.com:9090/soap [java] Headers : [java] SOAPAction: [""] [java] Content-Type: [text/xml] [java] [java] <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmln s:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmls oap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><e nv:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getQuote xm lns:m="urn:xmethods-delayed-quotes"><symbol xsi:type="xsd:string">BEAS</symbol></m:g etQuote></env:Body></env:Envelope> [java] <!-------------------- END REQUEST ------------> [java] <!-------------------- RESPONSE ---------------> [java] URL : http://www.xmethods.com:9090/soap [java] Headers : [java] Date=Wed, 29 Jan 2003 01:55:26 GMT [java] Content-Type=text/xml [java] Server=Electric/1.0 [java] Connection=Keep-Alive [java] Content-Length=491 [java] Envelope : [java] <?xml version='1.0' encoding='UTF-8'?> [java] <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xm lns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/200 1/XMLSchema' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' soap:encoding Style='http://schemas.xmlsoap.org/soap/encoding/'><soap:Body><n:getQuoteResponse xml ns:n='urn:xmethods-delayed-quotes'><Result xsi:type='xsd:float'>12.45</Result></n:ge tQuoteResponse></soap:Body></soap:Envelope> [java] <!-------------------- END RESPONSE -----------> [java] [java] [java] This example shows how to create a dynamic client application that invok es a non-WebLogic Web service. [java] The webservice used was: http://www.themindelectric.com/wsdl/net.xmethod s.services.stockquote.StockQuote [java] The quote for BEAS is: [java] 12.45 BUILD SUCCESSFULNOTE: The value of12.45
is a sample output; because the example is executing a real Web service, you will see the true current stock price for BEA Systems.
See Also
Read more about:
- WebLogic Web services in Programming WebLogic Web Services.
- Additional Web Service Examples on the dev2dev Web site or from the