Skip to Content

How-To-Guide for consuming a Web Service with a standalone client using SAP NetWeaver Application Server Java(TM) EE 5 Edition

For better usage this guide is divided in four parts. In part one we choose a Web Service and save the

WSDL file on the computer. Part two deals with creating a standalone proxy. In part three we generate the Web Service Client Application

and afterwards we run the application.

To retrace this blog you need to install the SAP NetWeaver Application Server,
Java EE 5 Edition
and you need a access to the ES Workplace .

Part 1: Choose a WSDL file


For creating a standalone proxy we need a WSDL file to access the Web Service. In the following we will use the “Find Customer by Address”

Web Service which you can find on the ES Workplace. The Name of this Web Service in the mySAP ERP ECC 600 backend system is ECC_CUSTOMER002QR.


1. Open the ES Workplace: .

2. Click the link Enterprise Service Index.


3. In the browser window insert the name of the Enterprise Service: Find Customer by Address into the field Search and click Search in Enterprise Service Index.


4. In the browser window you get the result of the search. Click the link Find Customer by Address.


5. Now you can get detailed information about the Enterprise Service.


6. To open the WSDL file click the link on Related Web Service Definition.


7. Logon with your user.


8. Choose File –> +Save As…+in the browser window.


9. Change the file extension from XML to WSDL and choose Save.



The WSDL file was saved on your computer.

Part 2: Creating a standalone proxy


This procedure enables you to generate a standalone Web Service proxy for consuming a Web Service using the Web Service Client wizard.

Creating a Java project


1. Choose File –> New –> Project.


2. In the pop-up window choose Java Project and click Next.


3. Enter the project name: WsCall.

4. Choose Finish.



A new Java project was created.


Importing a WSDL file


The Web Service Client Wizard assists you in creating a new Web Service proxy from a WSDL file. First you have to import a WSDL file into your

Java project. To import a WSDL file follow the instructions below. You can also add a WSDL file by using drag and drop.


1. Choose File –> Import.


2. In the popup-window choose General –> File System and click Next.


3. Click Browse on the next page of the wizard to select the directories from which you would like to add the WSDL file.


4. On the next page select the checkbox for the WSDL file.

5. Specify the WsCall project as import destination.

6. When you have finished specifying your import options, click Finish.



The WSDL file was imported into your project.

Start the client wizard


With the added WSDL file you are able to generate a Web Service proxy.


1. Select the WSDL file from the WsCall project.

2. Press the right mouse button.

3. In the popup menu choose Web Services –> Generate Client.


4. A wizard for creating a Web Service Client starts.


5. Move the slider to the Assemble client position.

6. Check the settings in the configurations:

– Server: SAP Server

– Web service runtime: SAP Netweaver

– Client project: WsCall


7. Choose Finish.



The wizard has created the Java classes in the WsCall folder.

Part 3: Creating a Web Service Client Application

Creating a new class


To invoke the standalone proxy you need a new class with a main method.


1. Choose File –> New –> Class.


2. In the popup-window enter the class name: WsCall.

3. Insert the name of the package:

4. Select the checkbox public static void main(String[] args) to create a main method in the class.

5. Click Finish.



A new class with a main method was created.


Creating source code


To invoke the standalone proxy you have to create instances, insert authentication and set the values for the request. The complete source code of

the class is also available at the end of this chapter.


1. Insert the imports.


The source code for invoking the standalone proxy is created.

Complete source code for the class WsCall

Here is the complete source code for the class WsCall. You can copy it and paste it into the class file. Before running the program

change the settings for username “yourUser” and password “yourPassword” in the source code.

Part 4: Run the application


To test the Web Service Client you have to run the application. The result is displayed in the console view. The console view is

accessible from Windows –> Show View –> Console.


1. Select the class WsCall.

2. Choose Run –> Run As –> Java Application.



The result of the Web Service call is displayed in the console.


You must be Logged on to comment or reply to a post.
  • Hi Boris,

    I guess the concepts and implementation of Web services for different versions of NetWeaver must not be different and that is why this question.

    I am on NW04 SP 15 and have created a standalone proxy for a WSDL for a XI message interface. The code for setting the proxy host and port and credentials is based on guidelines from, involving classes BaseGeneratedStub, SecurityProtocol and AuthenticationContext. Ref

    How different is the usage of these classes as compared to the step 3 you have mentioned <3. Insert the proxy settings when they are necessary.> and which one is recommended.


    • Hi,
      The difference comes from the fact that the example shows how to comsume Web Services using Java EE 5. With NW04, the programming model is a derivation from JAX-RPC 1.1, and therefore the difference.
      I hope this helps.

      Nevertheless, applications developed with NW04/s will work in the same manner on the Java EE 5 edition server

      Regards, Vladimir

  • If I am not mistaken, the code above demonstrates authentication using web service authentication. How do we do basic authentication using the proxies generated?

  • Could you give us a code sample where MYSAPSSO2 cookie is used instead of username and password?

    Assume the application already has the SSO ticket.