Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
- From: "BlueDolphin" <BlueDolphin@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 8 Jun 2005 00:40:04 -0700
Hello Matt,
Below are the rules, hopefully you can give me some opinion as to how to get
the rules to run on different tables in the same database. At my wits end.
Thanks again for your help.
<?xml version="1.0" encoding="utf-8"?>
<brl xmlns="http://schemas.microsoft.com/businessruleslanguage/2002">
<ruleset name="EMRXServiceInterchangeEngineRulesPolicy">
<version major="1" minor="1" description=""
modifiedby="NCS-BLUEDOLPHIN\Administrator"
date="2005-05-31T08:34:58.6875000+08:00" />
<version major="1" minor="0" description=""
modifiedby="NCS-BLUEDOLPHIN\Administrator"
date="2005-05-31T08:35:09.4843750+08:00" />
<configuration>
<factretriever>
<assembly>EMRX.Orchestration.Utilities, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=429bc9e2a704eed1</assembly>
<class>EMRX.Orchestration.Utilities.ServiceFactsRetriever</class>
</factretriever>
</configuration>
<bindings>
<xmldocument ref="xml_1"
doctype="EMRX.Orchestration.ServiceInterchangeEngine.Schemas.EMRXInternalProcessingMessage" instances="16" selectivity="1" instance="0">
<selector>/*[local-name()='EMRXInternalProcessingMessage' and
namespace-uri()='http://EMRX.Orchestration.ServiceInterchangeEngine.Schemas.EMRXInternalProcessingMessage']</selector>
<schema>C:\Inetpub\wwwroot\EMRX_VERSION_2\EMRX_Orchestration\EMRX.Orchestration.ServiceInterchangeEngine.Schemas\EMRXInternalProcessingMessage.xsd</schema>
</xmldocument>
<datarow ref="db_0" server="(local)\EMRX" dataset="EMRX"
table="ServicesSubscription" instances="16" selectivity="1"
isdataconnection="true" instance="0" />
<datarow ref="db_2" server="(local)\EMRX" dataset="EMRX"
table="PublishedServicesList" instances="16" selectivity="1"
isdataconnection="true" instance="0" />
<datarow ref="db_4" server="(local)\EMRX" dataset="EMRX"
table="ServiceSubscribers" instances="16" selectivity="1"
isdataconnection="true" instance="0" />
<datarow ref="db_3" server="(local)\EMRX" dataset="EMRX"
table="ServiceProviders" instances="16" selectivity="1"
isdataconnection="true" instance="0" />
</bindings>
<rule name="AssignServiceRequesterPreferredXSLTRule" priority="0"
active="true">
<if>
<and>
<compare operator="equal">
<vocabularylink uri="3f0e9bcc-6212-4e6a-853c-e517f157a626"
element="05703dd9-1111-40b8-890d-ad7bfc45a925" />
<lhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="83bbcb9a-4196-47f5-9815-bc873c812a8b" />
<datarowmember datarowref="db_0"
column="ServiceSubscriberID" type="int" sideeffects="false" />
</function>
</lhs>
<rhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="1320d946-5a78-44f9-bd0a-c824a004df33" />
<xmldocumentmember xmldocumentref="xml_1" type="int"
sideeffects="false">
<field>*[local-name()='ServiceRequesterID' and
namespace-uri()='']</field>
<fieldalias>ServiceRequesterID</fieldalias>
</xmldocumentmember>
</function>
</rhs>
</compare>
<compare operator="equal">
<vocabularylink uri="3f0e9bcc-6212-4e6a-853c-e517f157a626"
element="05703dd9-1111-40b8-890d-ad7bfc45a925" />
<lhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="11db8cd0-7f33-41d0-92b9-a248b330d746" />
<datarowmember datarowref="db_0" column="ServiceID"
type="string" sideeffects="false" />
</function>
</lhs>
<rhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="8227a03a-00a5-46e9-8a8a-bb391dbb0e61" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="false">
<field>*[local-name()='ServiceID' and
namespace-uri()='']</field>
<fieldalias>ServiceID</fieldalias>
</xmldocumentmember>
</function>
</rhs>
</compare>
</and>
</if>
<then>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="319ed6a9-2a51-4c72-a058-fc38e8fec405" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceRequesterPreferredXSLT' and
namespace-uri()='']</field>
<fieldalias>ServiceRequesterPreferredXSLT</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="6dc7cf1e-89da-410c-9561-d29cab89c142" />
<datarowmember datarowref="db_0"
column="PreferredTranslationStyle***" type="string" sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
</then>
</rule>
<rule name="AssignRequestedServiceInformationRule" priority="0"
active="true">
<if>
<and>
<compare operator="equal">
<vocabularylink uri="3f0e9bcc-6212-4e6a-853c-e517f157a626"
element="05703dd9-1111-40b8-890d-ad7bfc45a925" />
<lhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="9d4559e3-3181-4691-b66c-0aaac9dc725b" />
<datarowmember datarowref="db_2" column="ServiceID"
type="string" sideeffects="false" />
</function>
</lhs>
<rhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="8227a03a-00a5-46e9-8a8a-bb391dbb0e61" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="false">
<field>*[local-name()='ServiceID' and
namespace-uri()='']</field>
<fieldalias>ServiceID</fieldalias>
</xmldocumentmember>
</function>
</rhs>
</compare>
<compare operator="equal">
<vocabularylink uri="3f0e9bcc-6212-4e6a-853c-e517f157a626"
element="05703dd9-1111-40b8-890d-ad7bfc45a925" />
<lhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="ec6264e0-6c5b-4973-8362-892d3856ae1e" />
<datarowmember datarowref="db_2" column="ServiceProviderID"
type="int" sideeffects="false" />
</function>
</lhs>
<rhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="97752e85-925a-46eb-be45-7f3a2d88154c" />
<xmldocumentmember xmldocumentref="xml_1" type="int"
sideeffects="false">
<field>*[local-name()='ServiceProviderID' and
namespace-uri()='']</field>
<fieldalias>ServiceProviderID</fieldalias>
</xmldocumentmember>
</function>
</rhs>
</compare>
<compare operator="equal">
<vocabularylink uri="3f0e9bcc-6212-4e6a-853c-e517f157a626"
element="05703dd9-1111-40b8-890d-ad7bfc45a925" />
<lhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="71d02399-5c3f-49b5-aade-5c918d4c38ad" />
<datarowmember datarowref="db_2" column="ServiceVersion"
type="string" sideeffects="false" />
</function>
</lhs>
<rhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="9a8d0702-16ab-4add-8f64-3ac4388e2e11" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="false">
<field>*[local-name()='ServiceVersion' and
namespace-uri()='']</field>
<fieldalias>ServiceVersion</fieldalias>
</xmldocumentmember>
</function>
</rhs>
</compare>
</and>
</if>
<then>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="3c5d52ee-5005-4bcf-882c-b7103240f882" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceName' and
namespace-uri()='']</field>
<fieldalias>ServiceName</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="bb4bcf1b-3ed7-46d1-aefb-eef5fa536609" />
<datarowmember datarowref="db_2" column="ServiceName"
type="string" sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="97de4311-59cb-4d17-9041-61e6cf8c8d09" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceType' and
namespace-uri()='']</field>
<fieldalias>ServiceType</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="06ccf19e-f154-4c5d-a24e-15186c63e0ab" />
<datarowmember datarowref="db_2" column="ServiceType"
type="string" sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="094fb6b5-fca0-4f93-a4f9-20cc8a29fd3e" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceURL' and namespace-uri()='']</field>
<fieldalias>ServiceURL</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="5e19ab6d-6f24-4636-9cd6-826a876d573b" />
<datarowmember datarowref="db_2" column="ServiceURL"
type="string" sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="c9b63400-e77e-4983-8b9d-d5422c2fb99d" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceProxyAssemblyName' and
namespace-uri()='']</field>
<fieldalias>ServiceProxyAssemblyName</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="b2d353f2-90c8-4bbf-9cd5-964aa6b93431" />
<datarowmember datarowref="db_2"
column="ServiceProxyAssemblyName" type="string" sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="3ea17af4-387e-4ed6-98d2-05a27de96481" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceProxyClassName' and
namespace-uri()='']</field>
<fieldalias>ServiceProxyClassName</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="d92f8efe-2105-4d2e-8633-2bfae88a09eb" />
<datarowmember datarowref="db_2"
column="ServiceProxyClassName" type="string" sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="5f6268db-023b-4a09-a2fb-955c918eb561" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceProxyMethodName' and
namespace-uri()='']</field>
<fieldalias>ServiceProxyMethodName</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="d495bd80-a5e1-46c1-8d89-ae2866e69ea5" />
<datarowmember datarowref="db_2"
column="ServiceProxyMethodName" type="string" sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="40935264-a523-45c1-84e5-7684e3a78eb6" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceProviderDefaultXSLT' and
namespace-uri()='']</field>
<fieldalias>ServiceProviderDefaultXSLT</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="d8034875-28e6-4b11-a098-fd1c3e9d7782" />
<datarowmember datarowref="db_2" column="ServiceXSLT"
type="string" sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
</then>
</rule>
<rule name="AssignServiceProviderNameRule" priority="0" active="true">
<if>
<compare operator="equal">
<vocabularylink uri="3f0e9bcc-6212-4e6a-853c-e517f157a626"
element="05703dd9-1111-40b8-890d-ad7bfc45a925" />
<lhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="8bed5e43-a8af-41e9-850e-42ae5277fb40" />
<datarowmember datarowref="db_3" column="ServiceProviderID"
type="int" sideeffects="false" />
</function>
</lhs>
<rhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="97752e85-925a-46eb-be45-7f3a2d88154c" />
<xmldocumentmember xmldocumentref="xml_1" type="int"
sideeffects="false">
<field>*[local-name()='ServiceProviderID' and
namespace-uri()='']</field>
<fieldalias>ServiceProviderID</fieldalias>
</xmldocumentmember>
</function>
</rhs>
</compare>
</if>
<then>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="1dada7da-70a8-4ccb-a20a-35afc082638f" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceProvider' and
namespace-uri()='']</field>
<fieldalias>ServiceProvider</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="3d0c4765-6a0f-48dd-94de-9245494ae778" />
<datarowmember datarowref="db_3" column="Code" type="string"
sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
</then>
</rule>
<rule name="AssignServiceRequesterNameRule" priority="0" active="true">
<if>
<compare operator="equal">
<vocabularylink uri="3f0e9bcc-6212-4e6a-853c-e517f157a626"
element="05703dd9-1111-40b8-890d-ad7bfc45a925" />
<lhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="0ddf8cd5-ee96-4ccc-b7d8-6b077d403531" />
<datarowmember datarowref="db_4" column="ServiceSubscriberID"
type="int" sideeffects="false" />
</function>
</lhs>
<rhs>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="1320d946-5a78-44f9-bd0a-c824a004df33" />
<xmldocumentmember xmldocumentref="xml_1" type="int"
sideeffects="false">
<field>*[local-name()='ServiceRequesterID' and
namespace-uri()='']</field>
<fieldalias>ServiceRequesterID</fieldalias>
</xmldocumentmember>
</function>
</rhs>
</compare>
</if>
<then>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="83126e95-62d6-4495-b92b-5603dee7823d" />
<xmldocumentmember xmldocumentref="xml_1" type="string"
sideeffects="true">
<field>*[local-name()='ServiceRequester' and
namespace-uri()='']</field>
<fieldalias>ServiceRequester</fieldalias>
<argument>
<function>
<vocabularylink uri="5330a2f0-3eaa-4859-a2e2-95e594a385c7"
element="ddd402a8-ac5f-4e73-aa47-e3843b1fef2e" />
<datarowmember datarowref="db_4" column="Code" type="string"
sideeffects="false" />
</function>
</argument>
</xmldocumentmember>
</function>
</then>
</rule>
</ruleset>
</brl>
"Matt Milner" wrote:
> I'm wondering what newXML is in this scenario? What does your rule or rules
> look like? Can you post those?
>
> Matt
>
>
> "BlueDolphin" <BlueDolphin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:430638D6-D27B-4D03-A1C4-611AE6DA9642@xxxxxxxxxxxxxxxx
> > Hello Matt,
> > I tried executing the assert statement twice so that my rules policy can
> > go
> > to different tables in the database to grab the data, but I encountered
> > the
> > error:
> >
> > Microsoft.RuleEngine.PolicyExecutionException: An exception occurred
> > inside
> > the rule engine instance executing policy
> > "EMRXServiceInterchangeEngineRulesPolicy". --->
> > Microsoft.RuleEngine.RuleEngineArgumentNullException: The value of
> > argument
> > "newXml" cannot be null.
> > at Microsoft.RuleEngine.Rete.Rete.ProcessException(Exception ex)
> > at Microsoft.RuleEngine.Rete.Rete.ExecuteInternal(Object facts, Object
> > data)
> > at Microsoft.RuleEngine.Rete.Rete.ProcessingLoop(Operation operation,
> > Object facts, Object data, EngineState nextState)
> > at Microsoft.RuleEngine.Rete.Rete.Execute(Object facts)
> > at Microsoft.RuleEngine.Policy.ExecuteInternal(Object facts)
> > --- End of inner exception stack trace ---
> > at Microsoft.RuleEngine.Policy.ExecuteInternal(Object facts)
> > at Microsoft.RuleEngine.Policy.Execute(Object facts)
> > at Microsoft.RuleEngine.Policy.Execute(Object[] facts)
> > at
> > EMRX.Orchestration.ServiceInterchangeEngine.EMRXServiceInterchangeOrchestration.segment3(StopConditions
> > stopOn)
> > at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
> > StopConditions stopCond, Exception& exp)
> > Microsoft.RuleEngine.PolicyExecutionException
> >
> > Below is the updatefact method that I try to simulate what you've
> > mentioned.
> >
> > public object UpdateFacts (RuleSetInfo ruleSetInfo, RuleEngine engine,
> > object factsHndlIn)
> > {
> > object factsHndlOut = null;
> > // The following logic asserts the required DB rows only once.
> > // The initial values (cached during the first retrieval) are returned in
> > subsequent execution cycles
> > if (factsHndlIn == null)
> > {
> > SqlConnection con1;
> > DataConnection dc1, dc2;
> >
> > con1 = new SqlConnection( "Data Source=(local);Initial
> > Catalog=EMRX;UID=sa;Pwd=pass@word1;");
> > dc1 = new DataConnection( "EMRX", "PublishedServicesList", con1);
> > engine.Assert( dc1);
> > dc2 = new DataConnection( "EMRX", "ServicesSubscription", con1);
> > engine.Assert( dc2);
> > factsHndlOut = dc2;
> > }
> > else
> > {
> > factsHndlOut = factsHndlIn;
> > }
> > return factsHndlOut;
> > }
> >
> > But if I remove away the two lines
> > dc2 = new DataConnection( "EMRX", "ServicesSubscription", con1);
> > engine.Assert( dc2);
> > the policy would runs properly.
> >
> > Appreciate if you could enlighten me on the missing link.
> > I'm new to BizTalk, any help is greatly appreciated.
> > Thanks.
> >
> > Regards,
> > Desmond
> >
> >
> >
> > "Matt Milner" wrote:
> >
> >> Simply create and assert more than one dataconnection. If you are using
> >> the
> >> same database, you can reuse the SqlConnection like so:
> >>
> >> DataConnection dc1 =
> >> > new DataConnection("foo", "fum", con1);
> >> > Dataconnection dc2 = new DataConnection("bar", "bum", con1);
> >> > engine.Assert(dc1);
> >> engine.Assert(dc2);
> >>
> >> It is not the return value that gets entered intot the engine for
> >> execution,
> >> the factsHandleOut is your handle to know whether to refresh the facts.
> >> This
> >> is a little confusing, I know and it is a shame that most samples show
> >> the
> >> connection being handed back.
> >>
> >> You can also create another sql connection, wrap it with the second data
> >> connection and assert that. Similarly, if you are asserting
> >> datatable/datarow facts, you can use the sql connection to retrieve those
> >> and assert them.
> >>
> >> Matt
> >>
> >>
> >>
> >> "BA" <biztalk.architect@xxxxxxxxx> wrote in message
> >> news:1116329399.521056.291710@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >> > Hello,
> >> >
> >> > In the code below you set a single data connection for a single DB
> >> > table.
> >> >
> >> > I have many data connections to add, how do you extend this sample to
> >> > add more than 1 data connection?
> >> > public class DbFactRetriever : IFactRetriever
> >> > {
> >> >
> >> > public object UpdateFacts(RuleSetInfo rulesetInfo,
> >> > Microsoft.RuleEngine.RuleEngine engine,
> >> > object factsHandleIn)
> >> >
> >> > {
> >> > object factsHandleOut;
> >> >
> >> > SqlConnection con1 = new
> >> > SqlConnection("Initial Catalog=foo;
> >> > Data Source=(local);Integrated Security=SSPI;");
> >> >
> >> > DataConnection dc1 =
> >> > new DataConnection("foo", "fum", con1);
> >> >
> >> > engine.Assert(dc1);
> >> > factsHandleOut = dc1;
> >> > }
> >> > return factsHandleOut;
> >> > }
> >> >
> >> >
> >> > I'm still learning C# so any help would be greatly appreciated.
> >> >
> >> > Thanks!
> >> >
> >> > BA
> >> >
> >>
> >>
> >>
>
>
>
.
- Follow-Ups:
- Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
- From: Matt Milner
- Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
- References:
- Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
- From: Matt Milner
- Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
- Prev by Date: Re: The file receive adapter deleted the empty file ...
- Next by Date: Re: The file receive adapter deleted the empty file ...
- Previous by thread: Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
- Next by thread: Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
- Index(es):