none
BizTalk Microsoft Dynamics CRM 4.0 Adapter - How to extract data from response xml RRS feed

  • Question

  • Hello,

    I am using BizTalk Microsoft Dynamics CRM 4.0 Adapter in Biztalk 2009 to process some data. I fetch data from CRM 4.0 with a request message:

    <ns0:ExecuteFetchRequest crm_action="execute"
    xmlns:ns0=""http://localhost/schemas.microsoft.com/crm/2007/Company/ExecuteFetchRequest"">
    <FetchXml>&lt;fetch mapping=""logical""&gt;&lt;entity name=""account""&gt;&lt;attribute name=""accountid""/&gt;&lt;attribute name=""name""/&gt;&lt;/entity&gt;&lt;/fetch&gt;</FetchXml>
    </ns0:ExecuteFetchRequest>

    When the process starts I receive as a result a response message:

    <ns0:Response xmlns:ns0="http://schemas.microsoft.com/crm/2007/BizTalkAdapter/Company/Response">
    <Header>
      <ReturnCode>1</ReturnCode>
      <ErrorCode />
      <ErrorString />
      <Retryable />
      </Header>
    <Body>
      <Message><prefix:ExecuteFetchResponse xmlns:prefix="http://localhost/schemas.microsoft.com/crm/2007/Company/ExecuteFetchResponse"><FetchXmlResult>&lt;resultset morerecords="0" paging-cookie="&amp;lt;cookie page=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;accountid last=&amp;quot;{B9DF17A0-0631-DF11-88D0-00155D073333}&amp;quot; first=&amp;quot;{349D11AA-0031-DF11-88D0-00155D073333}&amp;quot; /&amp;gt;&amp;lt;/cookie&amp;gt;"&gt;&lt;result&gt;&lt;accountid&gt;{349D11AA-0031-DF11-88D0-00155D073333}&lt;/accountid&gt;&lt;name&gt;Test1&lt;/name&gt;&lt;/result&gt;&lt;result&gt;&lt;accountid&gt;{B9DF17A0-0631-DF11-88D0-00155D073333}&lt;/accountid&gt;&lt;name&gt;Test2&lt;/name&gt;&lt;/result&gt;&lt;/resultset&gt;</FetchXmlResult></prefix:ExecuteFetchResponse></Message>
      </Body>
      </ns0:Response>

    And now I am stuck. I want this data in more user friendly format. I have a schema in biztalk. Here is a part ot the schema:

    <xs:element minOccurs="0" maxOccurs="unbounded" name="AccountBase">
    <xs:complexType>
    <xs:attribute name="AccountID" type="xs:string" />
    <xs:attribute name="Name" type="xs:string" />
    </xs:complexType>
    </xs:element>

    How can I extract the elements from the response message to the user friendly one or how can I do the mapping?

    Thanks in advance,
    Sonya

    Wednesday, March 17, 2010 1:58 PM

Answers

All replies