none
Biztalk CRM 4.0 Adapter : How to Fetch french info ? ? RRS feed

  • Question

  • Hi,  I have one orchestration using crm request and response port, send ExecuteFetch_ExecuteFetchRequest and get ExecuteFetch_ExecuteFetchResponse to fetch crm contact entity. It works fine when contact has no french characters.

     
    The request like

    <ns0:ExecuteFetchRequest crm_action="execute" xmlns:ns0="http://Test/ExecuteFetchRequest">
      <FetchXml>&lt;fetch mapping="logical"&gt;&lt;entity name="contact"&gt;&lt;all-attributes/&gt;&lt;filter type="and"&gt;&lt;condition attribute="contactid" operator="eq" value="34D9E386-FA65-DB11-9166-00137258DC61"/&gt;&lt;/filter&gt;&lt;/entity&gt;&lt;/fetch&gt;</FetchXml>
    </ns0:ExecuteFetchRequest>

    The response like


    <ns0:Response  xmlns:ns0='http://schemas.microsoft.com/crm/2007/BizTalkAdapter/Response'><Header><ReturnCode>1</ReturnCode><ErrorCode></ErrorCode><ErrorString></ErrorString><Retryable></Retryable></Header><Body><Message>&lt;prefix:ExecuteFetchResponse xmlnsStick out tonguerefix="http://calidcvwdv725/schemas.microsoft.com/crm/2007/OG1/ExecuteFetchResponse"&gt;&lt;FetchXmlResult&gt;&amp;lt;resultset morerecords="0" paging-cookie="&amp;amp;lt;cookie page=&amp;amp;quot;1&amp;amp;quot;&amp;amp;gt;&amp;amp;lt;contactid last=&amp;amp;quot;{34D9E386-FA65-DB11-9166-00137258DC61}&amp;amp;quot; first=&amp;amp;quot;{34D9E386-FA65-DB11-9166-00137258DC61}&amp;amp;quot; /&amp;amp;gt;&amp;amp;lt;/cookie&amp;amp;gt;"&amp;gt;&amp;lt;result&amp;gt;&amp;lt;participatesinworkflow name="No"&amp;gt;0&amp;lt;/participatesinworkflow&amp;gt;&amp;lt;donotsendmm name="Yes"&amp;gt;0&amp;lt;/donotsendmm&amp;gt;&amp;lt;new_contactcommunicationrules name="Contact Permitted" ...........................................
    &amp;lt;/address2_addressid&amp;gt;&amp;lt;middlename&amp;gt;a&amp;lt;/middlename&amp;gt;&amp;lt;owningbusinessunit&amp;gt;{DB79D48C-D87D-DD11-BBDF-005056A464E9}&amp;lt;/owningbusinessunit&amp;gt;&amp;lt;/result&amp;gt;&amp;lt;/resultset&amp;gt;&lt;/FetchXmlResult&gt;&lt;/prefix:ExecuteFetchResponse&gt;</Message></Body></ns0:Response>

     

    But when output contact field contatin french characters (such as  é ), I received error message like

    There was a failure executing the response(receive) pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "Pipeline " Send Port: "TestCRMPort1" URI: "http://calidcvwdv725" Reason: An error occurred when parsing the incoming document: "Invalid character in the given encoding. Line 1, position 1065."

     

    How to solve this issue?

     

    Thank you

     

    Mark Cong

    Monday, November 3, 2008 3:25 PM

All replies

  • HI Mark,

    i also want to fetch data from CRM 4.0 using BTS 2006 adapter for MS CRM 4.0 Have you got any solution?

    For this i am using FetchXmlToQueryExpression crm action.
    I am using FetchXmlToQueryExpression_FetchXmlToQueryExpressionRequest.xsd to send fetchXML request by setting attribute as:
    crm_action : "execute"
    FetchXML: FetchXML query as an output of Scripting Functoid.

    And using response.xsd coming with BTS 2006 adapter for MS CRM 4.0 to receive response from MS CRM
    i set the target namespace for reponse.xsd as: targetNamespace="http://schemas.microsoft.com/crm/2007/BizTalkAdapter/MicrosoftCRM/Response" according to the organization name here orgName: "MicrosoftCRM"

    Now i am getting an error:

    Exception thrown from: segment -1, progress -1
    Inner exception: Received unexpected message type '' does not match expected type 'http://schemas.microsoft.com/crm/2007/BizTalkAdapter/MicrosoftCRM/Response#Response'

    Exception type: UnexpectedMessageTypeException
    Source: Microsoft.XLANGs.Engine
    Target Site: Void VerifyMessage(Microsoft.XLANGs.Core.Envelope, System.String, Microsoft.XLANGs.Core.Context, Microsoft.XLANGs.Core.OperationInfo)

    Thanks,

    Kuldip
    Wednesday, February 4, 2009 10:33 AM
  • To achive this I found an String to XML parser.
    I created a Helper class with the following code. Assded a sting variable and then used a Msg Assignment to the FechXML Shcema.

    using

     

    System;

    using

     

    System.Collections.Generic;

    using

     

    System.Text;

    using

     

    System.Xml;

    namespace

     

    CBN.BizTalk.HelperClasses

    {

     

    public class XMLString

    {

     

    public static XmlDocument GetMessageFromXmlString(string XmlString)

    {

     

    XmlDocument doc = new XmlDocument();

    XmlString = DecodeXmlString(XmlString);

     

    //XmlString = InsertNamespaceString(XmlString, Namespace);

    doc.LoadXml(XmlString);

     

    return doc;

    }

     

    private static string DecodeXmlString(string XmlString)

    {

    XmlString = XmlString.Replace(

    "&lt;", "<");

    XmlString = XmlString.Replace(

    "&gt;", ">");

    XmlString = XmlString.Replace(

    "&quot;", "\"");

    XmlString = XmlString.Replace(

    "&apos;", "\'");

    XmlString = XmlString.Replace(

    "&amp;", "&");

     

    return XmlString;

    }

     

    private static string InsertNamespaceString(string XmlString, string Namespace)

    {

     

    return InsertNamespaceString(XmlString, Namespace, String.Empty);

    }

     

    private static string InsertNamespaceString(string XmlString, string Namespace, string NSPrefix)

    {

     

    int iLoc = XmlString.IndexOf(">");

     

    string strNamespace = String.Empty;

     

    if (NSPrefix.Trim() == String.Empty)

    strNamespace =

    String.Format(" xmlns=\"{0}\"", Namespace);

     

    else

    strNamespace =

    String.Format(" xmlns:{0}=\"{1}\"", NSPrefix, Namespace);

    XmlString = XmlString.Insert(iLoc, strNamespace);

     

    return XmlString;

    }

    }

    }

    Tuesday, October 6, 2009 12:51 PM
  • Hi,

    Check this post: https://blogs.msdn.com/brajens/archive/2007/05/27/using-microsoft-biztalk-dynamics-crm-adapter-part-1.aspx and http://www.codeproject.com/KB/biztalk/MSCRMAdapterBizTalk.aspx?display=Print
    Sandro Pereira - http://sandroasp.spaces.live.com/blog/ http://www.devscope.net/WhatWeDo/Integration/tabid/107/Default.aspx
    Tuesday, November 3, 2009 2:12 AM
  • Hi you can use :like this

    where MSGCRMResponse is the message follow in orch of fetch response

    xmlDOCTemp=MSGCRMResponse;

    xmlNodeListReturnCode = xmlDOCTemp.SelectNodes("//*[local-name()='ReturnCode']");

    xmlNodeReturnCode= xmlNodeListReturnCode.Item(0);

    strReturnCodeTemp=xmlNodeReturnCode.InnerText.ToString();

    System.Diagnostics.EventLog.WriteEntry("End ReturnCode:",strReturnCodeTemp.ToString());

    Tuesday, January 26, 2010 8:27 AM
  • //xmlDOC=new System.Xml.XmlDocument();

    //xmlDOC.LoadXml(MSGCRMResponse.Body.Message);

    //System.Diagnostics.EventLog.WriteEntry("Fetch body",xmlDOC.OuterXml.ToString());

    you ca also try this

    Tuesday, January 26, 2010 8:29 AM
  • //xmlDOC=new System.Xml.XmlDocument();

    //xmlDOC.LoadXml(MSGCRMResponse.Body.Message);

    //System.Diagnostics.EventLog.WriteEntry("Fetch body",xmlDOC.OuterXml.ToString());

    you ca also try this


    Tuesday, January 26, 2010 8:29 AM