Microsoft KB Archive/307318

= HOW TO: Integrate a SOAP Toolkit Client with an Apache SOAP 2.2 XML Web Service =

Article ID: 307318

Article Last Modified on 10/27/2002

-

APPLIES TO


 * Microsoft SOAP Toolkit 2.0

-



This article was previously published under Q307318





IN THIS TASK
SUMMARY
 * Preparing the WSDL File for the SOAP Toolkit
 * Calling the Apache Endpoint

REFERENCES



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:
 * _Service.wsdl (the Service file): This file contains the service information.
 * _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:
 * 1) Copy both WSDL files to your computer.
 * 2) Open the Service file and delete the ... element.
 * 3) 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.
 * 4) 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.
 * 5) For the binding element, append the tns: string to the type attribute value.
 * 6) 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 &quot;C:\ApacheExample\AddServer_Service.wsdl&quot; MsgBox soapObj.Add(45, 102)

back to the top