[jbossws-issues] [JBoss JIRA] Created: (JBWS-2706) Unable to unmarshall attachment parts where the type is 'application/octet-stream'

Darran Lofthouse (JIRA) jira-events at lists.jboss.org
Tue Jul 21 12:34:29 EDT 2009


Unable to unmarshall attachment parts where the type is 'application/octet-stream'
----------------------------------------------------------------------------------

                 Key: JBWS-2706
                 URL: https://jira.jboss.org/jira/browse/JBWS-2706
             Project: JBoss Web Services
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: jbossws-native
    Affects Versions:  jbossws-native-3.1.2
            Reporter: Darran Lofthouse
            Assignee: Darran Lofthouse
             Fix For: jbossws-native-3.2.0


Based on the following WSDL sections: -

  <message name="messageInput">
    <part name="request" element="s:InputRequest"/>
    <part name="attach1" type="xsd:string"/>
    <part name="attach2" type="xsd:base64Binary"/>
  </message>

  <message name="messageOutput">
    <part name="response" element="s:OutputResponse"/>
    <part name="attach1" type="xsd:string"/>
    <part name="attach2" type="xsd:base64Binary"/>
  </message>

  <binding name="SwaTestSoapBinding1" type="tns:SwaTest1">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    
    <operation name="echoMultipleAttachments">
      <soap:operation/>
        <input>
          <mime:multipartRelated>
            <mime:part>
              <soap:body parts="request" use="literal"/>
            </mime:part>
            <mime:part>
              <mime:content part="attach1" type="application/octet-stream"/>
            </mime:part>
            <mime:part>
              <mime:content part="attach2" type="application/octet-stream"/>
            </mime:part>
          </mime:multipartRelated>
        </input>
        <output>
          <mime:multipartRelated>
            <mime:part>
              <soap:body parts="response" use="literal"/>
            </mime:part>
            <mime:part>
              <mime:content part="attach1" type="application/octet-stream"/>
            </mime:part>
            <mime:part>
              <mime:content part="attach2" type="application/octet-stream"/>
            </mime:part>
          </mime:multipartRelated>
        </output>        
     </operation>    
  </binding>

JBossWS can send messages without problem but unmarshalling the messages results in the following error: -

Caused by: javax.xml.soap.SOAPException: javaType [[B] is not assignable from attachment content: java.io.ByteArrayInputStream
at org.jboss.ws.core.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:248)

The reason is because a DataHandler is used to wrap the attachment part, the data handler is passed the attachment along with the content type 'application/octet-stream' as this is not related to a specific type the call to getContent() on the DataHandler within EndpointInvocation returns an InputStraem for the attachment - this is not assignable to the expected Java type.

The transformPayloadValue method in EndpointInvocation requires an additional step to take the InputStream and convert it to the expected Java type.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbossws-issues mailing list