cancel
Showing results for 
Search instead for 
Did you mean: 

Query on a scenario from SAP to Web service

Former Member
0 Kudos

HI ,


I have a scenario in my project from SAP to Web service. Currently an IDoc is being trigerred from SAP. The Web service has three services: Add_Id, Get_Id and Inactive_Id. There are two operations to be performed. One Add_Id and the other Inactive_Id.

Based on 4 fields of IDoc either Add_Id or Inactive_Id will be trigerred. If it is Add_id it is fine as it is asynchronous.

But if it Inactive_id, first Get_Id will be called and it is synchronous. This is because for one unique Id at SAP has different unique Id at Web service. A request message Get_Request_id  will go from SAP to Web service to fetch id from Web service and get a response back as a Get_Response_Id message. Then the Id received in response will be added to Inactive_Id and send asynchronously to Webservice.

Can anyone please suggest how to develop this scenario.If I use BPM , how to proceed with the condition check and triggering of the messages Add_Id(asynchronous) . Get_Id(synchronous0 and Inactive_Id(asynchronous).

Please suggest.

Regards,
Suman

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Suman,

I'm assuming that the Id is already in the idoc right? If yes, this can be achieved without BPM. You just need one inbound service interface with two operations: Add_Id and Inactive_Id

1st part: Add_Id

- Normal idoc to webservice scenario (async -> async)

2nd part: Inactive_Id

- Normal idoc to webservice scenario (async -> async) except in this case you would need to do a lookup (could be soap lookup) in the message mapping to retrieve the Id from the webservice

Use enhanced interface determination in ESR by using multi-mapping for the two target messages (0..1)

ID:

Only one receiver determination is needed

Only one interface determination is needed

Two receiver agreements

Hope this helps,

Mark

Former Member
0 Kudos

Hi Mark,

Yes Id is in the IDoc.

2nd part: Inactive_Id:

Should I go for soap lookup as instruction is to use Get_Id service or can I call this in soap look up?

I am working in PI 7.0 version. Could you please brief about soap look up, it will be helpful for me.

Regards,

Suman

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Suman,

SOAP lookup uses a SOAP receiver CC to make a lookup to a webservice, here is a blog about it

Inside the blog, there is also another reference

Since the ID is already there, you can directly call the Get_Id service from the receiver system.

Regards,

Mark

Former Member
0 Kudos

Hi,

I coded the UDF and I am getting the below error. Could anyone please suggest me?

Compilation of XXXX successful 

  •   Errorcom.sap.aii.mapping.lookup.LookupException: Exception during processing the payload.Problem when calling an adapter by using communication channel CC_SOAP_RCV_XYZ (Party: , Service: BS_ABC, Object ID: 3d8f669fa9b83362940a54056e6c1ab4) XI AF API call failed. Module exception: 'SOAP Error'. Cause Exception: 'SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Internal Error'.
    com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel CC_SOAP_RCV_XYZ (Party: , Service: BS_ABC, Object ID: 3d8f669fa9b83362940a54056e6c1ab4) XI AF API call failed. Module exception: 'SOAP Error'. Cause Exception: 'SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Internal Error'.
    at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.process(AdapterProxyLocal.java:96)
    at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.call(SystemAccessorInternal.java:47)
    at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:141)
    at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:74)
    at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:169)
    at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:178)
    at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:297)
    at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:212)
    at com.sap.aii.utilxi.hmis.web.workers.HmisInternalClient.doWork(HmisInternalClient.java:70)
    at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:507)
    at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doPost(HmisServletImpl.java:655)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
iaki_vila
Active Contributor
0 Kudos

Hi Suman,

The error seems to be in the response. Check the request in communication channel monitoring and try later the same request with SOAPui, with this you can check if the request is right and if you are getting an error. May be, you are getting a error page response and this raises the exception that you are seeing.

Regards.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Suman,

Did you construct the SOAP request xml? I guess you are directly passing the input parameters in udf.

To construct the xml follow this in udf

String SOAPxml =

"<yq1:SOAPrequestname xmlns:yq1=\"namespace of your SOAP Request\"><input1>"

            + input1

            + "</input1><input2>"

            + input2

            + "</input2></yq1:SOAPrequestname>";

Thanks,

Prudhvi


Former Member
0 Kudos

Hi,

I am using the attached code. The request and response messages are attached. Please suggest with the error posted earlier.

Regards,
Suman

Former Member
0 Kudos

Hi Suman,

Check this line in your code.

"<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:SendDataToStorage xmlns:ns0=\"http://xyz/ABC\">

Please use this code for SOAPxml and make sure your input parameters to the udf are a,b,c,d

String SOAPxml =

"<ns0:Get_Organizations_Request xmlns:ns0="urn:com.workday/bsvc"><Include_Roles_Data>"

+ a

+"</Include_Roles_Data><Include_Hierarchy_Data>"

+ b

+"</Include_Hierarchy_Data><Include_Supervisory_Data>"

+ c

+"</Include_Supervisory_Data><Include_Staffing_Restrictions_Data>"

+d

+"<Include_Staffing_Restrictions_Data></ns0:Get_Organisations_Request>";

Thanks,

Prudhvi

Edited the xml as per Indrajit.

Former Member
0 Kudos

Hi Suman

Create a external definition from the WSDL of the web service. Then once you created the external definition, you will see all the three service.

Then create one dummy message map and select the Get_Id request as the source message type.

Then click on test tab and see the xml source.

This will give you the xml format of the request message. Then you need to generate the same in UDF.

The structure you provided has the soap envelope in it. The UDF code provided by Prudhvi is only applicable when we are adding the soap envelope manually.

But normally we do not add soap envelope , the soap adapter take care of that.

For your understanding see the example below

Request with soap envelope

Request message in PI

xml:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:SendSMSToIndia xmlns:ns0="http://www.webserviceX.NET">

   <ns0:MobileNumber>34353454354</ns0:MobileNumber>

   <ns0:FromEmailAddress>test</ns0:FromEmailAddress>

   <ns0:Message>Test Message</ns0:Message>

In your case you need to populate this kind of xml in UDF.

</ns0:SendSMSToIndia>

Former Member
0 Kudos


Hi Indrajit,

Please find the code I am using. The response of Webservice is already attached in earlier replies. The code is not giving the desired value.It gives null sometimes.

Please note I have used a string variable "a", for Id in the code passed as parameter in the UDF.

If I use WID = node.getNodeValue(); it returns nothing. Instead if i use WID = node.getNodeName(); it return the correct node "wd ID". This happens when the entire string is hardcoded without using the string variable "a".

If use the string variable "a", even WID = node.getNodeName();  does not work.

Can you please help.

Regards,

Suman

Former Member
0 Kudos

Hi Suman

You have to change the code for parsing the response message as well.

Your soap response will come to PI without soap envelope and hence the structure will not have

any field like 'wd:Organization_Reference'

Please check the response message you are getting in PI after calling the web-service with your

input xml.

Former Member
0 Kudos

Hi Suman

Use this piece of code for getting the WID value

NodeList list = doc.getElementsByTagName("wd:Organization_Reference");

  Node node = list.item(0);

  if (node != null) {

  

  WID = node.getChildNodes().item(1).getTextContent();     

  }

This will return you the correct value.

Former Member
0 Kudos

Hi Indrajit,

Thanks for your reply. But I am working on version PI 7.0 with jdk 1.3 . The getTextContent() is available from jdk 1.5.

Is there any constaint with the PI 7.0 version for SOAP lookup?

Regards,
Suman