[jdom-interest] Obtaining a JDOM document from a Streamsource class

Jason Hunter jhunter at servlets.com
Fri Jul 13 09:59:01 PDT 2007


When you build from a stream, JDOM can't pull any supporting documents 
(there's no context to pull from), but it can when you build from a 
file.  This is probably the cause of your problem.

-jh-

Clint.Redwood at xansa.com wrote:
> Hi,
> 
> I'm trying to use JDOM to access a webservice, and am using
> 
> ...
>             Dispatch<Source> dispatch = svc.createDispatch(
>                     portQName,
>                     Source.class,
>                     Service.Mode.PAYLOAD);
> 
>              // Create the source
>             DOMSource input = new DOMSource((new DOMOutputter()).output(
> doc ));
>             Source output;
> 
>             // Invoke the operation.
>             output = dispatch.invoke(input);
> 
>             // retrieve JDOM document
>             if (
> output.getClass().getName().equals("javax.xml.transform.stream.StreamSource"
>  ) ) {
>                 doc = (new SAXBuilder()).build(
> ((StreamSource)output).getInputStream() );
>                 out.output( doc, new FileOutputStream(
> "C:\\TEMP\\wsResponse.xml" ) );
>             } else doc = null;
> 
> ...
> 
> where "doc" is the input document, and the desired output document.
> 
> However, this seems not to work, as I get an exception: "
> org.jdom.input.JDOMParseException: Error on line 2: The prefix "SOAP-ENC"
> for attribute "SOAP-ENC:arrayType" associated with an element type "Result"
> is not bound."
> 
> I've tried to read the result using SAXBuilder directly from a file, and
> that works fine, so I presume SAXBuilder doesn't like reading from the
> input source of a stream source. Can anyone suggest a better way of doing
> this?
> 
> Yours,
> 
> Clint Redwood
> Senior Analyst Programmer - Boots Account
> Xansa
> t 0115 9595730 (Ext) 725730 (Int)
> e clint.redwood at xansa.com
> e clint.redwood at bcm-ltd.co.uk
> http://www.xansa.com
> 
> 
> Whilst this email has been checked for all known viruses, recipients should undertake their own virus checking as Xansa will not accept any liability whatsoever.
> 
> This email and any files transmitted with it are confidential and protected by client privilege.  It is solely for the use of the intended recipient.
> Please delete it and notify the sender if you have received it in
> error. Unauthorised use is prohibited.
> 
> Any opinions expressed in this email are those of the individual and not
> necessarily the organisation.
>      Xansa, Registered Office: 420 Thames Valley Park Drive,
>      Thames Valley Park, Reading, RG6 1PU, UK.
>      Registered in England No.1000954.
>      t  +44 (0)8702 416181
>      w  www.xansa.com
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 


More information about the jdom-interest mailing list