Fetch lookup Data from MS CRM 4.0

Home Page Forums BizTalk 2004 – BizTalk 2010 Fetch lookup Data from MS CRM 4.0

Viewing 3 reply threads
  • Author
    Posts
    • #21637

      HI,

      i want to fetch data from CRM 4.0 using BTS 2006 adapter for MS CRM 4.0

      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

    • #21647

      See: http://www.ascentium.com/blog/crm/post398.aspx

      CRM Response Namespace

      A core feature of the new adapter and of CRM 4.0 is supporting multiple organizations. While this is a really cool feature, we have found an issue with the new adapter that make truly supporting multiple organizations in BizTalk very challenging. The CRM response XSD, a generic XSD containing the success or failure message sent from CRM on each call, has an organization specific namespace. For example, in Ascentium’s development environment (organization is AscentiumCrmDev) has a CRM response XSD namespace of http://schemas.microsoft.com/crm/2007/BizTalkAdapter/AscentiumCRMDev
      /Response
      . The problem with this is that if the organization name changes from what the BizTalk solution was developed on, the response message will fail because of the differences in expected namespace.

      Here are a couple of possible solutions that we considered:

      •  
        • Creating a custom receive pipeline to change the namespace.
        • Create multiple inbound schema and maps for known organizations and map your ports to the appropriate maps.
        • Ignore the response message from CRM.

      There are many more possible solutions including keeping the organization names the same between all environments, but this defeats the purpose of supporting multiple organizations. For our solution, we implemented a custom receive pipeline to update the namespace as the message comes back from CRM. This is not a simple solution and requires a decent amount of coding, but it serves the long term need for our project.

    • #22134

      I have jsut finished working out an issue with the Responce.xsd.
      I needed the response GUID ID after creating an Activity. I created a Helper class to parse the string XML into XML. I then
      used the Email_CreateResponce Schema to format to a message.
      I modified the code to fit what i needed. by doing this wi can do Seardches and Fetch using the adapter.
      Thanks to Chris Romp for is project I was able to do the following.

      In Expresion message construct

      Create a verable string in the Orch and fill it.

      strResponseXML = xpath(crmActivityResponce, “string(/*[local-name()=’Response’ and namespace-uri()=’http://schemas.microsoft.com/crm/BizTalkAdapter/Response’%5D/*%5Blocal-name()=’Body’ and namespace-uri()=”]/*[local-name()=’Message’and namespace-uri()=”]/text())”);

      crmActivityEmailCreateResponce = CBN.BizTalk.HelperClasses.XMLString.GetMessageFromXmlString(strResponseXML);

      Created a Class with the following.

      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(“&”, “&”);

      return XmlString;
      }

      private static string InsertNamespaceString(string XmlString, string Namespace)
      {
      return InsertNamespaceString(XmlString, Namespace, String.Empty);
      }
      }

    • #22387

      the target name sapce for response is fixed and cannot be changed as BTS CRM adaptor always returns the orginal targetnamespace and not the one you have provided.

      The adaptor was orginally designed for CRM3.0 and with minor tweaks can be used with CRM4.0. Response namespace cannot be changed USE the default namespace.

Viewing 3 reply threads
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.