cancel
Showing results for 
Search instead for 
Did you mean: 

Adding "xsi:type" attribute in the xml payload

former_member207892
Participant
0 Kudos

Hi Experts,

The integration scenario is SAP to Salesforce integration.

I am able to establish the connection to Salesforce and query interface in woking fine.

Now when I was trying to create an Account in the Salesforce, the <ns0:sObjects> is to be changed to  <ns0:sObjects xsi:type="Account" xmlns="urn:enterprise.soap.sforce.com">

I have followed following sdn links and could develop Java mapping to establish connection with Salesforce.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/802f8d03-9282-2d10-52b4-f9446e077...

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50a76cfa-4966-2d10-aba7-da496d9b5...

Also I have followed the link http://scn.sap.com/message/13158048 to add the string replacement

Newpayload.replace("<ns0:sObjects>", "<ns0:sObjects xsi:type=\"Account\" xmlns=\'urn:enterprise.soap.sforce.com>");  //new code line to be added

But this also did not helped me to resolve the issue.

Anyone tried this similar interface or any tips will be much appreciated...

I also tried to create an XSLT map after the java map to add the attribute but of no use.

The error from the response message from Salesforce is

<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>

Please help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi.

Could you provide your xsl mapping or JavaMapping.?

I guees the problem is with the Output data.

former_member207892
Participant
0 Kudos

Thanks for the reply..

I could find out the solution.

I have tweaked the java mapping program.

As per the doc: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/802f8d03-9282-2d10-52b4-f9446e077...

I have added the necessary namespace in the java code to create SOAP envelope and

in addition to the code mentioned in the link

http://wiki.sdn.sap.com/wiki/display/XI/SFDC+Integration+using+PI+7.1+-+How+to+add+SOAP+Envelope+in+...

I have added below mentioned code:

--------------------------------------------------------

try

{

.

.

Newpaload = c.substring(len+1);//existing code.

/*New code to be added */

String Newpayload1 = "";

Newpayload1 = Newpayload.replaceAll("<ns0:sObjects>", "<ns0:sObjects xsi:type=\"Account\" xmlns=\"urn:enterprise.soap.sforce.com\">");

/*Remaining code same */

.

.

-------------------------------------------------------

Its working fine and I am able to get the response back from Salesforce.

If the response need to be mapped, you may have to add an XSLT mapping to remove soap envelope and extract only the soap body coming from salesforce and then map the output to any required graphical mapping to store the response Id or data  from Salesforce.

XSLT code for anyone who is trying:

---------------------------------------------------------------

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

<xsl:stylesheet version="1.0" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:output indent="yes"/>

   <xsl:template match="@* | node()">

      <xsl:copy>

         <xsl:apply-templates select="@* | node()"/>

      </xsl:copy>

   </xsl:template>

   <xsl:template match="soapenv:*">

      <xsl:apply-templates select="@* | node()"/>

   </xsl:template>

</xsl:stylesheet>

------------------------------------------------------------------------

Praveen.

Answers (0)