Skip to end of metadata
Go to start of metadata

Create an Enterprise Service in the Backend an a Java EE 5 Web Client, JSP

Prerequisites: Install NW 7.0 ABAP Trial (available on SDN), Java EE 5 Edition

Part 1: In the ABAP 7.0 backend system NSP

1. call transaction SE80.

2. Create new function module "Z_CURRENCY"

3. Define Local Interface - Import Parameter: EURO TYPE F DEFAULT 0

4. Define Local Interface - Export Parameter: DOLLAR TYPE F

5. Add some funny source code. E.g. <span class="Stil1"> DOLLAR = EURO * 2 .</span> is fine for this introduction example.

6. Click on "test" button ("F8") if you like.

7. Choose "Create Web Service" from Context menu of your function module ZCONVERTER. the "Create service definition" wizard will popup it consist out 4 steps:

  1. Create service: we call the service ZCCONVERTER
  2. Choose endpoint: Choose function module ZCONVERTER
  3. Configure service: we choose basic authentication
  4. Complete

8. Switch ("/n") to transaction WSCONFIG. "Create" Service "ZCCONVERTER". Create means in this transaction "Release Web Service for SOAP Runtime". You can now use it. the standard url is:

  • /sap/bc/srt/rfc/sap/ZCCONVERTER

9. Change to transaction WSADMIN. Look at the webservice. you may test the web service.

10. Switch to transaction SICF and enter ZCCONVERTER as service name. Click on "Display Service" in the context menu of the service. A detail screen will open. Cklick on the "Logon Data". Maintain here User and Password, so this web service does not need authentication from the web service client.

11. Click on the context menu on "Test Service". the endpoint opens in a browser. Add &wsdl=1.1 if you like to see the wsdl in document style or &wsdl=1.1&style=rpc if you want to see it rpc style. rpc contains less elements. You can also call the wsdl from the WSADMIN transaction.

Congratulation - you finished the ABAP part.

Create Java Web Service Client in Web 2.5 Project

1. Start SAP NetWeaver Developer Studio (DS) and check your Window --> preferences.
SAP AS Java should point to your message server port. Typically localhost:3600 or 3601.

2. Web Services --> Profile Compliance and Validation: switch on or off Wizard WSDL validation. Currently the WSDL validation cannot handel SAP specific tags.

3. Web Services --> Server and Runtime: Server should be "SAP Server" and WS runtime should be "SAP NetWeaver" if you want to consume ABAP web services with SAP datatypes. Standard AXIS cannot consume business data types.

4. Create a new Web project: File -> New -> Project. Choose Web ->Web 2.5 -> Dynamic Web Project 2.5.
(Alternatively you may follow Part I of the weblog series and create a simple Java client)

5. Enter Project name in the popup wizard: ZCConverterWeb. Choose "Add project to an EAR". Enter also a name: ZCConverterEar.

6. Mark ZCConverterWeb and open context menu: New->Other> Web Services -> Web Service Client. The Web Service Client Wizard pops up.

7. Enter service definition. Use the URL from the ABAP web service. E.g.: http://localhost:8000/sap/bc/srt/rfc/sap/ZCCONVERTER?sap-client=000&wsdl=1.1&style=rpc
&style=rpc is optional for slighter WSDls.

8. If you forgot to maintain user and password in ABAP you will be prompted for user and password. In that case you will have to add some lines of code for authentication lateron.

9. Check configuration is SAP and set the slider to "Start Client". "Test Client" does not work yet. You have to program the web tier manually.

10. Look at the generated web servcei client. you will notice that the ZCCONVERTERSERVICE_WSDL_LOCATION is null if you create the web service client in a web project. thsi is a kown "feature". You may create a 2nd WS client in a simple Java project an copy the following code by hand into the constructor:

* Service implementation of

Unknown macro: {ZCConverterService}

(generated by SAP WSDL to Java generator).
*/ = "ZCConverterService", targetNamespace = "urn:sap-com:document:sap:rfc:functions", wsdlLocation = "WEB-INF/classes/wsdl/sap/bc/srt/rfc/sap/ZCCONVERTER/wsdlroot.wsdl")
public class ZCConverterService extends {

* Default service constructor. Usually this has to be done manually. As a workaround create this client in a Java project and * import it into web project.
static { url = null;
try { tmpUrl = Thread.currentThread().getContextClassLoader().getResource("wsdl/sap/bc/srt/rfc/sap/ZCCONVERTER/wsdlroot.wsdl");
url = new, tmpUrl.getHost(), tmpUrl.getPort(), tmpUrl.getFile());
} catch ( e) {

11. Create a JSP page index.jsp for testing:

<%@ page language="java" contentType="text/html; charset=UTF-8"
<%@page import=""%>
<%@page import=""%>
<p>my first Web Service Client</p>

try {
ZCConverterService service = new ZCConverterService();
out.write("service called ");
ZCConverter converterSoapBinding = service
out.write("service binded ");
float f = converterSoapBinding.zconverter(2f);
out.write("result: "+f);
} catch ( e) {

12. run as --> run on server. the result will look like this:

my first Web Service Client
service called
service binded
result :4.0


(pictures will follow, Best Regards Oliver)

  • No labels