java-using service group in calling web services from ejb.docx
TRANSCRIPT
-
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
1/18
Using Service Group in calling web services from EJB
Fuente:
http://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejb
Using Service Group in calling web services from EJBPosted byJenish PrabhuinService-Oriented Architecture (SOA) and SAPon Sep 23, 2013 2:34:00 PMinShare0
Idea behind Service Group:
Service group is configured with provider system, this helps to reduce configuration overhead andtransport issues. This document explains how it really helps in terms of configuration overhead and transport
issues.
When we write EJBs to invoke web service it takes the login parame ter for web service from logonticket or invocation parameter. Here we are going to see how to configure user account, so that for anyparticular web service invocation which uses the configured service group with user account, it will always usedifferent logon credential.
How to create Service Group Configuration DC ?
Lets proceed to create a new Service Group Configuration DC; in the example below we named
the Service Group ECC_SG.
1. Create a Service Group Configuration Project
http://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/people/jenish.prabhuhttp://scn.sap.com/people/jenish.prabhuhttp://scn.sap.com/people/jenish.prabhuhttp://scn.sap.com/community/soa/bloghttp://scn.sap.com/community/soa/bloghttp://scn.sap.com/community/soa/bloghttp://scn.sap.com/community/soa/bloghttp://scn.sap.com/people/jenish.prabhuhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejbhttp://scn.sap.com/community/soa/blog/2013/09/23/using-service-group-in-calling-web-services-from-ejb -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
2/18
2. Enter the DC name
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279411/New+Picture.png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
3/18
3. Switch to Service Composer Perspective. Create a new Service Group under Connectivity
4. In this scenario, I am creating a non-classified Service Group
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279551/New+Picture+(2).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279412/New+Picture+(1).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279551/New+Picture+(2).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279412/New+Picture+(1).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
4/18
-
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
5/18
-
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
6/18
How to configure Service Group
1. Log in to NWA Go to SOA > Application and Scenario Communication > Application Communication
2. Give the DC name for service group and search, it shows all the service group as below
3. Click on Edit button and choose create from provider system as shown below
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279563/New+Picture+(8).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279562/New+Picture+(7).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279563/New+Picture+(8).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279562/New+Picture+(7).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
7/18
4. It shows create screen as below, select required system name, system type to assign provider system
5. Once service group is configured with provider system it shows green status as below
How to invoke web service from EJB:
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279569/New+Picture+(11).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279565/New+Picture+(10).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279564/New+Picture+(9).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279569/New+Picture+(11).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279565/New+Picture+(10).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279564/New+Picture+(9).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279569/New+Picture+(11).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279565/New+Picture+(10).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279564/New+Picture+(9).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
8/18
1. Right click on working DC, Import > WSDL and Open Import wsdl dialogue from NWDS
2. Choose Remote Location / File System as below
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279570/New+Picture+(12).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
9/18
3. Give wsdl url and click on finish button
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279571/New+Picture+(13).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
10/18
4. Now wsdl file is downloaded in to the DC
5. Right-click on wsdl file and Web services > Create Service Reference as below
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279572/New+Picture+(14).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
11/18
6. In the New Service Reference dialogue choose existing service group that was already configured in theprevious step explained before.
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279573/New+Picture+(15).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
12/18
7. After click on Finish button newly added service reference is appeared as below
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279575/New+Picture+(17).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279574/New+Picture+(16).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279575/New+Picture+(17).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279574/New+Picture+(16).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
13/18
8. Now from the EJB call the web service as below
(a) Add local variable in EJB as below:
@WebServiceRef
TestService objTestService;
(b) Invoking the web service
TestBinding binding = objTestService.getPort(TestBinding.class);
Return return = binding.invokeWS(arg1, arg2, ar3);
String response = return.getMessage();
9. Go to NWA and SOA > Application and Scenario Communication > Application Communication
10. Type DC that is used for web service, go to Provider Services and Assign SAP_DEFAULT_PROFILE as
shown below.
Configure user account for service group:
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279576/New+Picture+(18).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
14/18
1. Go to NWA and SOA > Application and Scenario Communication > User Account Management
2. Click on New and create new user account
3. Click on Next and give connectivity type and metadata user/pass to invoke web service
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279577/New+Picture+(19).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
15/18
4. Go to assignment tab and click on new and choose Test user that was created earlier in the previous step
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279578/New+Picture+(20).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
16/18
5. Now click on Next button and choose provider system
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279579/New+Picture+(21).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
17/18
6. Now newly created User account is showing provider system and service group as below
http://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279581/New+Picture+(23).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279580/New+Picture+(22).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279581/New+Picture+(23).pnghttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279580/New+Picture+(22).png -
8/10/2019 JAVA-Using Service Group in calling web services from EJB.docx
18/18
Advantage of using service groups:
In the service group we define the provider system, which actually tells us the end point URL. By seeingservice group program can generate end point URL to invoke the web service. We are grouping all the relatedweb services as one entity and naming it as a group, so that it can be invoked with same credentials.
Using service group reduces the configuration and when ever transport happens, we dont really change theend point url config every time. Service group tells us which system the service is present.
By configuring user account we can invoke all the web services in the provider system with the logoncredentials that was defined when creating the account.
408 Views Topics:service-oriented_architecture
http://scn.sap.com/community/soa/blog/tags#/?tags=service-oriented_architecturehttp://scn.sap.com/community/soa/blog/tags#/?tags=service-oriented_architecturehttp://scn.sap.com/community/soa/blog/tags#/?tags=service-oriented_architecturehttp://scn.sap.com/servlet/JiveServlet/showImage/38-92786-279582/New+Picture+(24).pnghttp://scn.sap.com/community/soa/blog/tags#/?tags=service-oriented_architecture