urlbiztalkwebhttpbindingquerystringparameterwebhttp

BizTalk WCF-WebHttp - How to add parameter to Url with same name


A QueryString normally allows name/value-pairs, where the same name can occur several times. When using WCF-WebHttp and BtsHttpUrlMapping, for caling a REST service, it maps from a property schema, which does not allow repeating element and that make the url mapping not allowing the same parameter being added more than once.

I need to add an array of parameters like: /query?param1=x&param1=y and so on.

Am I forced to use a dynamic port and set the url in the orchestration? Any other suggestions or samples would be much appropriated.


Solution

  • If it is a fixed number of repeating variable then just map them to a schema where they are name non repeating ones.

    e.g.

    <value>xvalue</value>
    <value>yvalue</value>
    

    maps to

    <x>xvalue</x>
    <y>yvalue</y>
    

    URL Mapping

    /query?param1={x}&amp;param1={y}
    

    If it is a variable but a fixed maximum number of elements then use the above, but also set the BTS.Operation property and have

    <BtsHttpUrlMapping>
          <Operation Name='Retrieve1' Method = 'GET' Url='/query?param1={x}' 
          <Operation Name='Retrieve2' Method = 'GET' Url='/query?param1={x}&amp;param1={y}' />
          <Operation Name='Retrieve3' Method = 'GET' Url='/query?param1={x}&amp;param1={y}&amp;param1={z}' />
          ... 
    </BtsHttpUrlMapping>