none
Context property for my custom adapter

    Question

  • Hi

    I'm building a custom adapter based on the LOB adapter SDK. 
    My adapter requires the use of one or more context properties to control per-message behaviour
    In my output handler I can use message.properties to access these, so that aspect is ok. 

    For BizTalk I assume I have to deploy the relevant property schema as part of my adapter deployment.
    Is there any way to add this property to the metadata so that it's easier for .net consumers to provide it? 


    Yossi Dahan http://www.sabratech.co.uk/blogs/yossidahan [To help others please mark replies as answers if you found them helpful]
    Tuesday, December 01, 2009 2:25 PM
    Moderator

Answers

  • I see. When using a proxy, WCF message property has to e set by writing code similar to the following:

                        ConcurrentPrograms_ARClient client1 =
                            new ConcurrentPrograms_ARClient(binding, address);

                        using (new OperationContextScope(client1.InnerChannel))
                        {
                            OperationContext.Current.OutgoingMessageProperties.Add("Property Name", "Property Value");
                            client1.OPERATION(params...);
                        }



    The WCF message property is not related to your operation at all. So the best you can do it to have the property as a  parameter in the operation, and so the property would be part of the message itself. However, that would not look clean.

    What I have done in the past is to create a public class that has the full property name - so that the users are spared of at least figuring out the string value for the property name. As you can see, in proxy code, setting property on the wcf message is not clean at all.

    Do you have any other ideas?

    Thursday, December 03, 2009 6:14 PM

All replies

  • I am not sure what you mean by 'add the property to the metadata'. You can create a public class in the adapter itself, which the users can use to get the property namespace+name (as string constants). Or did I misinterpret your question?
    Wednesday, December 02, 2009 5:53 PM
  • Thanks Manas

    I probably wasn't very clear, am being a bit daft, or both.
    As a .net client I'm going through the Add Adapter Service UI and end up with a generated proxy.
    Knowing that I need to provide this metadata, how do I do that? 

    I get a proxy, with a method and some parameters and/or return value generated.
    How, as the adapter developer, I can ensure the proxy exposes the additional property?

    Yossi Dahan http://www.sabratech.co.uk/blogs/yossidahan [To help others please mark replies as answers if you found them helpful]
    Thursday, December 03, 2009 2:49 PM
    Moderator
  • I see. When using a proxy, WCF message property has to e set by writing code similar to the following:

                        ConcurrentPrograms_ARClient client1 =
                            new ConcurrentPrograms_ARClient(binding, address);

                        using (new OperationContextScope(client1.InnerChannel))
                        {
                            OperationContext.Current.OutgoingMessageProperties.Add("Property Name", "Property Value");
                            client1.OPERATION(params...);
                        }



    The WCF message property is not related to your operation at all. So the best you can do it to have the property as a  parameter in the operation, and so the property would be part of the message itself. However, that would not look clean.

    What I have done in the past is to create a public class that has the full property name - so that the users are spared of at least figuring out the string value for the property name. As you can see, in proxy code, setting property on the wcf message is not clean at all.

    Do you have any other ideas?

    Thursday, December 03, 2009 6:14 PM
  • Hi Manas

    Thanks for this - tried it this morning and it does work. 
    Overall not too bad, but I can't say its the best experience from the service consumer's point of view. 

    I guess what I would have liked is to be able to provide, through the adapter metadata, the set of properties I'm exposing.
    As you've suggested these are not operation specific, and that's ok.
    I would wanted the code generation then to generate properties on the client side that would allow me to set values; they can set the operation context as needed. 

    As far as I know this is roughly how SOAP headers in ASMX work, right? 

    As a consumer developer I still need to know I should provide certain properties (and good faults coming back from the service should help with that), but once I know what I need to set it should be as easy as client.SomeProprety = "some value";

    Just my 2 cents.

    Yossi Dahan http://www.sabratech.co.uk/blogs/yossidahan [To help others please mark replies as answers if you found them helpful]
    Friday, December 04, 2009 8:31 AM
    Moderator