Skip to main content

Transfrom SOAPMessage into byte[] using FI

4 replies [Last post]
herok
Offline
Joined: 2007-02-23
Points: 0

Hello,

I am looking for a fast way to transform a javax.xml.soap.SOAPMessage into byte[] using fast infoset.
Has someone a clue for me?

Thomas

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
oleksiys
Offline
Joined: 2006-01-25
Points: 0

Can you please describe your usecase?
As seems you're trying to duplicate JAX-WS work...

herok
Offline
Joined: 2007-02-23
Points: 0

The use case is quite easy:
Send SOAP messages over JMS.
I could build a normal SOAP message and send it as string, but - well, this would not be an increase in performance.

oleksiys
Offline
Joined: 2006-01-25
Points: 0

Ok.
Seems what you can do is:
1) serialize SOAPMessage SOAPMessage.writeTo(OutputStream) to ByteBufferOutputStream.
2) Transform it to ByteArrayInputStream
3) Checkout FastInfoset sources from [1] and look at class [2].

But actually this way seems quite strange for me.
Probably it could be good to reuse simplicity JAX-WS proposes to you:
1) Plug in jms transport [3]
2) Turn on FastInfoset [4]
3) Call web service stub

And I think it will work faster...

[1] fi.dev.java.net
[2] com.sun.xml.fastinfoset.tools.XML_SAX_FI
[3] jms-ws-transport.dev.java.net
[4] http://blogs.sun.com/sandoz/entry/how_to_enable_fast_infoset

herok
Offline
Joined: 2007-02-23
Points: 0

> Seems what you can do is:
> 1) serialize SOAPMessage
> SOAPMessage.writeTo(OutputStream) to
> ByteBufferOutputStream.
> 2) Transform it to ByteArrayInputStream
> 3) Checkout FastInfoset sources from [1] and look at
> class [2].

This works fine, but you do not need an extra InputStream;

baos = new ByteArrayOutputStream(DEFAULT_MESSAGE_SIZE);
saajMessage.writeTo(baos);
baos.toByteArray();

> But actually this way seems quite strange for me.
> Probably it could be good to reuse simplicity JAX-WS
> proposes to you:
> 1) Plug in jms transport [3]
> 2) Turn on FastInfoset [4]
> 3) Call web service stub

This way might really work faster, but the application I am working on is a generic SOAP messages router (without any wsdl). For a simple deployment and reuse, it is forbidden to use any generated data.