ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzamy_5.4.0.1/50/webserv/wssoapbc.htm

75 lines
3.8 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>Build a SOAP client</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h5><A NAME="wssoapbc">Build a SOAP client</A></h5>
<p>The Apache SOAP implementation, integrated with WebSphere Application Server - Express, contains a client API to assist in SOAP client application development. Because the SOAP API is a standard for Web services, any clients that you create to access the WebSphere Application Server - Express SOAP services can also run in different implementations.</p>
<p>The steps for creating a client that interacts with a SOAP Remote Procedure Call (RPC) service include:</p>
<ol>
<li><strong>Obtain the interface description of the SOAP service</strong><br>
This provides you with the signatures of the methods that you want to invoke. You can either look at a WSDL file for the service, or view the service itself to see its implementation.</li>
<li><strong>Create the Call object</strong><br>
The SOAP Call object is the main interface to the underlying SOAP RPC code.</li>
<li><strong>Set the target URI (Uniform Resource Identifier)</strong><br>
You do this in the Call object using the setTargetObjectURI() method. Pass the URN (Uniform Resource Name, a type of URI), that the service uses for its identifier, in the deployment descriptor.</li>
<li><strong>Set the method name that you want to invoke</strong><br>
You do this in the Call object using the setMethodName() method. This method must be one of the methods published by the service located at the URN from the previous step.</li>
<li><strong>Create the necessary Parameter objects for the RPC call</strong><br>
Once you have created the Parameter objects, set them in the Call object using the setParams() method. Ensure you have the same number and same type of parameters as those required by the service.</li>
<li><strong>Run the Call object's invoke() method and retrieve the Response object</strong>
<p><strong>Note:</strong> The RPC call is synchronous, so it might take some time to complete.</p>
</li>
<li><strong>Validate Response object</strong><br>
Check the response for a fault using the getFault() method, and then extract any results or returned parameters.
<p><strong>Note:</strong> Although most of the providers only return a result, the DB2 stored procedure provider can also return output parameters.</p>
</li>
</ol>
<p>Interacting with a document oriented SOAP service requires you to use lower level Apache SOAP API calls. You must first construct an Envelope object that contains the contents of the message (including the body and any headers) that you want to send. Then create a Message object in which you invoke the send() method to perform the actual transmission.</p>
<p><strong>Creating a secure SOAP service</strong></p>
To create a secure SOAP service, perform these steps:
<ol>
<li>Create a simple object.</li>
<li>Define an envelope editor.</li>
<li>Specify a pluggable envelope editor.</li>
<li>Define the transports.</li>
</ol>
<p>For more information about the envelope editor, see <a href="wsspscee.htm">Envelope object</a>.</p>
<p>Your code might look like this example:</p>
<p><strong>Note:</strong> For legal information about this code example, see the <a href="codex.htm">Code example disclaimer</a>.</p>
<pre>
EnvelopeEditor editor= new PluggableEnvelopeEditor(new InputSource(conf), home);
SOAPTransport transport = new FilterTransport(editor, new SOAPHTTPConnection());
call.setSOAPTransport(transport);
</pre>
<p>The characteristics of the secure session are specified by the configuration file, conf.</p>
</body>
</html>