|
Blogs
The tutorial is developed with SAP NetWeaver 7.1. To retrace this blog you need to install the SAP NetWeaver Application Server, Java EE 5 Edition and you need access to the ES Workplace.
Part 1: For pictured but different descritption see the following article. 1. Navigate to SDN ES Workplace homepage http://erp.esworkplace.sap.com/socoview. 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. 8 Copy the link http://erp.esworkplace.sap.com/sap/bc/srt/xip/sap/ECC_CUSTOMER002QR?sap-client=800&wsdl=1.1 to your clipboard. Otionally you may save the WSDL locally in your file system. Eclipse based NetWeaver Developer Studio NWDS can handle both ways. Part 2: Test the WSDL 1. Open theES Workplace http://erp.esworkplace.sap.com/ in your Browser and click on Web Service Navigator. 2. Enter the WSDL, click next and logon with your credentials. 3. Click on "Test" in the navigation pane. 4. You see the Request Test Page for the wsdl:portType name="CustomerSimpleByNameAndAddressQueryResponse_In" 5. Enter e.g. "Julia" into xsd:element name="FirstLineName" and click "Send" button. 6. You will receive a Response list of customers. Look carefully at the nested structure of the Web Service reuest and response. We will need it for programming in the next part.
Part 3: Creating a java proxy in WEB 2.5 ProjectUseThis procedure enables you to generate a standalone Web Service proxy for consuming a Web Service using the Web Service Client wizard.Creating a Web 2.5 projectProcedure1. Choose File --> New --> Project.2. In the pop-up window choose Web --> Web 2.5 Project and click Next. As a Result a new Web Project (for Java EE 5) is created. 5. Create a new Web Service Client. Choose File --> New --> Other --> Web Service Client. 6. In the popup wizard enter the WSDL-URL and choose "Deploy Client" in the slider on the left (however you may choose whatever you like, it has no influence in this project type. 7. Choose "SAP NetWeaver" as Web Service Runtime instead of "Apache Axis". Otherwise you will not be able to "SAP Global datatypes", You will need them for the rather complex business data types. 8. Choose finish, a Java Proxy is generated. 9. This Java Proxy has a known bug. Programm the service implementation manually: package com.sap.xi.appl.se.global; /** private final static java.net.URL CUSTOMERSIMPLEBYNAMEANDADDRESSQUERYRESPONSEINSERVICE_WSDL_LOCATION;
Part 4: Creating a Web Service Client Web ApplicationCreating a new JSPUseTo invoke the standalone proxy you need a new JSP page.Procedure1. Choose File --> New --> JSP .2. In the popup-window enter the class name: index. Creating source codeUseTo 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.Coding (Tested with SAP NW 7.1)<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.sap.xi.appl.se.global.CustomerSimpleByNameAndAddressQueryMessage_SyncType.CustomerSimpleSelectionByNameAndAddressAnonymous"%> // create service: CustomerSimpleByNameAndAddressQueryResponse_In out.write("Webservice call succeeded."); %>
JSP Page ResultWebservice returns : Webservice call succeeded. Julia Chase Julia Ewing ... Oliver Stiefbold has been with SAP since 1998 and has worked in Development in ERP Automotive and consulting in e-Commerce. Since 2001, he's been the product manager for the Portal Development Kit. |