Tuesday, February 12, 2008

Copy Any-Element to a typed structure

Situation:I received a SSDN reply, the schema contained a element.
This element can contain different other xml data, depending on the request.
I need to map the content of the element to a structured format.

Schema of the incoming XML file (with the element):


Schema of the Output-Xml, this schema = the structure within th element


Problem:
BizTalk can’t link elements, the Mass copy didn’t work as there are more fields next to above the any-element at the same level. (See XSD schema)

Solution:
Add a Message Assign shape to your Orchestration
Add the following code


IdentifyPersonResultMsg = xpath(SSDNReplyMsg, "/*[local-name()='SSDNReply']/*[local-name()='ServiceReply']/*[local-name()='IdentifyPersonReply']");



I just use an xpath query to get the content in the element and I place the result I the correct message.
In this case IdentifyPersonResultMsg has the message type as the element

Message constructed on the Construct Shape: IdentifyPersonResultMsg

1 comment:

Anonymous said...

Is the Xpath is correct or do u need to refer through element