Biztalk CRM 4.0 Adapter : How to Fetch french info ? ?
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><fetch mapping="logical"><entity name="contact"><all-attributes/><filter type="and"><condition attribute="contactid" operator="eq" value="34D9E386-FA65-DB11-9166-00137258DC61"/></filter></entity></fetch></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><prefix:ExecuteFetchResponse xmlns
refix="http://calidcvwdv725/schemas.microsoft.com/crm/2007/OG1/ExecuteFetchResponse"><FetchXmlResult>&lt;resultset morerecords="0" paging-cookie="&amp;lt;cookie page=&amp;quot;1&amp;quot;&amp;gt;&amp;lt;contactid last=&amp;quot;{34D9E386-FA65-DB11-9166-00137258DC61}&amp;quot; first=&amp;quot;{34D9E386-FA65-DB11-9166-00137258DC61}&amp;quot; /&amp;gt;&amp;lt;/cookie&amp;gt;"&gt;&lt;result&gt;&lt;participatesinworkflow name="No"&gt;0&lt;/participatesinworkflow&gt;&lt;donotsendmm name="Yes"&gt;0&lt;/donotsendmm&gt;&lt;new_contactcommunicationrules name="Contact Permitted" ...........................................
&lt;/address2_addressid&gt;&lt;middlename&gt;a&lt;/middlename&gt;&lt;owningbusinessunit&gt;{DB79D48C-D87D-DD11-BBDF-005056A464E9}&lt;/owningbusinessunit&gt;&lt;/result&gt;&lt;/resultset&gt;</FetchXmlResult></prefix:ExecuteFetchResponse></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
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
- 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(
"<", "<");
XmlString = XmlString.Replace(
">", ">");
XmlString = XmlString.Replace(
""", "\"");
XmlString = XmlString.Replace(
"'", "\'");
XmlString = XmlString.Replace(
"&", "&");
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;
}
}
}
- 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

