Calling a WCF Service and a BizTalk 2006 R2 orchestration

  • 7 July 2008
  • 1 reply
  • 2 views

Badge +1

Hi


Is it possible to call either a BizTalk 2006 R2 orchestration or a WCF service from a K2 blackpearl process


Has anyone succeded in achieving something like this from a K2 blackpearl process directly or through a workaround


Any inputs on the same will be appreciated.


 


Thanks


Sujith 


 


1 reply

Badge +2

Hello,


 


Regarding WCF you have several way of comsuming a WCF endPoint :


- you cann use the WCF Dynamic Service Object (availabe in "BlackMarket") create a smartObject around your service and the  you will need to use a SmartObject event to call a method of your WCF service.


- you can reference a webservice using the "K2 BlackPearl" project reference and then you will need to add a web reference.


Then you will need to add a Default Server event (code)  event write a code like that  :


 


using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using SourceCode.KO;
using SourceCode.Workflow.Common.Extenders;
using hostContext = Project_9b5322cb20ed4ef3917a09e45754aaa0.EventItemContext_3956275486254886ab04cf052939054d;
namespace ExtenderProject_9b5322cb20ed4ef3917a09e45754aaa0
{
    public partial class EventItem_3956275486254886ab04cf052939054d : ICodeExtender<hostContext>
 {
        public void Main(Project_9b5322cb20ed4ef3917a09e45754aaa0.EventItemContext_3956275486254886ab04cf052939054d K2)
        {
            localhost.Service1 client = new localhost.Service1();
            decimal newamount =  67;
            bool returnval,resultspcified = false;


            client.changeBudgetBillingPlanPartialAmount(newamount,true,out returnval,out resultspcified);


        }
    }
}


- you can directly use a Default Server event (code) event and add the code to call your service there :


using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.ServiceModel;


using SourceCode.KO;



using SourceCode.Workflow.Common.Extenders;
using hostContext = Project_9b5322cb20ed4ef3917a09e45754aaa0.EventItemContext_c9d8d8382c3d4fe180d537cbdd899381;
namespace ExtenderProject_9b5322cb20ed4ef3917a09e45754aaa0
{
    [ServiceContract(Namespace = "http://localhost:8000/HelloIndigo")]
    public interface IHelloIndigoService
    {
        [OperationContract]
        string HelloIndigo();


        [OperationContract]
        int getCreditWorthiness(string customernumber);
    }


    class ServiceProxy
    {
    }


    public partial class EventItem_c9d8d8382c3d4fe180d537cbdd899381 : ICodeExtender<hostContext>
 {
        public void Main(Project_9b5322cb20ed4ef3917a09e45754aaa0.EventItemContext_c9d8d8382c3d4fe180d537cbdd899381 K2)
        {



            EndpointAddress ep = new EndpointAddress("http://localhost:8000/HelloIndigo/HelloindigoService");
            IHelloIndigoService proxy = ChannelFactory<IHelloIndigoService>.CreateChannel(new BasicHttpBinding(), ep);


            int intCreditWorthines = proxy.getCreditWorthiness("jds");
            K2.ProcessInstance.DataFields["CreditWorthiness"].Value = intCreditWorthines;
        }
    }
}


adrien


 

Reply