Page 1 of 1

xml as binary

Posted: Mon Apr 12, 2010 8:45 am
by jagadam
Hi All,

One of my requirement is sending the xml file as a binary to the webservices.

I have two questions regarding this.

1) Can we send the XML File as Binary..?

2) Can we send an XML file as an attachment to the webservices.

I searched the forum and couldnt find them.

Regards.

Posted: Mon Apr 12, 2010 9:37 am
by ArndW
I'm not sure of what a binary XML file would look like, since the format of tags in XML uses certain (displayable) characters.

Posted: Mon Apr 12, 2010 11:45 am
by eostic
agree with Arnd...xml is, by nature, character. There are binary things that happen with xml and web services, such as web services "SOAP with Attachments", and there are ways to carry binary data within xml (simple ways like using an extended hex notation is common).......but each are more specific than just "xml as binary"....

The Web Services pack does not support SOAP with Attachments. What exactly do you need to do?

Ernie

Posted: Mon Apr 12, 2010 12:38 pm
by jagadam
Hi Ernie,

I have a requirement where they(the client) are expecting to send an xml as an attachment to the webservices.

They gave a wsdl which has some thing like this.

s:element minOccurs="0" maxOccurs="1" name="Stream" type="s:base64Binary"

So my understanding is that we need to send an xml file as an attachment and it should be in binary(please correct me if iam wrong).

So trying to find out whether this is possible or not.

Regards.

Posted: Mon Apr 12, 2010 3:00 pm
by jagadam
Hi Ernie,

Thanks for the response.

I wanted to find out... how to convert the XML as a base64 binary..?

Any inputs would be of great help.

Regards.

Posted: Mon Apr 12, 2010 3:16 pm
by ray.wurlod
jagadam wrote:I have a requirement where they(the client) are expecting to send an xml as an attachment to the webservices.
Resist stupid requirements!

XML is a text-based standard.

Posted: Mon Apr 12, 2010 3:31 pm
by eostic
To Ray's point, you won't convert "the xml"....you would convert something that is carried "inside" the xml....

There are various ways to do this, (I like using Server with iconv/oconv), but once you have the hex value translated into character, you put it inside your tags....

For example, if my memory serves me correctly, the hex for 1234 is C1C2C3C4, so if this was the value for productID, you would end up with <productID>C1C2C3C4</productID> instead of <productID>1234</productID>.

Obviously you wouldnt need hex for this example, but if it was an unprintable set of values, like binary zeros or something, you'd want this technique.

Sounds like you need to find out more about EXACTLY what type of payload you need to be sending.

Ernie

Posted: Mon Apr 12, 2010 4:43 pm
by ray.wurlod
You could always zip the XML. That would be binary.
:wink:

Posted: Tue Apr 13, 2010 5:57 am
by SBSA_DW2
ray.wurlod wrote:You could always zip the XML. That would be binary.
:wink:
Man am I glad I found this! :D
I want to send a zip file to MQ but am struggling to define the source to the MQ stage. If it's a compressed file, what do I specify in the sequential stage for the metadata? (original file is XML, but larger than life, thus the reason to compress the file before placing it on the Q)

Any other ideas on getting the zipped file onto the Q?

thanks guys

Posted: Tue Apr 13, 2010 7:02 am
by chulett
Glad you found this too, but less glad that you decided to hijack the thread you found it in. Please start your own post on this subject.