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
{
rServiceContract(Namespace = "http://localhost:8000/HelloIndigo")]
public interface IHelloIndigoService
{
dOperationContract]
string HelloIndigo();
bOperationContract]
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.DataFieldst"CreditWorthiness"].Value = intCreditWorthines;
}
}
}
adrien