Start of Content Area

Procedure documentation Generating Web Service Client (Eclipse Web Tools Platform)  Locate the document in its SAP Library structure

Use

As an example for the use of a standard tool, the following describes how to generate a Web Service client using the Eclipse Web Tools Platform plug-in.

Note

For more information about the Web Tools Platform see http://www.eclipse.org/webtools/main.php.

Prerequisites

      The Web Tools Platform (WTP) must be installed.

      WTP must be configured.

Ensure in particular that the target runtime is set up. In the following example Apache Tomcat 5.5 was used as the target runtime. For more information, see the documentation for the Web Tools Platform.

Procedure

Use the following procedure to create a Web Service client for the call of the Web Service for a communication party (CommunicationPartyService). Apply the same procedure to the other Web Services.

Follow these steps.

1. Create a New Project

Call the Web Tools Platform and create a new Dynamic Web Project.

2. Import WSDL Files into the Project

...

       1.      Call the Integration Repository.

       2.      Open the external definition CommunicationPartyService in the software component version SAP BASIS 7.00 in the namespace http//sap.com/xi/XI/System.

In the navigation area of the Integration Builder expand the node SAP BASISSAP BASIS 7.00 → http://sap.com/xi/XI/System → Interface Objects → External Definitions.

       3.      Export the WSDL file.

       4.      To do so, in the Object Editor of the external definition choose Tools ® Export Original Document.

       5.      Then import the WSDL file into your project. It is recommended that you create a separate folder for this in your project.

3. Complete the WSDL File

The WSDL file from the Integration Repository does not yet contain all the information that is required at runtime. Using the following steps, you can complete the WSDL file with this information.

Perform the following steps in Eclipse.

...

       1.      First define the binding for the HTTP access.

                            a.      In the context menu choose Add Binding and insert a name (for example, HTTPBinding)

                            b.      Choose the Properties tab page.

                            c.      In the PortType field choose CommunicationPartyServiceVi_Document.

                            d.      Choose Generate Binding Content.

                            e.      Select theSOAP protocol.

                              f.      Under SOAP Binding Options choose document literal.

                            g.      Enter document as the Binding Style.

       2.      Define the service.

To do so, choose Add Service from the context menu and enter a name (for example, HTTPService).

       3.      For the service, define a new Service Port (with the name HTTPPort).

                            a.      Select the binding you created in step one.

                            b.      Under Address specify the URL of your server.

Example

The URL for the Web Service CommunicationPartyService is as follows: http://<host>:<port>/CommunicationPartyService/HTTPBasicAuth?style=document.

4. Changing Settings for Error-Free Web Service Client Generation

To generate the Web service client without errors, you must make the following settings.

...

       1.      Choose Window ® Preferences ® Web Services.

       2.      Under Axis Emitter specify: Wsdl2Java.            

       3.      Select Prefers Building Beans to Straight Arrays for Wrapped XML Array Types.

If you leave this step out, then two-dimensional arrays are created during generation for the GenericPropertyTable type.

5. Generate a Web Service Client

You can now create a Web Service Client using the completed WSDL file.

...

       1.      From the menu choose New → Web Services → Web Service Client.

       2.      Choose the imported and completed WSDL file and use Develop Client action.

       3.      Choose Next and follow the wizard's instructions.

In the subsequent dialog boxes of the wizard you can, if required, change the target folder and specify a mapping between the namespace and the package name for the proxy data types. We recommend that you define a mapping for the namespaces urn:com.sap.aii.ibdir.server.api.types and urn:com.sap.aii.ib.server.api.types. If you do not define a mapping, a package name will be generated from the namespace.

Generation creates multiple Java classes, each representing the individual data types, as well as service and stub classes that are necessary for the call.

6. Call the Web Service

To be able to call the Web Service from Eclipse, you must create a new Java class with a main method.

For more information, see Code Example for Web Service Call (Eclipse Web Tools Platform).

 

 

End of Content Area