none
How to consume a Dynamic Restful url in Biztalk 2013 using WCF-WebHttp adapter RRS feed

  • Question

  • I have a requirement to consume a Dynamic Restful url - http://abc.com/$c1/$c2/$c3/key

    c1 - code 1 part of payload

    c2- code 2

    c3- code 3

    key - license key

    in Biztalk 2013 using WCF-WebHttp adapter

    How can I approach this.

    Monday, May 16, 2016 9:13 AM

Answers

  • Hi

    Refer these-

    http://www.quicklearn.com/blog/2013/08/16/biztalk-server-2013-support-for-restful-services-part-15/

    https://seroter.wordpress.com/2012/11/19/exploring-rest-capabilities-of-biztalk-server-2013-part-2-consuming-rest-endpoints/

    You have to create a property schema that contains four properties for the 4 variables(that represent the 4 dynamic URL parts), and map them in the Variable mapping section on your SendPort's web-Http adapter config.

    In the outbound message to the SendPort, make sure that your output message has all four fields that are mapped to your custom property schema. The web-Http adapter at runtime will read those 4 promoted properties and create the dynamic URL for you.

    In your case, you will have 4 entries here that map from your custom property schema properties to the variable portions ($c1, etc) in your dynamic URL-

    variable mapping



    Thanks Arindam








    Monday, May 16, 2016 9:30 AM
    Moderator
  • Hi Adarsh

    No special config is needed, you just have to mention the correct HTTP verb, eg: POST in HTTP Method and URL Mapping section.

    If you want to send multiple HTTP verb requests over the same port, you have to specify the mapping in a <BtsHttpUrlMapping> section. The mapping is from BTS.Operation(will be promoted if you are using orchestration that is bound to this SendPort) to a HTTP verb and a dynamic URL segment. See the example below the HTTP Method and URL Mapping section in the screenshot.

    For eg:

    <BtsHttpUrlMapping>
    <Operation Name=’RestGET’ Method=’GET’ Url=’/Emp/{EmpId}/{State}’ />
    <Operation Name=’RestPOST’ Method=’POST’ Url=’/Emp/{EmpId}/{State}’ />
    </BtsHttpUrlMapping>


    Thanks Arindam



    Tuesday, May 17, 2016 12:36 PM
    Moderator

All replies

  • Hi

    Refer these-

    http://www.quicklearn.com/blog/2013/08/16/biztalk-server-2013-support-for-restful-services-part-15/

    https://seroter.wordpress.com/2012/11/19/exploring-rest-capabilities-of-biztalk-server-2013-part-2-consuming-rest-endpoints/

    You have to create a property schema that contains four properties for the 4 variables(that represent the 4 dynamic URL parts), and map them in the Variable mapping section on your SendPort's web-Http adapter config.

    In the outbound message to the SendPort, make sure that your output message has all four fields that are mapped to your custom property schema. The web-Http adapter at runtime will read those 4 promoted properties and create the dynamic URL for you.

    In your case, you will have 4 entries here that map from your custom property schema properties to the variable portions ($c1, etc) in your dynamic URL-

    variable mapping



    Thanks Arindam








    Monday, May 16, 2016 9:30 AM
    Moderator
  • Hi Adarshk,

    To be able to consume the Restful Service with BizTalk you will need to have a send port configured with the WCF-WebHttp adapter,This can be done by configuring the WCF-WebHttp adapter or binding if you choose WCF-Custom. In the general tab of the WCF-WebHttp Transport properties the address of the service can be specified (URI). Besides the address you specify here the HTTP Method  and perform a URL mapping.

    In HTTP Method and URL Mapping section you should specify the method (operations) you are going to perform. AS you stated you will use it for dynamic routing so in this case you use an orchestration that the Name has to be specified, which is the name of the operation of the logical port. The URL mapping you define what is going to added after the specified URI. To make it more dynamic instead of hard-coding in general you make use of variable mapping configuration feature. So what's between the brackets is a variable that can be mapped to promoted property. The HTTP Method and URL Mapping looks in this case as:

    <BtsHttpUrlMapping>
        <Operation Method="MethodName" Url=”status/{code1/2/3}?”/format=xml">
    </BtsHttpUrlMapping>

    Monday, May 16, 2016 10:02 AM
  • Hi Arindam,

    Thanks for the quick reply.

    Will this work for POST method as well.

    Is any other configuration required for that.

    Tuesday, May 17, 2016 12:20 PM
  • Hi Adarsh

    No special config is needed, you just have to mention the correct HTTP verb, eg: POST in HTTP Method and URL Mapping section.

    If you want to send multiple HTTP verb requests over the same port, you have to specify the mapping in a <BtsHttpUrlMapping> section. The mapping is from BTS.Operation(will be promoted if you are using orchestration that is bound to this SendPort) to a HTTP verb and a dynamic URL segment. See the example below the HTTP Method and URL Mapping section in the screenshot.

    For eg:

    <BtsHttpUrlMapping>
    <Operation Name=’RestGET’ Method=’GET’ Url=’/Emp/{EmpId}/{State}’ />
    <Operation Name=’RestPOST’ Method=’POST’ Url=’/Emp/{EmpId}/{State}’ />
    </BtsHttpUrlMapping>


    Thanks Arindam



    Tuesday, May 17, 2016 12:36 PM
    Moderator