Skip to Content
0

SFDC Integration with SAP PI error

Aug 02, 2017 at 02:36 PM

575

avatar image

Hi,

I am trying to integrate ECC with SFDC, I have created SOAP LOOKUP UDF to get the session ID, while testing interface using SOAP UI I am getting below error -

http://schemas.xmlsoap.org/soap/envelope/"> SOAP:Server Server Error http://sap.com/xi/WebService/xi2.0"> XIAdapter ADAPTER.JAVA_EXCEPTION See log trace with id: n/a

After checking CC created for SOAP LOOKUP, I observed call going for login but while getting response it is giving error -

08/02/2017 10:26:48 America/New_York9e40a760-778e-11e7-a9ec-000000827896error in response08/02/2017 10:26:48 America/New_York9e40a760-778e-11e7-a9ec-000000827896call completed08/02/2017 10:26:48 America/New_York9e40a760-778e-11e7-a9ec-000000827896Request Entering
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Manoj K Aug 02, 2017 at 02:51 PM
0

Have you treid hitting the SFDC directly from SOAP UI and see what is the response ?

You can enable Trace in your receiver SOAP LOOKUP channel and then cross the paylaod with raw data of soap ui.

You may refer this blog

Br,

Manoj

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Manoj,

Yes I did SOAP UI test and got response successfully....

I have followed your blog as well....

Below is my UDF -

{ String sessionId =""; try { Channel channel = LookupService.getChannel("BC_SFDC",Channel); SystemAccessor accessor = null; accessor = LookupService.getSystemAccessor(channel); String loginxml = " enterprise.soap.sforce.com\"> " + UserName + " " + Password + " "; //convert to inputsream InputStream inputStream = new ByteArrayInputStream(loginxml.getBytes()); //do a SOAP lookup with input payload Payload payload = LookupService.getXmlPayload(inputStream); Payload SOAPOutPayload = null; /*The SOAP call is made here and the response obtained is in the SOAPOutPayload.*/ SOAPOutPayload = accessor.call(payload); /* Parse the SOAPPayload to get the SOAP Response back. */ InputStream inp = SOAPOutPayload.getContent(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); /* Create DOM structure from input XML */ DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(inp); //recover session id and url to send next request to SFDC NodeList sessionId1 = document.getElementsByTagName("sessionId"); Node node = sessionId1.item(0); String url=document.getElementsByTagName("serverUrl").item(0).getTextContent(); if (node != null) { node = node.getFirstChild(); if (node != null) { sessionId = node.getNodeValue(); } } } catch(Exception e) {e.printStackTrace(); } return sessionId; }

Do you see anything wrong here?

0
Rashmi Joshi Aug 02, 2017 at 03:37 PM
0

I just checked logs and found below message, may be because of this I am unable to get SessionID back from lookup channel -

CLIENT: 44599 RESPONSE: - 974 bytes:

http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn: fault.enterprise.soap.sforce.com" xmlns:xsi=" sf:UNSUPPORTED_CLIENT UNSUPPORTED_CLIENT" target="_blank">http://www.w3.org/2001/XMLSchema-instance"> sf:UNSUPPORTED_CLIENT UNSUPPORTED_CLIENT : TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https. UNSUPPORTED_CLIENT TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https. https://ap5.salesforce.com/secur/weakhttps.jsp?l=1 Stronger security is required

Any comment on this?

-

Rashmi

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Error itself is self descriptive . Your PI system is sending request with TLS 1.0 you need to upgrade it to higher version :

https://blogs.sap.com/2017/06/09/chronicles-of-a-tls-1.2-upgrade/

0
avatar image
Former Member Aug 02, 2017 at 04:03 PM
0

I have requested Basis team for TLS issue.

Meanwhile, can you help me in understanding if my scenario is correct.

ESR - Created manual header for Query Req message -

I am passing USER ID and PSWD as input to SOAP LOOKUP UDF which I have mapped to SESSION ID Field.

Please see previous comment for UDF details..

After this I have created 2 ICOs... 1 Dummy ICO carrying SOAP RCVR CC -

2nd ICO - carrying actual SI details -

SOAP CC -

Please let me know if you find any issue at interface level...

BR,

Rashmi


soaplookup-udf.png (16.0 kB)
soaplookup-cc.png (17.2 kB)
soap-cc1.png (18.2 kB)
soap-cc2.png (6.8 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Rashmi,

Everything looks fine , i believe you have set Dynamic UDF to set the URL which is coming from lookup along with session id . But i dobut if the variable url will work you need to set the dynamic URL for TServerLocation

You exact scenario is reflected here

Br,

Manoj

0
Rashmi Joshi Aug 03, 2017 at 06:02 AM
0

Hi All,

Could you please check above config and let me know if it needs any changes?

BR,

Rashmi

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Have you corrected the Dynamic variable name from url to "TServerLocation " .

Below are the only standard Variable supported by SOAP:

br,

Manoj

soap.png (9.0 kB)
0

Do I need to make changes in my UDF for below line -

String url=document.getElementsByTagName("serverUrl").item(0).getTextContent();

Or just need to put "TServerLocation" in ASMA of my actual RX SOAP Channel?

BR,

Rashmi

0

You use the below UDF for lookup i.e pass user id and password and get the session is and the target url.

{ String sessionId ="";
 try { Channel channel = LookupService.getChannel("BC_SFDC",Channel);
 SystemAccessor accessor = null;
 accessor = LookupService.getSystemAccessor(channel);
 String loginxml = " enterprise.soap.sforce.com\"> " + UserName + " " + Password + " ";
 //convert to inputsream InputStream inputStream = new ByteArrayInputStream(loginxml.getBytes());
 //do a SOAP lookup with input payload Payload payload = LookupService.getXmlPayload(inputStream);
 Payload SOAPOutPayload = null;
 /*The SOAP call is made here and the response obtained is in the SOAPOutPayload.*/ SOAPOutPayload = accessor.call(payload);
 /* Parse the SOAPPayload to get the SOAP Response back. */ InputStream inp = SOAPOutPayload.getContent();
 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 /* Create DOM structure from input XML */ DocumentBuilder builder = factory.newDocumentBuilder();
 Document document = builder.parse(inp);
 //recover session id and url to send next request to SFDC NodeList sessionId1 = document.getElementsByTagName("sessionId");
 Node node = sessionId1.item(0);
 String url=document.getElementsByTagName("serverUrl").item(0).getTextContent();
 if (node != null) { node = node.getFirstChild();
 if (node != null) { sessionId = node.getNodeValue();
 } } } catch(Exception e) {e.printStackTrace();
 } return sessionId;
 }

Now once you have received the url you need to set this to the receiver soap channel which you need to do it via dynamic configuration . So your UDF should also have the below code.

{ String sessionId ="";
 try { Channel channel = LookupService.getChannel("BC_SFDC",Channel);
 SystemAccessor accessor = null;
 accessor = LookupService.getSystemAccessor(channel);
 String loginxml = " enterprise.soap.sforce.com\"> " + UserName + " " + Password + " ";
 //convert to inputsream InputStream inputStream = new ByteArrayInputStream(loginxml.getBytes());
 //do a SOAP lookup with input payload Payload payload = LookupService.getXmlPayload(inputStream);
 Payload SOAPOutPayload = null;
 /*The SOAP call is made here and the response obtained is in the SOAPOutPayload.*/ SOAPOutPayload = accessor.call(payload);
 /* Parse the SOAPPayload to get the SOAP Response back. */ InputStream inp = SOAPOutPayload.getContent();
 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 /* Create DOM structure from input XML */ DocumentBuilder builder = factory.newDocumentBuilder();
 Document document = builder.parse(inp);
 //recover session id and url to send next request to SFDC NodeList sessionId1 = document.getElementsByTagName("sessionId");
 Node node = sessionId1.item(0);
 String url=document.getElementsByTagName("serverUrl").item(0).getTextContent();

*****************Dyanmic Config code**********************************

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//Create the TServerLocation key in namespace http://sap.com/xi/XI/System/SOAP. This key will hold the dynamically created URL

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP", "TServerLocation");
//Put the url value from the input in the configuration under the specified key
conf.put(key, url); 

*****************Dyanmic Config code**********************************

 if (node != null) { node = node.getFirstChild();
 if (node != null) { sessionId = node.getNodeValue();
 } } } catch(Exception e) {e.printStackTrace();
 } return sessionId;
 }

And in channel change it to : TServerLocation

Br,

Manoj

0

Thanks!!!! I will try this code and let you know results...

BR,

Rashmi

0
Rashmi Joshi Aug 13, 2017 at 06:09 PM
0

Hi Manoj K,

I am able to get sessionID... While triggering message from SOAPUI I am getting RESPONSE error message -

SOAP: Error occurred: com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: Response message contains an errorXIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Server Error

I downloaded payload from RWB and again tested the same using SOAPUI, here I am getting response back.

Any idea what might be causing issue now?

BR,

Rashmi

Show 18 Share
10 |10000 characters needed characters left characters exceeded

Rashmi,

if i understand your problem you are able to get session id from SOAP UI but not from PI system?If yes then the best way to check is the trace file i.e the final payload with http headers from PI with SOAP UI RAW data and see if you can see any difference between then.

You need to enable Trace in your Soap Lookup channel. and then compare that trace file request and response with soap UI.

For HTTP 500 there is no fixed solution this error is thrown by server or PI which is not able to interpret the server's response .500 is the error which is thrown when there is no descriptive for any other error like (4**) so you need to cross check the payload,http headers , content type etc..

Br,

Manoj

0

Hi Manoj,

I am able to get sessionID from both SOAP UI and PI, after this I am triggering query() method for ACCOUNT in SFDC... While triggering this interface I am getting HTTP 500 error in response -

ErrorSOAP: Response message contains an errorXIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Server Error
InformationSOAP: Continuing to response message 7f8ebe60-80c2-11e7-a516-000000827896
ErrorMP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: Response message contains an errorXIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Server Error

Am I missing something in response message... How can I check response payload....

0

Hi Rashmi,

Enable the trace in the channel whichever is having this error , The trace will come in handy so to understand what is going on with request an response payload.

Br,

Manoj

0

Hi Manoj,

I am getting missing header error for response message, does it mean I need to write java program again to handle response message -

CLIENT: 17030 RESPONSE: - 287 bytes:

soapenv:Client SOAPAction" target="_blank">http://schemas.xmlsoap.org/soap/envelope/"> soapenv:Client SOAPAction HTTP header missing

Below is my request message -

CLIENT: 17030 REQUEST: - 519 bytes:

http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn: enterprise.soap.sforce.com"> 00D7F000001ZuF3!ARgAQI5jdn5kYoEaHUGH7tYlF7ebGhyguPdH4bc6RexSHP.5RnJh4o1gHa6q1yCZyJr0ShQcFsUEfBuv4E9IGTrE_EtYd5g7 Select Name, Phone, OwnerId from Account

BR,

Rashmi

0

This is currently what is happening in your scenario :

1.Initial call is made to SFDC for getting SESSION ID and URL which is done by SOAP Look up channel which has URL :https://salesforce.com/services/SOAP/c/40.0 and soap action as :login.

2.Now once you get the Session ID and URL you populating session ID in one of the target field and you are using the URL for SOAP receiver channel via Dynamic UDF . But note here you are setting only Dynamic URL you have not mentioned and SOAP action so the error :

Client SOAPAction HTTP header missing

So i believe the SOAP action is always static for this call only URL is dynamic , if yes then check which SOAP Action is used in SOAP UI and mention the same in your reciever channel.

Br,

Manoj

0

Hi Manoj,

Finally able to get the response message but failing with below log -

Transmitting the message using connection SOAP_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error encountered while executing mapping: com.sap.aii.af.service.mapping.MappingException: Mapping failed in runtimeRuntime Exception when executing application mapping program com/sap/xi/tf/_MM_SFDC_ACCOUNT_RESP_; Details: com.sap.aii.mappingtool.tf7.IllegalInstanceException; Cannot create target element /ns0:queryResponse. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD

BR,

Rashmi

0

So basically I am getting HEADER in response message which I need to handle in PI now... Any idea how can I delete this header message and select only BODY part?

BR,

Rashmi

0

The error is because of the mandatory filed missing in your receiver mapping , can you please check what is the response you are getting from SFDC and what is the response it is expecting in your receiver mapping.

What actually you mean by below sentence ?

So basically I am getting HEADER in response message which I need to handle in PI now... Any idea how can I delete this header message and select only BODY part?

Br,

Manoj

0

So this is what is coming from SFDC -

sobject.enterprise.soap.sforce.com" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns="urn: enterprise.soap.sforce.com" xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/"> 22 15000 API REQUESTS <queryResponse> <result> <done>true</done> <queryLocator xsi:nil="true"/> <records xsi:type="sf:Account">

And my response map in SAP PI is like this -

<?xml version="1.0" encoding="UTF-8"?> <ns0:queryResponse xmlns:ns0="urn:enterprise.soap.sforce.com"> sobject.enterprise.soap.sforce.com"/>

BR,

Rashmi

0

Rashmi,

Try to uncheck "Do Not use soap Envelope" in ur receiver channel if you are still facing issue then you need to go for XSLT/Java mapping to format the SFDC response structure to your given MM structure.

Br,

Manoj

0

Hi Manoj K,

I tried above option but it didnt help, can you help with JAVA/XSLT map how should I proceed?

BR,

Rashmi

0

Will try it out , can you please provide :

  • Sample XML which is expected in Response Mapping put some dummy values and takes xml from OM test tab.
  • Current XML which you are getting from SFDC.
0

Hi Manoj,

PFA attached XML files from PI and SFDC RESPONSE.

BR,

Rashmi

sfdc-resp.txt

pi-resp.txt

pi-resp.txt (144.3 kB)
sfdc-resp.txt (4.1 kB)
0

Hi Rashmi,

The Response which PI is expecting is totally different from the one which SFDC is sending i was expecting a small changes but this is totally different .

Can you please make sure if you are using the correct XSD/WSDL/Structure for the response . please check this with SFDC team once and get the structure corrected in PI or in SFDC.

Br,

Manoj

0

Yes Manooj, this is what SFDC is sending and same WSDL I have imported in PI which they have provided....

0

Is it the same xml you get in response when you check/unckeck "Do not use soap envelope "

Because the XML which you have provided has complete soap envelope but in your case you just need to soap body content so can you please check if the xml in case when you check/unckeck "Do not use soap envelope " . and attach the xml for both the case here.

0

Just for my understanding, can SFDC send data in format which I can see in PI??

0

No i dont think so that is standard format defined by SFDC and i doudt if they can modify for each customer.

0