Requirement:

Developing and deploying a provider web service on SAP PI JAVA AS. This web service should be capable of taking an input xml from integration server, perform some action and return an output xml to integration server.

MainDiag.jpg

This Web service will be implemented using EJB (Enterprise java beans) and published on an http URL on SAP PI JAVA AS.

SAP PI will connect to this web service via SOAP Adapter.

Providing Web Services:

You can provide Web services using any of the two approaches:

·         Inside-out

You start from an implementation which is already available and expose it as a Web service. You create a Web service from a session Enterprise Java Bean or from a pure Java class.

This approach is also called bottom-up.

·         Outside-in

You start from a WSDL document of a service. In this case, the framework generates the skeleton of the implementation bean and you have to provide your own implementation of the business methods. You can create outside in Web services in session Enterprise Java Beans.

This approach is also called top-down.

Here we will explore Outside-in web service. That means we will use WSDL document of our inbound service interface to generate web service skeleton.

Development Steps:

1.     1. Open NWDS (NetWeaver Developer Studio).

      Create an EJB project

/wp-content/uploads/2014/04/1_423770.jpg

    Add project to an EAR.

/wp-content/uploads/2014/04/2_423771.jpg

Open ESR.

Select Inbound service interface for which you need to generate web service.

Go to WSDL tab. Export WSDL and save it on your machine.

Open NWDS.

Select EJB project which you have created in above steps-> Right click->New->Others->Web services-> Web service->OK

Browse your WSDL in service definition.

OR

2.      2. Connect your NWDS to PI 7.3 server.

       Go to Windows->Preferences->SAP AS JAVA->Add->Provide Host name and Instance number->OK.

/wp-content/uploads/2014/04/3_423772.jpg

3.       3. Open Enterprise Service Browser in NWDS.

       Go to Windows->Show View-> Others->Web Services-> Enterprise Service Browser->OK

/wp-content/uploads/2014/04/4_423815.jpg

4.       4. Connect to ESR.

        Click Connect to ESR button->Provide PI server credentials.

/wp-content/uploads/2014/04/5_423816.jpg

5.       5. Generate Java Bean Skeleton for inbound service interface.

        Navigate to your inbound service interface->Right click->Generate Java Bean Skeleton.

/wp-content/uploads/2014/04/6_423817.jpg

6.      6. Select Web Service Type “Top down java web service” and Level of service generation “Develop”->Click Next.

/wp-content/uploads/2014/04/7_423818.jpg

7.      7. Select Update WSDL.

/wp-content/uploads/2014/04/8_423819.jpg

8.      8. Select Resolve Collisions Automatically->Click next for more customization or Click finish.

/wp-content/uploads/2014/04/9_423820.jpg

9.      9. You can customize service, port type, port and binding name here-> Click next for more customization or Click finish.

/wp-content/uploads/2014/04/10_423825.jpg

10.    10. You can customize package here->Click Finish.

/wp-content/uploads/2014/04/11_423826.jpg

11.     11. Now your EJB Project structure will be something like below.

/wp-content/uploads/2014/04/12_423828.jpg

12.     12. Open implementation bean class.

               Define TransportBindingRT annotation and Write the processing logic of your web service.

/wp-content/uploads/2014/04/13_423829.jpg

    Note:

    TransportBindingRT annotation defines HTTP URL of your web service. The same URL will be used as a Target URL in Receiver SOAP communication  channel in PI.

    For example:

   @TransportBindingRT(AltHost=”pidserver.net”,AltPort=51100,AltPath=”RetriggerBean”)

   Your Web service’s HTTP URL will be, http://pidserver.net:51100/RetriggerBean

   Your Web service WSDL URL will be, http://pidserver.net:51100/RetriggerBean?wsdl

Deployment Steps:

1.      Select your EJB Project ->Right Click->RunOnServer->select the server name to be deployed->Click finish.

/wp-content/uploads/2014/04/14_423837.jpg

Testing Steps:

   Go to Startpage of SAP NetWeaver Application.

/wp-content/uploads/2014/04/15_423838.jpg

    Go to Web Service Navigator.

    Provide your WSDL URL.

    http://pidserver.net:51100/RetriggerBean?wsdl

/wp-content/uploads/2014/04/16_423846.jpg

  Follow the steps and provide appropriate input to test your web service.

Thanks & regards,

Ambuj Mishra

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply