SUMMARY
This article explains how to integrate a Microsoft SOAP Toolkit client with an Apache SOAP-based Web service. To use this article, you will need an existing Web Services Description Language (WSDL) file that has been created by using the IBM Web Services Toolkit, and you must know how to read and edit WSDL files.
back to the top
Preparing the WSDL File for the SOAP Toolkit
The IBM Web Services Toolkit places the WSDL information into the following two files:
- <Java class name>_Service.wsdl (the Service file): This file contains the service information.
- <Java class name>_Service-interface.wsdl (the Interface file): This file contains the message, portType, and binding definitions.
The WSDL that the IBM Web Services Toolkit generates contains improper usage of the targetNamespace attribute and it incorrectly references other internal elements (specifically the
binding,
message, and
portType elements). The easiest and quickest fix is to merge the files and edit appropriately.
To work with WSDL files:
- Copy both WSDL files to your computer.
- Open the Service file and delete the <import>...</import> element.
- Open the Interface file, and then copy all elements except for the definitions tags. Paste those elements into the Service file, above the service element.
- In the portType elements, append the tns: string to the value that is listed for the message attribute in the input and output sub-elements.
- For the binding element, append the tns: string to the type attribute value.
- For the service element, append the tns: string to the binding and name attribute values in the port sub-element.
Depending on how the Apache SOAP endpoint is deployed, you may have to force the Microsoft SOAP Toolkit to specify the type information for simple types. To do this, change the references to items in the types section or the type attribute on the part sub-element of the message elements. Take notes on what the element type should be (you will need this information to call the items later), and then change the type to xsd:anyType.
If the endpoint uses complex types, you must create your type mappers as necessary. To do this, refer to the Help files that are include with the Microsoft SOAP Toolkit.
back to the top
Calling the Apache Endpoint
At this point, you should be ready to call the Apache endpoint and use the Microsoft SOAP Toolkit high-level interface. Instantiate a SoapClient COM object, call mssoapinit on it (passing in the edited version of the WSDL file as the first parameter), and then call functions as usual.
For example, if you have an XML Web Service that adds two numbers and returns the result, the code to call the endpoint and display the result will look similar to the following:
Dim soapObj As New MSSOAPLib.SoapClient
soapObj.mssoapinit "C:\ApacheExample\AddServer_Service.wsdl"
MsgBox soapObj.Add(45, 102)
back to the top
REFERENCES
307279 HOW TO: Integrate Apache clients with SOAP Toolkit based XML Web Services
307324 HOW TO: Integrate a .NET Client with an Apache Web Service
back to the top