cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI to SFDC

Former Member
0 Kudos

Hi All,

I am trying to send a message from SAP to SFDC using PI 7.1 EHP 1. I am getting the below error:

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

- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

- <soapenv:Body>

- <soapenv:Fault>

<faultcode>sf:INVALID_TYPE</faultcode>

<faultstring>INVALID_TYPE: Must send a concrete entity type.</faultstring>

- <detail>

- <sf:InvalidSObjectFault xsi:type="sf:InvalidSObjectFault">

<sf:exceptionCode>INVALID_TYPE</sf:exceptionCode>

<sf:exceptionMessage>Must send a concrete entity type.</sf:exceptionMessage>

<sf:row>-1</sf:row>

<sf:column>-1</sf:column>

</sf:InvalidSObjectFault>

</detail>

</soapenv:Fault>

</soapenv:Body>

</soapenv:Envelope>

I have a Java mapping which creates the SOAP message and I am using the option in SOAP adapterThis is what the code is sending to SF:

Using the Enterprise WSDL, the Java code does 2 things:

1) Using the User and Password+token to go out to SF to get a session ID to send out during the next step.

2) Creates the request body structure generated from the Enterprise WSDL.

However when the program retrieves the body structure (from #2), it send out <urn:sObjects>. I want to send <urn:sObjects xsi:type="urn1:Account"> instead of <urn:sObjects>. How do I achieve that.

This is what SF is expecting:

<soapenv:Body>

<urn:create>

<urn:sObjects xsi:type ="urn1:Account">

<Name>Canon, Inc.</Name>

</urn:sObjects>

</urn:create>

</soapenv:Body>

Here is a sample of what SF is expecting:

http://wiki.developerforce.com/index.php/Enterprise_Create

Thx in advance

Ravijeet

Edited by: RAVIJEET.SAP.PI on Mar 8, 2011 1:43 AM

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Using the same java mapping, you can add

 xsi:type ="urn1:Account" 

to

 <urn:sObjects> 

Hope this helps,

Mark

Former Member
0 Kudos

Hi Mark,

In my java mapping I am doing this:

String prefix = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +

"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:enterprise.soap.sforce.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"+

"<soapenv:Header> "+

"<urn:SessionHeader>"+

"<urn:sessionId> ";

String suffix = "</urn:sessionId> </urn:SessionHeader> </soapenv:Header> <soapenv:Body>";

String envelope = "</soapenv:Body> </soapenv:Envelope>";

I fetch the payload from the TransformationOutput arg1 ->Newpayload of java mapping and combine with upper string data to form the complete SOAP message. Where can we add xsi:type ="urn1:Account" ? Do I just do a plain string.replaceAll but that is not working.

String outData = "";

outData = prefix + sessionId + suffix + Newpayload + envelope;

//8. The JAVA mapping output payload is returned using the TransformationOutput class

// arg1.getOutputPayload().getOutputStream()

arg1.getOutputPayload().getOutputStream().write(outData.getBytes());

Edited by: RAVIJEET.SAP.PI on Mar 8, 2011 5:22 PM

Edited by: RAVIJEET.SAP.PI on Mar 8, 2011 10:04 PM

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

I fetch the payload from the TransformationOutput arg1 ->Newpayload of java mapping and combine with upper string data to form the complete SOAP message. Where can we add xsi:type ="urn1:Account" ? Do I just do a plain string.replaceAll but that is not working.

You can do this step:

InputStream (InputStream inputStream = input.getInputPayload().getInputStream();) --> InputStreamReader --> BufferedReader

Use BufferedReader to convert the input into a string and then you can use the string.replaceAll

Hope this helps,

Mark

Answers (0)