none
BizTalk Bre In VB webservice RRS feed

  • Question

  • Hi,

    I have a requirement where I have to use BRE in a business logic web service. The web service is in VB .net. So :

    1. how do i implement these rules in WS? I want to use it sub, so is it possible?

    2. In c# it is as below, so how do i use it in vb?.

    public static void RuleFunc(string policyName, TypedXmlDocument txd)
            {
                Policy policy = new Policy(policyName);
                object[] facts = new object[2];
                facts[0] = txd;
                facts[1] = new Policy("PolicyName");           
                policy.Execute(facts);
                policy.Dispose();
            }

    Appreciate your help.

    Wednesday, March 25, 2015 3:19 PM

Answers

  • There's lots of tutorials on VB.Net at MSDN and other places.  Bing knows all of them.

    The difference really isn't that big

            Dim xd As New System.Xml.XmlDocument
            xd.LoadXml("<root>")
    
            Dim anotherXd As System.Xml.XmlDocument
            anotherXd = xd
    Yes, I did have to look that up :)

    • Marked as answer by Angie Xu Thursday, April 2, 2015 5:19 AM
    Wednesday, March 25, 2015 6:18 PM
    Moderator

All replies

  • Keep in mind, you still need a valid BizTalk Server License on the Web Service host computer.

    1. The Policy and Rules are developed exactly the same as they would be for use in a BizTalk App.  The BRE does not know or care who or what is Executing the Policy.

    2. Since it's .Net, the BRE API is equally accessible from C# and VB.Net.  You just have to write the same code in VB syntax.  There's nothing at all special about that.  About the only different in that sample would be the variable declarations.

    Wednesday, March 25, 2015 3:36 PM
    Moderator
  • Thanks for the reply John.

    I've already created the business rules. All i need to do is call it in web service.

    I am not sure how to assign objects in vb. so thought if any one would help me with vb.net code.

    Thanks,

    vinay

    Wednesday, March 25, 2015 4:12 PM
  • There's lots of tutorials on VB.Net at MSDN and other places.  Bing knows all of them.

    The difference really isn't that big

            Dim xd As New System.Xml.XmlDocument
            xd.LoadXml("<root>")
    
            Dim anotherXd As System.Xml.XmlDocument
            anotherXd = xd
    Yes, I did have to look that up :)

    • Marked as answer by Angie Xu Thursday, April 2, 2015 5:19 AM
    Wednesday, March 25, 2015 6:18 PM
    Moderator
  • Public Shared Sub RuleFunc(policyName As String, txd As TypedXmlDocument)
    	Dim policy As New Policy(policyName)
    	Dim facts As Object() = New Object(1) {}
    	facts(0) = txd
    	facts(1) = New Policy("PolicyName")
    	policy.Execute(facts)
    	policy.Dispose()
    End Sub

    Here is the code you can use it as is.

    Also, use the below website for conversion from C# to VB.Net

    Code Converter


    Thanks,
    Prashant
    ----------------------------------------
    Please mark this post accordingly if it answers your query or is helpful.

    Thursday, March 26, 2015 6:01 AM