[jboss-user] [JBoss Web Services] - XML Content handler only supports a StreamSource content object

Eugene McKissick do-not-reply at jboss.com
Mon May 10 15:41:06 EDT 2010


Eugene McKissick [http://community.jboss.org/people/elm3d] created the discussion

"XML Content handler only supports a StreamSource content object"

To view the discussion, visit: http://community.jboss.org/message/542127#542127

--------------------------------------------------------------
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

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/542127#542127]

Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100510/9e1ded4f/attachment.html 


More information about the jboss-user mailing list