Introduction
PI Web Services can be consumed in EJB similar to any other SOAP based web services. To have a secure way of execution of PI Web services in EJB, we can make use of service group component and provider system configured in SAP Enterprise Portal. These EJBs later can be consumed in any web based applications like WebDynpro JAVA, J2EE or SAPUI5 applications.
In this document, I have tried to explain the procedure of creating Service group component, mapping the PI SOAP web service to this service group. Configuring Provider system in SAP Enterprise portal and mapping the service group component to the Provider system, to have a secure way of execution of the PI web services.
Note: PI web services can also be created as RESTFul services. The procedure explained in this document is only for SOAP based services.
Step by Step Procedure
Switch to Development Infrastructureperspective -> right click on the SCA in Track (or LocalDevelopment -> MyComponents)-> New -> Development Component -> Java EE -> Select EJB Module and click Next. Enter the dc name and click on Finish.
Switch to J2EE perspective -> right click on the EJB DC (created above) -> New-> Session Bean (EJB 3.X)-> Enter the package name and Class name and click Next and Finish.
Right click on the EJB DC -> Import -> import… -> Web Service -> select WSDL and click Next.
Select Remote Location/File System and click Next -> Enter the WSDL URL -> Click on Finish.
After the import, the WSDL files should be displayed in the project structure as shown in the below screen shot.
Switch to Development Infrastructure perspective -> right Click on the Track (or LocalDevelopment -> MyComponents) -> New -> Development Component -> Select Service Group Configuration and click Next. Enter the dc name and click on Finish.
Switch to J2EE perspective -> right click on the EJB DC -> Development Component -> Show In -> Component Properties. Open Dependencies tab, click on Add button. Search for the Service group Configuration DC created earlier and Select the DC and click on Next -> Finish.
Switch to Development Infrastructure perspective -> right Click on the Track (or LocalDevelopment -> MyComponents) -> New -> Development Component -> Java EE -> Select Enterprise Application and click Next -> Enter the DC name and
Click Next -> Next -> Select the EJB DC and Service group DC created earlier and click Finish.
Switch to J2EE perspective -> right click on the WSDL file in EJB DC -> Web Services -> Create Service Reference.
Enter the Package name, Service Group Name, Service Group Description, and Select the Service Group Configuration DC created earlier, in the Create in Project dropdown and click Finish.
Repeat this procedure for all other WSDL files added to the EJB DC.
This will create the Service groups in the Service Group Configuration DC and will have the reference created between the new Service group and the WSDL as shown in the below screen shots.
Service Groups in Service Group Configuration DC.
Service group references in EJB DC
Switch to J2EE perspective -> right click on the WSDL file in EJB DC -> Web Services -> Generate Client -> Click Next -> Select “Specify JAX-WS Customization files” and click Next -> Finish.
Repeat this procedure for all the WSDL files added to the EJB DC.
At the end of this procedure, Java Client would have been created for each of the WSDL file under ejbModule folder in the EJB DC.
The Web service proxy generated in the previous step can be invoked from the EJB Session bean. Create a method in the Session bean and follow the below steps to invoke the web service proxy.
@WebServiceRef (name="EmployeeLookupServiceService")
EmployeeLookupServiceService pernrLookupService;
EmployeeLookupService pernrLookupServiceReq = pernrLookupService.getPort(EmployeeLookupService.class);
EmployeeSimpleByElementsRespMsg pernrResponse =
pernrLookupServiceReq.employeeSimpleByElementsQuery(empServiceReq);
Where EmployeeSimpleByElementsRespMsg is a response class and empServiceReq is the request data to be passed to
the web service.
Build and Deploy the EAR DC.
Login to NWA and navigate to SOA -> Technical Configuration -> System Connections -> Provider Systems.
Click on Newbutton to create a new Provider System.
Enter the System name, select System type as “Other”, provide the description and click on Next.
Click on Switch to Advance Mode link, as highlighted in the below screen and provide the WSDL or WSIL URL. Also enter the Authentication settings and click Next.
Three types of runtime authentication is possible.
Check Do Not Use RFC Connectivity checkbox and click Next.
Verify the message and click Finish.
To map the provider system configured in SAP Enterprise portal with the Service groups deployed as part of Service configuration DC created earlier, follow the below steps.
Login to NWA and navigate to SOA -> Application and Business Scenario Communication -> Application Communication.
Search for the Service Group Configuration component, deployed on the server.
Select the Service group configuration component and click on Edit button in the Consumed Service Groups tab.
Select the provider system(s) created earlier from the drop down in Provider Systems column and click on Save button to save the changes.
Login to NWA -> SOA -> Single Service Administration.
Switch to Consumer Proxies tab and search for the Service endpoint by its name. We should get two endpoints for each web service, as shown below. One endpoint is the representation of mapping between service group and Provider system and the other, for the service used in the EJB component.
Select the second endpoint and select the port defining the mapping between Service group and provider system as shown in the below screen and click on Set as Default button.
Conclusion
By following the above mentioned procedure, one can achieve a secure execution of PI web service from an EJB. The EJB then can be consumed in a WDJ, Java/J2EE and SAPUI5 applications or in a BPM process step.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
2 |