none
Composite Operation using C# RRS feed

  • Question

  • Hi,

    I was wondering if there is anyone out there who has used a composite operation from a WCF call instead of using BizTalk?  The Add Adapter Service Reference doesn't auto gen this type so currently I'm going to handcraft this.

    Does anyone have an example of doing this? 

    cheers

    John


    John Shaw
    Saturday, October 16, 2010 8:41 PM

All replies

  • Could you explain why you want to create composite operations in C#? You could achieve the same results by placing multiple adapter calls inside a transaction scope.

    Composite operations are required in BizTalk because of its architecture where transactions cannot span the message box.

    Hope this makes sense :)

    Thanks!

    Manas

     

    Monday, October 18, 2010 5:44 AM
  • Hi Manas,

    I know that I can use a BizTalk Orchestration and I'm actually doing this to work around this issue.  However, I don't want to for a number of reasons one is because I want to port the code to Windows Workflow without using Orchestrations at all.  I also want a low latency solution as I perform complex c# operations as I'm making these calls. 

    I have tried to handcraft the classes because the add adapter service reference doesn't have the ability to auto generate the composite operation.  I used WCF type interfaces, data contract, etc but I got a strange error when making the call which either made me think that I had a serialization issue or the underlying adapter doesn't support this in C#.

    Thanks

    John


    John Shaw
    Wednesday, October 20, 2010 3:29 PM
  • Hi John,

    You got me wrong. What I meant was that from C# or WF workflow, you dont really need composite operations - creating your own transaction scope and putting various calls to the adapter inside is same as invoking a composite operation from within a transaction scope.

    BizTalk has some limitations due to which composite operation needs to be used there - those limitations dont exist in c#.

    using(new TransactionScope()
    {

    invoke_operation1();
    invoke_operation2();
    invoke_operation3();

    }

     is same as usign a composite operation that invokes op1, op2, and op3. Also note that, in c#, you always need to create the tranaction on your own. Adapter does not initiate transaction. In BizTalk scenario, it is BizTalk that initiates the txn.

    Let me know if you have any more questions!

    Thanks,
    Manas


    -- Please mark as answered if this answers your question.
    Thursday, October 21, 2010 4:21 AM
  • Hi Manas,

    Yes I know that its possible and I could perform multiple operations in a transactional scope.  However, the issue is that we have done a complex map using the composite operation schema so we just one to send one operation to the adapter not multiple. 

    For example:

    invoke_compositeoperation(message);

    Does the c# adapter not support composite operations in this way?  Is this only possible from BizTalk? 

    thanks

    John


    John Shaw
    Thursday, October 21, 2010 11:23 AM
  • Hmmm. I get what you are saying.

    It is possible to do what you are doing. You'll need to hand generate a client proxy. Follow these steps:

    1. Use SvcUtil to get a class representation of the composite application schema (both request and response) you created in biztalk (i belive that is possible using svcutil).

     

    1. Copy some adapter wizard generated proxy - we'll modify this
    2. Modify the action to say "CompositeOperation" this is an attribute.
    3. Modify Operation Name
    4. Find the 'XXXRequest' type, and change it to request type created using svcutil.

    5. Do similar for XXXResponse.

    This should work. If you find this too much, you could create the XML message, and just pass it to the adapter using the channel model. However, that would not give you the right


    -- Please mark as answered if this answers your question.
    Friday, October 22, 2010 11:12 AM