Attaching a PDF document into an XML message

Hi All,

Can anyone direct me as to how can a pdf document be added in an XML message. Meaning:

<rootxmltag>
<name>webMethodsIS1</name>
<lastname>Developer</lastname>
<pdfdata>…PDF file attached here </pdfdata>
</rootxmltag>

In the above xml message I want the pdfData tag to hold the pdf file information. This file will be posted to a webservice which will extract the pdfData content, convert and save the pdf file locally. Can something like this be done using IS built-in services?

Any information is appreciated.

Thanks

To carry binary data within an XML tag, the most convenient approach is Base 64 encoding the content (use pub.string:base64Encode):

<rootxmltag>
<name>webMethodsIS1</name>
<lastname>Developer</lastname>
<pdfdata>=2ady46js09agadj04yhlkjd8rjlfg…</pdfdata>
</rootxmltag>

I understand base64 encoding adds 37% to the message size than absolutely essential (since HTTP is an 8-bit transfer protocol). If size is a huge worry, you could try the methods below:

You could also embed binary data directly in the XML document using the CDATA tag. I haven’t tried that. This article describes it well:
[url=“http://builder.com.com/5100-6374-1050529.html#Listing%20A”]http://builder.com.com/5100-6374-1050529.html#Listing%20A[/url]

Last month W3C put out a new standard on attaching binary data to XML documents:
[url=“XML-binary Optimized Packaging”]http://www.w3.org/TR/2005/REC-xop10-20050125/[/url]
It’s an unfortunate looking implementation full of namespaces. I bet WM doesn’t currently support it either, so you’ll have to write your own handler. I wouldn’t bother with it.