Blogs

Developing Web Services in J2EE and consuming in SAP NetWeaver Visual Composer Part1
lakshmi Prasad
Business Card
Company: Fujitsu consulting India Private Ltd(Rapidigm India)
Posted on Jun. 30, 2009 07:41 AM in Java Programming, SAP NetWeaver Platform

Subscribe.Subscribe
Print. Print
Permalink Permalink

This blog will explain how to use existing Java System services in SAP System.

One of the solutions is to make the Java function as Web Service and consume in SAP System.

Here we have shown simple steps to develop Web-Service in J2EE using NWDS Tool, Testing the Web Service and will show in the next blog how to consume this web Service in SAP NetWeaver Visual Composer.

 

Prerequisites:

• SAP NetWeaver Developer Studio 7.0.

• SAP J2EE Engine.

• SAP NetWeaver Visual Composer 7.0.

 

Implementation:

Launch NWDS and create new EJB Module Project.

 

image
image

Give the EJB Name, EJB Project, Bean Type as StatelessSessionBean, package name.

We get the required Home, Remote Interfaces and Bean Classes, Click finish.

 

Here we are going to create two Business logic methods.

  1. ConcatinationOfStrings takes two String parameters and returns the concatenated String.
  2. ConcatinationOfStrings takes three String parameters and returns the concatenated String.

image

After creating Business Methods, finish the EJB creation.

We can see the created EJB Module Project hierarchy as follows.


image

Go to the source code of BusinessBean.java class and implement the business logic like below, finally we are making these business logic methods as Web Services.

 public String concatinationOfStrings(String fString, String sString) {            return fString.concat(sString);}public String conCatinationsOfStrings(            String fString,            String sString,            String tString) {                         return fString.concat(sString).concat(tString);} 

We need to create Enterprise Application Project to make EAR file to deploy on WAS.


image

Give the name of the Enterprise Application Project and select the created EJB Module Project, Finish.

We can see the Enterprise Application Project hierarchy.

 

Process of Making Web Service…..

Go to created EJB Module Project and Make the Business Methods as Web Services.


image
image
image
image

Select the Enterprise Application Project and click OK

After creating Web Services Build the EJB Module Project.


image

If the build is successful we get the successful message. Add the EJB Module Project to EAR Project.


image

Build the Enterprise Application Project


image

Deploy the EAR file to the WAS Server.


image

Deployment is finished.

 

To Capture WSDL file and to test Web Service, go to the following URL

 

http://<Host>:<Port>/wsnavigator

Go to Your Web Service and get the URL of WSDL file for the usage of consuming.

To test the deployed Web Service, select the service and click Test.


image
image

Web Service is working fine on WAS.

Now we can consume the Web Service in SAP NetWeaver Visual Composer, ref blog 2.

lakshmi Prasad Lakshmi Prasad SAP Net Weaver EP consultant and SCJP certified java professional.


Add to: del.icio.us | Digg | Reddit


Comment on this articlesuggestions
Comment on this weblog
Showing messages 1 through 3 of 3.

Titles Only Main Topics Oldest First


Showing messages 1 through 3 of 3.