cancel
Showing results for 
Search instead for 
Did you mean: 

Generating XSD from XML for WS call Salesforce update operation

Former Member
0 Kudos

Hi experts,

I need your help with this XML ---> XSD generation to use it in my integration flow :

I tested the xml above with SOAP UI and it's working fine, now I need to create an XSD structure and pass the same values in the mapping in my integration flow,

(This is code in case you want to copy it for your reply...)

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

 

  <soapenv:Body>

     <urn:update>

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

           <urn1:Id>001b0000006mKKqAAM</urn1:Id>

           <!--You may enter ANY elements at this point-->

           <AnnualRevenue>9988</AnnualRevenue>

           <Name>Farell Instruments WYNSYS</Name>

        </urn:sObjects>

     </urn:update>

  </soapenv:Body>

</soapenv:Envelope>

I created this XSD format :


(This is code in case you want to copy it for your reply...)


<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:enterprise.soap.sforce.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="update">

    <xs:complexType>

      <xs:sequence>

        <xs:element name="sObjects">

          <xs:complexType>

            <xs:sequence>

              <xs:element type="xs:string" name="Id"/>

              <xs:element type="xs:string" name="Name"/>

            </xs:sequence>

            <xs:attribute type="xs:string" name="type"/>

          </xs:complexType>

        </xs:element>

      </xs:sequence>

    </xs:complexType>

  </xs:element>

</xs:schema>

At this point everything seems alright, but after the deploy I get an error because the type is invalid, so I went back to SOAP UI and deleted the attribute :          <urn:sObjects xsi:type="urn1:Account"> and kept only          <urn:sObjects>, and I got the same error from HCI !

My requirement now is to pass an attribute with the type Account just like this :          <urn:sObjects xsi:type="urn1:Account"> but using XSD, I am total lost I tried several formats but still dont get the right one.

Any idea please ?

Thanks.

BR,

Mohamed Amine.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Mohammed,

Add XSLT mapping to add the xsi:type after message mapping. check this discussion

Regards,

Praveen.

Answers (3)

Answers (3)

Former Member
0 Kudos

Thank you all for your replies.

I proceeded with WSLT Mapping to force adding xsi:type="Account" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" to the sObjects element.

Thank you very mych.

BR,

Mohamed Amine.

bhavesh_kantilal
Active Contributor
0 Kudos

Hello Mohammed Amine,

Can you enable trace in your integration flow and then share the output before your request/reply step where the call to SFDC is being done. This will help understand what is the attribute causing the issue.

Regards

Bhavesh

suchitatomar
Participant
0 Kudos

Try this and let us know the results

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

   <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

         <xs:element name="soapenv:Envelope">

               <xs:complexType>

                     <xs:sequence>

                           <xs:element name="soapenv:Body">

                                 <xs:complexType>

                                       <xs:sequence>

                                             <xs:element name="urn:update">

                                                   <xs:complexType>

                                                         <xs:sequence>

                                                               <xs:element name="urn:sObjects">

                                                                     <xs:complexType>

                                                                           <xs:sequence>

                                                                                 <xs:element name="urn1:Id" type="xs:string"></xs:element>

                                                                                 <xs:element name="AnnualRevenue" type="xs:int"></xs:element>

                                                                                 <xs:element name="Name" type="xs:string"></xs:element>

                                                                           </xs:sequence>

                                                                           <xs:attribute name="xsi:type" type="xs:string"></xs:attribute>

                                                                     </xs:complexType>

                                                               </xs:element>

                                                         </xs:sequence>

                                                   </xs:complexType>

                                             </xs:element>

                                       </xs:sequence>

                                 </xs:complexType>

                           </xs:element>

                     </xs:sequence>

                     <xs:attribute name="xmlns:soapenv" type="xs:string"></xs:attribute>

                     <xs:attribute name="xmlns:urn" type="xs:string"></xs:attribute>

                     <xs:attribute name="xmlns:urn1" type="xs:string"></xs:attribute>

                     <xs:attribute name="xmlns:xsi" type="xs:string"></xs:attribute>

               </xs:complexType>

         </xs:element>

   </xs:schema>

Former Member
0 Kudos

Thanks for your reply, I got this