small problem

Hi,

While exposing a Workflow via Web Service, in the new Web Service Code file, we used to inherit the WorkflowExample.Workflow1_WebService instead of directly  from the WebService base class as shown below.

public class Service : WorkflowExample.Workflow1_WebService

{

}

can any one say like "If I want to use two workflows into this Web Service How I have to inherit the Namespaces."

In the workflow I am using WebServiceReceive and WebServiceResponse Activities.



Answer this question

small problem

  • Rick M

    You'll need to serialize the cookie and use it from the web page.
  • Scott Goldenberg

    Bangaram,

    Could you clarify your issue   If you are trying to inherit from multiple Workflow WebServices in your Service, this isn't possible because multiple inheritance isn't allowed.  If you're trying to use multiple web service workflows in a single project, this should work without problems - do let me know and hopefully we can resolve your issue!

    Thanks,
    Arjun

  • webdevsam

    not sure if I get it, should I convert my sequential workflow to event driven When I open event view of the workflow WebServiceReceive can not be dropped anywhere. Can you provide more details

  • Israel Hilerio

    Arjun,
    this is very helpful. I've posed this question to various threads on this forum and got tossed in direction of InvokeActivity/EventSink, WebReceive/WebRespond but could never get to the point of retrieving specific workflow instance from the host. It would help the community if MSFT would comment on these issues. I've got the WWF book but there's no mention or examples of how to handle this. Also, I don't see how most of workflows would exist without WebService interface and lack of such example makes 'discovery' process frustrating..


    I've build small sample to deal with this and it seems that it's not working. Do you think this is happening because I'm running on VS2005 Prof Beta 2 with virutal web server I'm not sure if VS build in web server can maintain session.

    p.S1() and p1.S2() run in the same excution work, when fired separately don't, get error indicating that host did not get workflow through setting of the CookieContainer


    Here's sample of what I'm running


    class Program

    {

    static void Main(string[] args)

    {

    Program p = new Program();

    //p.S1();

    p.S2();

    }

    public void S1()

    {

    o.OWS ws = new o.OWS ();

    ws.CookieContainer = new CookieContainer();

    string sid = ws.OrderOPlate("P-MMMMM");

    Console.WriteLine(sid);

    S(ws.CookieContainer);

    }

    public void S2()

    {

    o.OWS ws1 = new o.OWS ();

    ws1.CookieContainer = DS();

    ws1.LabwareRcvd("P-MMMMM", "MMM");

    }

     

    public void S(CookieContainer c)

    {

    Stream stream = File.Open("cookie.2", FileMode.Create);

    BinaryFormatter bformatter = new BinaryFormatter();

    bformatter.Serialize(stream, c);

    stream.Close();

    }

    public CookieContainer DS()

    {

    CookieContainer c = null;

    Stream stream = File.Open("cookie.2", FileMode.Open);

    BinaryFormatter bformatter = new BinaryFormatter();

    c = (CookieContainer)bformatter.Deserialize(stream);

    stream.Close();

    return c;

    }

     

    }


     




  • CEO-Match

    Sekhar,

    The sequential workflows will appear as unique proxy classes when you add the web reference.  Simply instantiate the right proxy class for the workflow you want to call.

    I.e. Workflow1_WebService w1 = new Workflow1_WebService();
         Workflow2_WebService w2 = new Workflow2_WebService();
          w1.Meth1();
          w2.Meth2();





  • MikeHiland

    You need to create a cookie container so that the instance id is stored in the web service state.  You can do this by:

    w1.CookieContainer = new CookieContainer();

  • corny_cory

    how do I call w1.Meth2 assuming that w1.Meth1 was already called and initialized workflow
    when I call w1.Meth2 I get this error:

    InvalidOperationException: Current session has no workflow instance associated< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    //with it. Send activation message to start new instance in current session.

    the call originates from WIndows COnsole APp



  • Anders Ryd&amp;#233;n

    where do I set cookie expiration date for long running workflows could this be done with workflow id



  • Richard Ambrose

    how do I recall instance Id that was created. I saved workflowid for the instance that I'm interested in. I've seen some code that does Session["workflowInstanceId"] = "foo" but that would apply on the server side or web app.
    here's an example
    string x = w1.Step1(); // returns workflow instance id using WebReceive and WebRespond activities within the workflow

    w2.Step2() ; // blows

  • Keyur

    Hey Mpco,

    You can set the expiration date on the individual cookie (which would be an element of the cookie container).  This MSDN doc page has more info on cookies:

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemnetcookieclasstopic.asp


  • Tony Rodriguez

    the above problem got solved by copying the web service to local IIS. Next question:
    what's recommended way of catching 'out of sequence' calls to the workflow. Again, workflow has step1, step2, step3 that can be called using WebServiceReceive. Method that's being called when step1,2,3 are called takes a parameter and checks it against current step that is stored as the variable. If the 'out of synch' call is detected it throws new Exception, however, the web service proceeds without dying despite Exception being thrown. Any suggestions.

  • Nondisclosure

    Arjun,
    Thank U very much for the reply,
    I have two Worflow Webservices in a Sequential workflow project, Can you say me how I can use them in WinForms, I have to use two Services for each between the WinForms host and the WF.

    Thanks,
    Sekhar

  • maqk

    Out of sequence web service calls into a workflow can be caught by using the WebServiceReceive activity in the workflow Events page.

    You can use this for a Sequential or State Machine workflow.

    Right click on the workflow design surface and choose "View Events".

    Regards,
    Paul

  • Johnny Butler

    this did work. Thanks. Next question:
    I would like to do the following:
    w.Step1(); in console app
    and
    w.Step2(); in web page

    how do I get web service to load correct workflow, I do have workflow Id stored and shared between both

    this is to clarify my previous post

  • small problem