javros
javros

Reputation: 823

BizTalk messaging via SSL

I'd like BizTalk to send & receive messages via SSL, can you please share some thoughts about how to accomplish this need?

Upvotes: 0

Views: 721

Answers (1)

schellack
schellack

Reputation: 10274

BizTalk includes a SOAP adapter to allow you to send and receive messages using SOAP. Basic information on this adapter is available on MSDN.

Sending via SSL is as simple as specifying https instead of http in the web service's URL.

Publishing a SOAP (ASMX) service in BizTalk is typically done using the BizTalk Web Services Publishing Wizard, though IIS is required. You can publish schemas (compiled into a BizTalk assembly using Visual Studio) and/or orchestrations as web services. After publishing the service, you use IIS to setup SSL.

There's also a handy guide to troubleshooting the SOAP adapter (that is still relevant to the latest version of BizTalk, even if the guide is 3 years old) available here.


I should note that, lately, I have not deployed anything with the SOAP adapter, but have used the WCF-Custom adapter instead. This still results in callers being able to send me messages via SOAP, but provides a much more powerful and flexible solution for working with web services on the latest technology in this part of the Microsoft stack (WCF vs ASMX).

To publish your service, you just use the BizTalk WCF Service Publishing Wizard instead of the Web Service Publishing Wizard. For security, specify Transport security and setup the SSL configuration in IIS (here is one walk-through on the security setup). To make the WCF service use SOAP in a manner that allows callers to not know about WCF, set the binding type to customBinding and use the httpTransport transport. That's pretty much all you have to configure.

As a simple example, if you publish a simple schema that looks like this (and lets in just about anything):

 <?xml version="1.0" encoding="utf-16" ?> 
 <xs:schema xmlns="http://company.namespace.ExternalService" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://company.namespace.ExternalService" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
  <xs:appinfo>
  <b:schemaInfo root_reference="Stuff" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" /> 
  </xs:appinfo>
  </xs:annotation>
  <xs:element name="Stuff">
  <xs:complexType>
  <xs:sequence>
  <xs:any processContents="lax" /> 
  <xs:element name="OutboundDataFeed" type="xs:string" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
 </xs:schema>

...then the SOAP message sent to your service would actually look like this:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing">
  <s:Header>
    <a:Action>ReceiveStuff</a:Action>
    <a:To>http://your.company.com/stuff/stuff.svc</a:To>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Stuff xmlns="company.namespace.ExternalService">
      <test>Replace this XML with whatever you want, XML or otherwise</test>
    </Stuff>
  </s:Body>
</s:Envelope>

...where the Action would need to be specified as the Operation of any receiving BizTalk orchestration's inbound receive port.

Upvotes: 2

Related Questions