Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

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

Use

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.

Procedure

1. Open the ES Workplace: http://erp.esworkplace.sap.com/socoview .

2. Click the link Enterprise Service Index.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/01_ES_Workplace_Startseite.JPG|height=347|alt=i...!


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.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/02_WebService_Suche.JPG|height=374|alt=image|wi...!


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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/03_Search_Results.JPG|height=220|alt=image|widt...!



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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/03_overview.JPG|height=396|alt=image|width=531|...!


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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/04_Related_Web_Service_DefinitionSearch_Results...!



7. Logon with your user.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/05_Login_Window.JPG|height=226|alt=image|width=...!


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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/06_WSDL_browser.JPG|height=319|alt=image|width=...!


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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/07_save_file.JPG|height=330|alt=image|width=451...!


Result

The WSDL file was saved on your computer.

Part 2: Creating a standalone proxy

Use

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

Procedure

1. Choose File --> New --> Project.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/08_create_project.JPG|height=168|alt=image|widt...!


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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/09_popup_create_project.JPG|height=324|alt=imag...!


3. Enter the project name: WsCall.

4. Choose Finish.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/10_popup2_create_project.JPG|height=388|alt=ima...!


Result

A new Java project was created.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/11_overview_project.JPG|height=176|alt=image|wi...!


Importing a WSDL file

Use

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.

Procedure

1. Choose File --> Import.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/12_choose_import.JPG|height=373|alt=image|width...!


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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/13_choose_File_System.JPG|height=303|alt=image|...!


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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/14_browse_wsdl.JPG|height=321|alt=image|width=4...!



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.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/15_select_wsdl.JPG|height=364|alt=image|width=4...!

Result

The WSDL file was imported into your project.

Start the client wizard

Use

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

Procedure

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.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/16_select_generate_client.JPG|height=146|alt=im...!



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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/17_web_service_wizard.JPG|height=396|alt=image|...!


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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/18_finish_wizard.JPG|height=396|alt=image|width...!


7. Choose Finish.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/19_oveview_project.JPG|height=353|alt=image|wid...!


Result

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

Part 3: Creating a Web Service Client Application

Creating a new class

Use

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

Procedure

1. Choose File --> New --> Class.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/20_new_class.JPG|height=123|alt=image|width=414...!


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

3. Insert the name of the package: com.sap.xi.appl.se.global.

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

5. Click Finish.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/21_create_new_class.JPG|height=399|alt=image|wi...!


Result

A new class with a main method was created.



!https://weblogs.sdn.sap.com/weblogs/images/251739409/22_overview_class.JPG|height=208|alt=image|widt...!


Creating source code

Use

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.

Procedure

1. Insert the imports.

Result

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

Use

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.

Procedure

1. Select the class WsCall.

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



!https://weblogs.sdn.sap.com/weblogs/images/251739409/23_run_appl.JPG|height=187|alt=image|width=441|...!


Result

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



7 Comments