0

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.

Martin Bring
  • 1,176
  • 1
  • 7
  • 17

1 Answers1

0

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>
Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
  • Thank you for answering and I will save you suggestion for the future. Unfortunately my variables are not fixed. – Martin Bring Feb 22 '19 at 07:55
  • @MartinBring Then you may have to create the query parameter as a string and have that as the context property that you map – Dijkgraaf Feb 22 '19 at 08:17
  • Yes, that seems to be the path ahead, thank you. I guess your suggestion use a dynamic port? I noticed that if you use an UrlMapping with parameters with the same name one gets validation error on a static port. I have not tested with a dynamic port yet, but will go on creating the whole Url/QueryString. – Martin Bring Feb 25 '19 at 12:09
  • This led me to a solutions that worked, a dynamic port and Creation of the url in an orchestration. – Martin Bring Jan 28 '20 at 13:48