Search code examples
biztalkbiztalk-2010

How to add a LicenseKey to an Webservice Call in a BizTalk SendPort?


I need to communicate with a web-service but need to pass a License Key.

I generated the schema but my mapping requires me to map to the "OrderInfoObject" node.

auto generated schema

I tried creating a mapping that adds the soap envelope with license key and this creates code that works when I copy it into soapUI but gets double encapsulated (<soapenv:Envelope><soapenv:Body><soapenv:Envelope><soapenv:Body>) even if I set the inbound message body to Envelope -- entire from Body -- contents.

So my mapping has the following

 <wms:OrderInfoObject>
   ...
 </wms:OrderInfoObject>

And the send port adds that in the body of the soap

<soapenv:Envelope xmlns:soapenv="..." xmlns:wms="...">
  <soapenv:Header>
  </soapenv:Header>
  <soapenv:Body>
 -- Here comes my message --
</soapenv:Body>
</soapenv:Envelope>

The send port was generated by consuming the WSDL so I am not confident in how it works but the Header seems out of reach.

So I am unsure how to add the License key.


Solution

  • You're focusing on the wrong appearance of LicenseKey. You need to find the descendant implementation somewhere under OrderInfoObject.

    It's unlikely there's anything wrong with the Schema as any number Elements can be defined at the root, then referenced somewhere under the 'real' root element.

    To clean thing up, you can set the Root Reference on this Schema to OrderInfoObject, then all the 'Type' elements will be hidden.

    However, if LicenseKey needs to be a SOAP Header element, you would use the WCF.OutboundCustomHeaders property to add elements to that section.

    This MSDN Article describes the process: Using SOAP Headers in WCF Messages with Orchestrations