I knew of three techniques for creating generic service on-ramps into BizTalk, but last night learned of a fourth.
So what if you want to create an untyped web service endpoint that can accept any valid XML message? I previously knew of three choices:
- Orchestration with XmlDocument message type. Here you create a throw-away orchestration which takes in an XmlDocument. Then you walk through the service publishing wizard and create a service out of this orchestration. Once you have the service, you can discard the originating orchestration. I seem to recall that this only works with the ASMX publishing wizard.
- Create wrapper schema around “any” node. In this case, you build a single schema that has a child node of type “any.” Then, you can use the “publish schemas as web service” option of the publishing wizards to create a general purpose service on ramp. If you’re using WCF receive locations, you can always strip out the wrapper node before publishing to the MessageBox.
- Custom WSDL on generated service. For BizTalk WCF-based services, you can now attach custom WSDLs to a given endpoint. I cover this in my book, but in a nutshell, you can create any WCF endpoint using the publishing wizard, and then set the “externalMetadataLocation” property on the Metadata behavior.
So that’s all well and good. BizTalk service endpoints in WCF are naturally type-less, so it’s a bit easier to muck around with those exposed interface definitions than when dealing with ASMX services.
That said, last night I was watching the third in Peter Kelcey’s video series on the ESB Toolkit, and he slipped in a new way (to me) for building generic service endpoints. Simply start up the BizTalk WCF Service Publishing Wizard, choose to publish schemas as a service, and when choosing the message type of the contract, you browse to C:\Program Files\Microsoft BizTalk Server 2009 and pick the Microsoft.XLANGs.BaseTypes.dll.
Once you do that, you can actually pick the “any” schema type that BizTalk defines.
Once you finish the wizard (assuming you chose to create a metadata endpoint), you’ll have a WSDL that has your custom-defined operation which accepts an “any” message.
So there you go. Maybe this was common knowledge, but it was news to me. That’s a pretty slick way to go. Thanks Peter.
Technorati Tags: BizTalk