2 Replies Latest reply on May 11, 2010 10:07 AM by Eugene McKissick

    XML Content handler only supports a StreamSource content object

    Eugene McKissick Newbie

      All,

       

      I recently converted an existing web service from CXF to JBossWS Native.  The service is up and running, however whenever I try to call the web service I get the following error:

       

      [RequestHandlerImpl] Error processing web service request

      org.jboss.ws.WSException: java.io.IOException: XML Content handler only supports a StreamSource content object

      ....

       

      Caused by: java.io.IOException: XML Content handler only supports a StreamSource content object

      at org.jboss.ws.core.soap.attachment.XmlDataContentHandler.writeTo(XmlDataContentHandler.java:101)

      at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:883)

      at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)

      at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:845)

      at javax.mail.internet.MimeMultipart.wrtieTo(MimeMultipart.java:361)

      at org.jboss.ws.core.soap.attachment.MultipartRelatedEncoder.writeTo(MultipartRelatedEncoder.java:123)

      at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:343)

      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.sendResponse(RequestHandlerImpl.java:401)

      ...24 more

       

      We are currently using JBoss 5.1 with JDK 6.

       

      The method in the web service impl. that triggers this error is

       

      public void getXmlDocs(DocParams params, Holder<ReturnType> outDocument, Holder<String> xmlAttach)

      {

       

           List<String> docIDs = params.getDocID().getItem();

            for (String s: docIDs) {

                System.out.println(s);

            }

           ReturnType retType = new ReturnType();

           retType = this.populateReturnType();

           outDocument.value = retType;

       

           xmlAttach.value = <Read xml from text file>;

           System.out.println(xmlAttach.value); //Prints out contents of file as string correctly

      }

       

      Everything seems fine in the method, but when JBoss tries to create the response the error occurs.  Turning on debug I see the ReturnType object being serialized by the JAXBSerializer.  The [ObjectContent] xmlFragment statement contains xml for the ReturnType wrapped in the getDocResponse header.  Before END handleRequest is logged.

       

      Associated WSDL chunk

       

      <!-- *************************** Type Definitions *******************************  -->

      <types>

           <complexType name="ReturnType">

                <sequence>

                     <element name="returnInfo" type="xsd:String">

                     <element name="returnStatus" type="xsd:String">

                </sequence>

           </complexType>

       

           <complexType name="getDocResponse" type="tns:ReturnType" />

       

      <!--***************************Message Definitions******************************** -->

      <message name="getDocResponse">

           <part name="outDocument" element="tns:getDocResponse"/>

           part name="xmlAttach" type="xsd:string"/>

      </message>

       

      <!--***************************Binding Definitions******************************** --

       

      <output name="getDocResponse">

           <mime:multipartRelated>

                <mime:part>

                          <soap:body parts="outDocument" use="literal" />

                </mime:part>

                <mime:part>

                     <mime:content part="xmlAttach" type="text/xml"/>

                </mime:part>

           </mime:multipartRelated>

      </output>

       

      I apologize for the limited information...the errors and code reside on the server, so I had to retype the code (hence the pseudocode).  Any help or suggestions would be greatly appreciated.

       

       

      Regards,

      Eugene