This topic inludes the source code for the Readme.html Sample.
This sample is located in the following directory in your WebLogic Workshop installation:
BEA_HOME/weblogic81/samples/workshop/SamplesApp/ProxyClient/WSSE/
<html> <head> <title>WebLogic Workshop Web Service Client Proxy Examples</title> <style type="text/css">h1, h2, h3, h4, p, li, blockquote { font-family: Verdana, Arial, Helvetica, sans-serif; margin-left: 0px } p, li { font-size: 12 } blockquote { font-size: 12 } blockquote { margin-left: 1em } ul { list-style-type: square } </style> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> </head> <body> <h1>Calling a WSSE-enabled Web Service Through Its Java Proxy Classes</h1> <h2>Introduction</h2> <p>These samples show how to call a WSSE-enabled web service through the web service's Java proxy classes.</p> <p>Two web service clients are included: MyCompanyClient.java and WebServiceBClient.java.</p> <p>The target web services are included in the SamplesApp application at /WebServices/security/wsse/reqResp/mycompany/MyCompany.jws and WebServices/security/wsse/usertoken/webServiceB/WebServiceB.jws. <h3>WebServiceB.jws</h3> <p>The web service WebServiceB exposes one operation: hello(), which returns the string "Hello, Web Service A!"</p> <p>Any client to this web service must provide a username/password token in the header of the SOAP message requests. <h3>MyCompany.jws</h3> <p>The web service MyCompany.jws exposes one operation: hello(), which returns the string "Hello, Client!"</p> <p>Any client to this web service must (1) provide a digital certificate, (2) encrypt SOAP messages requests, and (3) provide a username/password token in the header of the SOAP message requests. <h3>Proxy Classes</h3> <p>The samples access the web service through the web service proxy. The proxy for any given Workshop web service is available from that service's Test View on the Overview Page. The proxy is packaged as a web service-specific JAR file containing proxy classes. To use the proxy, you also need the generic webserviceclient.jar that is also available from Test View.</p> <p>These examples require use of <b>ant</b>. ant is delivered with WLS and can be found in BEA_HOME/weblogic81/server/bin. Please make sure that directory is on your PATH.</p> <h2>Contents</h2> <blockquote> <p>WSSE/clientCert</p> <blockquote> <b>build.xml</b>: ant script that compiles the MyCompanyClient standalone Java console client.<br> <b>MyCompanyClient.java</b>: Standalone Java client of the MyCompany web service, uses MyCompany proxy class.<br> <b>run.bat</b>: Script that runs the Java console client. </blockquote> <p>WSSE/token</p> <blockquote> <b>build.xml</b>: ant script that compiles the MyWebServiceBClient standalone Java console client.<br> <b>MyWebServiceBClient.java</b>: Standalone Java client of the MyWebServiceB web service, uses MyWebServiceB proxy class.<br> <b>run.bat</b>: Script that runs the Java console client. </blockquote> </blockquote> <h2>Instructions for Running The Standalone Java Clients</h2> <h3>Running MyCompanyClient.java</h3> <ol> <li>In a cmd shell, cd to <tt>BEA_HOME/weblogic81/samples/workshop/SamplesApp/ProxyClient/WSSE/clientCert</tt>.</li> <li>Run <b><tt>ant compile</tt></b> to compile the Java client. (<b>ant</b> must be on your PATH; <b>ant</b> can be found in BEA_HOME/weblogic81/server/bin)</li> <li>There is a <b><tt>run.bat</tt></b> (Windows) script to run the Java client. It relies on WL_HOME being set to BEA_HOME\weblogic81 on Windows. Type <tt>run</tt> to run the client.</li> </ol> <p>You should see the message returned by the MyCompany web service. <h3>Running MyWebServiceB.java</h3> <ol> <li>In a cmd shell, cd to <tt>BEA_HOME/weblogic81/samples/workshop/SamplesApp/ProxyClient/WSSE/token</tt>.</li> <li>Run <b><tt>ant compile</tt></b> to compile the Java client. (<b>ant</b> must be on your PATH; <b>ant</b> can be found in BEA_HOME/weblogic81/server/bin)</li> <li>There is a <b><tt>run.bat</tt></b> (Windows) script to run the Java client. It relies on WL_HOME being set to BEA_HOME\weblogic81 on Windows. Type <tt>run</tt> to run the client.</li> </ol> <p>You should see the message returned by the WebServiceB web service.</p> </body> </html>