At 11:22 AM 8/7/2001 -0500, Rich Catlett wrote:
>I am trying to send an precreated XML document via the soap messaging service. The
>client takes as an input parameter the host soap is running on, the service, and the
>XML document to send. I have created the envelope using Envelope.unmarshall() as the
>messaging example shows ...
and his server code is
>Body body = env.getBody() // env is the Envelope sent to the service
>resctx.setRootPart(body.toString(), "text/xml");
and this generates the output
>[Attributes={}] [BodyEntries=
>[(0)=[purchaseOrder: null]]
>]
>...
>Can someone tell me what I'm doing wrong or point me in the direction to figure it
>out.
and the thing is, if you look at the source, the org.apache.soap.Body.toString() method
is generating that (0)=[purchaseOrder: null] with code like so:
> for (int i = 0; i < bodyEntries.size(); i++)
> {
> pw.println("[(" + i + ")=" + bodyEntries.elementAt(i) + "]");
> }
Now, bodyEntries is a vector which generally contains DOM elements, but
Element.toString() is not a method for reporting detailed contents, it's not a DOM
method at all -- it's a debugging aid. I'd still suggest something like
> Element purchaseOrder = (Element)(env.getBody().getBodyEntries().elementAt(0));
> new org.apache.xml.serialize
> .XMLSerializer(System.out,
> new org.apache.xml.serialize.OutputFormat("xml","utf-8",true))
> .asDOMSerializer().serialize(purchaseOrder);
to see if the Element is actually there--I just don't know, from what you've said.
toString() may tell somebody, but it doesn't tell me much. (Maybe this will blow
up with a classcastexception because the elementAt(0) is not really even an Element.
If not, it might help to figure out what it is. :-) )
Tom Myers