none
WCF Adapter With Nonconforming Service RRS feed

  • Question

  • I currently need to configure a dynamic send port to connect with an ASMX web service that does not conform to WS-I Basic Profile v1.1. Specifically, R9981, which states "An ENVELOPE MUST have exactly zero or one child elements of the soap:Body element." The web service I'm consuming is expecting a body with multiple elements, causing the SOAP body to look like:

    <Body>
        <FirstElement />
        <SecondElement />
    </Body>
    

    I have tried using both WCF-BasicHttp and WCF-Custom adapters with no success. It seems that the BizTalk WCF adapters can just not handle a SOAP body with more than one element.

    On the receive location, I wrap the message under one element using a template to solve the issue of the message traveling through BizTalk and I thought I could simple intercept the message with a custom send pipeline / custom component to strip out the wrapping element. I then tried a custom behavior extension with a message inspector, but that still occurs before BizTalk's WCF "BizTalkBodyWriter" does its work.

    As I'm using the ESB 2.1 toolkit, I cannot use the HTTP adapter to create my SOAP message from scratch. My last thought would be I would need to create a custom WCF LOB adapter, but before I go down that route I want to make sure I'm not overcomplicating things here and there isn't an easy way I've just overlooked.

    Monday, April 22, 2013 11:27 AM

Answers

  • I think you only option would be a custom MessageEncoder.  You might be able to inherit from a built in encoder, text or binary, and just override WriteMessage.
    Monday, April 22, 2013 10:19 PM

All replies

  • Have you tried calling this service from a .net client or in BizTalk using consume WCF service option.
    Monday, April 22, 2013 4:08 PM
  • I think you only option would be a custom MessageEncoder.  You might be able to inherit from a built in encoder, text or binary, and just override WriteMessage.
    Monday, April 22, 2013 10:19 PM
  • I think you only option would be a custom MessageEncoder.  You might be able to inherit from a built in encoder, text or binary, and just override WriteMessage.

    This was the solution. I had to wrap the incoming message under a single element so it can get past the BizTalkBodyWriter and then I created a message encoder that unwrapped the body. I cannot add links to my posts, so search for "WCF Interoperability and Extensibility - Part One" to find the guide I used in creating the encoder.

    Tuesday, April 23, 2013 11:25 AM