users@jax-rpc.java.net

RE: Adding SOAPHeader children from a NodeList

From: Kevin Jones <kevinj_at_develop.com>
Date: Fri, 5 Dec 2003 07:56:06 -0000

Do you actually need a SOAPMessage or do you need a SOAP message?

I find that using SAAJ to build anything apart from a SOAP fault a
complete pain. You're almost certainly better off in this case using
DOM/JDOM/StAX/JAXB rather than SAAJ.

Even if you need a SOAPMessage you can build the data using one of the
other APIs and then import it (call addDocument on the SOAPBody), and
remember that in the latest version of SAAJ everything is an
org.w3c.dom.Node, so at the very least you can treat it like a DOM.

BTW, SAAJ like many Java APIs is factory based to allow for multiple
implementations which makes the API harder to use and in the case of
SAAJ, which is a relatively simple API, is something of an overkill
(IMHO of course),

Kevin Jones
http://kevinj.develop.com

> -----Original Message-----
> From: Karr, David [mailto:David.Karr_at_wamu.net]
> Sent: 04 December 2003 21:49
> To: users_at_jax-rpc.dev.java.net
> Subject: Adding SOAPHeader children from a NodeList
>
>
> I'm trying to construct a SOAPMessage from a message that is
> "soap-like". It has a "header" element and a "body" element,
> but it doesn't quite match the SOAP 1.1 schema, so I can't
> create a SOAPMessage directly from it.
>
> So, I need to create an empty SOAPMessage and then add pieces
> to it. I'm trying to figure out the easiest way to get some
> of this done. It appears that I have to take the SOAPHeader
> object obtained from the SOAPMessage and use the
> "addChildElement(SOAPElement)" method from the SOAPElement
> base class. It appears that I can't create SOAPElement
> objects directly, I have to use the
> "SOAPFactory.createElement()" method. This has overloaded
> versions of "(name)", "(localName)", and "(localName, prefix, uri)".
>
> It appears that I have to create a SOAPElement using a
> particular name (copied from the original), and then manually
> add the content of that element.
>
> Isn't there an easier way to do this?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net