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

Clint.Redwood at xansa.com Clint.Redwood at xansa.com
Fri Jul 13 06:27:39 PDT 2007


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


More information about the jdom-interest mailing list