Receiving Idocs - getting the raw idoc data

Since the WCF based SAP Adapter is ... well, WCF based, all data flowing in and out of the adapter is encapsulated within a SOAP message. Which means there are those pesky xml tags all over the place. If you want to receive an Idoc from SAP, you can receive it in "Typed" format (in which case each column in each segment of the idoc appears within its own xml tag), or you can receive it in "String" format (in which case there are just 2 xml tags at the top, the raw xml data in string/flat file format, and the 2 closing xml tags).

In "String" format, an incoming idoc (for ORDERS05, containing 5 data records) would look like:

<ReceiveIdoc xmlns='https://Microsoft.LobServices.Sap/2007/03/Idoc/'><idocData>EDI_DC40 8000000000001064985620
E2EDK01005 800000000000106498500000100000001
E2EDK14 8000000000001064985000002000000020111000
E2EDK14 8000000000001064985000003000000020081000
E2EDK14 80000000000010649850000040000000200710
E2EDK14 80000000000010649850000050000000200600</idocData></ReceiveIdoc>

(I have trimmed part of the control record so that it fits cleanly here on one line).

Now, you're only interested in the IDOC data, and don't care much for the XML tags. It isn't that difficult to write your own pipeline component, or even some logic in the orchestration to remove the tags, right? Well, you don't need to write any extra code at all - the WCF Adapter can help you here!

During the configuration of your one-way Receive Location using WCF-Custom, navigate to the Messages tab. Under the section "Inbound BizTalk Messge Body", select the "Path" radio button, and:

(a) Enter the body path expression as:
/*[local-name()='ReceiveIdoc']/*[local-name()='idocData']

(b) Choose "String" for the Node Encoding.

What we've done is, used an XPATH to pull out the value of the "idocData" node from the XML. Your Receive Location will now emit text containing only the idoc data.

You can at this point, for example, put the Flat File Pipeline component to convert the flat text into a different xml format based on some other schema you already have, and receive your version of the xml formatted message in your orchestration.