Yes, it is clear that the intent of the SAAJ design is that SOAPElement should exist as a child of a SOAP envelope. However, JAX-RPC RI wscompile often maps XML schema types to SOAPElement. So, a client proxy that wishes to use such a service must pass a SOAPElement as a parameter.
So what should one do in this situation? Create a dummy SOAPMessage, so that you can attach a DOM to it with attachDocument() and thereby get a SOAPElement? Seems convoluted.
Thanks for your help,
Mark
On Tue, 15 Jul 2003 11:06:48 -0400, Anne Thomas Manes <anne_at_MANES.NET> wrote:
>A SOAPElement is a child of the SOAP envelope -- which must be either a
>SOAPHeader or a SOAPBody. If you would like to send this element as all or
>part of your application payload, it should be included in the SOAPBody. If
>you are sending some type of control information, it should be included in
>the SOAPHeader.
>
>Alternately, you can send your document as a MIME attachment.
>
>Anne
>
>----- Original Message -----
>From: "Mark D. Hansen" <khookguy_at_YAHOO.COM>
>To: <JAXRPC-INTEREST_at_JAVA.SUN.COM>
>Sent: Monday, July 14, 2003 10:24 PM
>Subject: Re: Creating a SOAPElement instance from an XML file ??
>
>
>But what if I don't want to create the SOAPBody - just the SOAPElement? I
>am trying to use a client that has been generated by wscompile/wsdeploy and
>maps an custom XML type to a SOAPElement.
>
>Thanks for your help,
>
>Mark
>
>-----Original Message-----
>From: Public discussion on JAX-RPC
>[mailto:JAXRPC-INTEREST_at_JAVA.SUN.COM]On Behalf Of Pretorian Mihnea
>Sent: Monday, July 14, 2003 4:30 AM
>To: JAXRPC-INTEREST_at_JAVA.SUN.COM
>Subject: Re: Creating a SOAPElement instance from an XML file ??
>
>
>Actually you don't need to create a SOAPElement. You can create a Document
>and add it to SOAPBody with addDocument method.
>
>Mihnea
>
>-----Original Message-----
>From: Mark D. Hansen [mailto:khookguy_at_YAHOO.COM]
>Sent: Saturday, July 12, 2003 12:25 AM
>To: JAXRPC-INTEREST_at_JAVA.SUN.COM
>Subject: Creating a SOAPElement instance from an XML file ??
>
>
>I've got a purchase order file - po.xml. I want to create a SOAPElement
>instance from it (SAAJ 1.2). I can use SOAPFactory to create a
>SOAPElement - but it is an empty element, and I want to create one from my
>file. It doesn't look like I can use DocumentBuilder.parse() to create a
>SOAPElement either - it still just produces org.w3c.Element instances.
>
>What is the best way to do this? Shouldn't there be a SOAPFactory method
>with a signature like:
>
>public SOAPElement createElement(javax.xml.transform.Source src) ???
>
>Thanks,
>
>Mark