Announcement Announcement Module
Collapse
No announcement yet.
WebService client DataHandler exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WebService client DataHandler exception

    Hi!
    I'm trying to invoke a Web Service published through AXIS from Spring.
    The operation being invoked has some DataHandler arguments.
    Here is the client code:

    Code:
    OctetStreamDataSource("objectData", new OctetStream(readBytes(themeFile)));
    DataHandler objectData = new DataHandler(dataSource);
    The invocation returns with the following exception:

    Code:
    org.xml.sax.SAXException: Bad types (class [B -> class javax.activation.DataHandler)
     at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
     at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
     at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
     at javax.xml.parsers.SAXParser.parse(Unknown Source)
     at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
     at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
     at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
     at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
     at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
     at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
     at org.apache.axis.client.Call.invoke(Call.java:2767)
     at org.apache.axis.client.Call.invoke(Call.java:2443)
     at org.apache.axis.client.Call.invoke(Call.java:2366)
     at org.apache.axis.client.Call.invoke(Call.java:1812)
     at org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.performJaxRpcCall(JaxRpcPortClientInterceptor.java:657)
     at org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.doInvoke(JaxRpcPortClientInterceptor.java:591)
     at org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.invoke(JaxRpcPortClientInterceptor.java:562)
     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
     at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
     at $Proxy11.addMediaObject(Unknown Source)
     at ...

    The generated SOAP invocation is as follows:

    Code:
    POST /oma-dl-server/services/ThemeProvisioningService HTTP/1.0
    Content-Type: text/xml; charset=utf-8
    Accept: application/soap+xml, application/dime, multipart/related, text/*
    User-Agent: Axis/1.4
    Host: 127.0.0.1:8085
    Cache-Control: no-cache
    Pragma: no-cache
    SOAPAction: ""
    Content-Length: 1130
    
    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <addMediaObject xmlns="http://theme-provisioning">
    <objectID>testObjectID</objectID><objectVersion>1</objectVersion>
    <objectSize>1111</objectSize><objectInstallSize>1111</objectInstallSize>
    <progressiveDownloadData>false</progressiveDownloadData><mimeType>asdf</mimeType>
    <fileName>testFile</fileName><objectData xsi:nil="true"/><metaName>asdf</metaName>
    <metaDescription>asdf</metaDescription><metaTextDisplay>asdf</metaTextDisplay>
    <metaTextID>asdf</metaTextID><metaInfoURL>sdfg</metaInfoURL><metaInstallParam>asdf</metaInstallParam>
    <metaLicenseMimeType>asdf</metaLicenseMimeType><metaLicenseType>asdf</metaLicenseType>
    <metaLicenseOrder>asdf</metaLicenseOrder><metaLicenseData xsi:nil="true"/>
    <metaEnvironmentType>asdf</metaEnvironmentType><metaEnvironmentData xsi:nil="true"/>
    <metaSupressUserConfirmation>ad</metaSupressUserConfirmation></addMediaObject>
    </soapenv:Body>
    </soapenv:Envelope>
    The WSDL operations is:

    Code:
    <element name="addMediaObject">
        <complexType>
         <sequence>
          <element name="objectID" type="xsd:string"/>
          <element name="objectVersion" type="xsd:string"/>
          <element name="objectSize" type="xsd:int"/>
          <element name="objectInstallSize" type="xsd:int"/>
          <element name="progressiveDownloadData" type="xsd:boolean"/>
          <element name="mimeType" type="xsd:string"/>
          <element name="fileName" type="xsd:string"/>
          <element name="objectData" type="xsd:base64Binary"/>
          <element name="metaName" type="xsd:string"/>
          <element name="metaDescription" type="xsd:string"/>
          <element name="metaTextDisplay" type="xsd:string"/>
          <element name="metaTextID" type="xsd:string"/>
          <element name="metaInfoURL" type="xsd:string"/>
          <element name="metaInstallParam" type="xsd:string"/>
          <element name="metaLicenseMimeType" type="xsd:string"/>
          <element name="metaLicenseType" type="xsd:string"/>
          <element name="metaLicenseOrder" type="xsd:string"/>
          <element name="metaLicenseData" type="xsd:base64Binary"/>
          <element name="metaEnvironmentType" type="xsd:string"/>
          <element name="metaEnvironmentData" type="xsd:base64Binary"/>
          <element name="metaSupressUserConfirmation" type="xsd:string"/>
         </sequence>
        </complexType>
       </element>
       <element name="addMediaObjectResponse">
        <complexType>
         <sequence>
          <element name="addMediaObjectReturn" type="xsd:int"/>
         </sequence>
        </complexType>
       </element>
    Any help will be appreciated.

    Thank you in advance.

  • #2
    It seems Axis can't handle the DataHandler type on client call.
    If I change remote operation parameter to byte[] instead of DataHandler, then the invocation throws no error, but the parameter comes null in server.

    Comment


    • #3
      The webservice being called is exposed as a JAX-RPC web service following Spring documentation in chapter 17.5: Exposing servlet-based web services using JAX-RPC
      http://static.springframework.org/sp.../remoting.html

      The operation signature has DataHandler values that are mapped as base64Binary types in the Axis WSDL document.

      I can invoke without any problem the method with SoapUI, including attachments that are mapped to the DataHandler types at server.

      The operation fails with the reported exception when being accesed through Spring, following Spring documentation in chapter 17.5: Accessing web services using JAX-RPC

      The remote interface I'm using is the same (with the DataHandler types) than the one exposed with the web service.
      I wonder if it is necessary to add any especial handler for the DataHandler in the client like Spring documentations says in chapter 17.5.3 for complex types. Registering JAX-RPC Bean Mappings.

      I've tried to generate an Axis client with WSDL2Java and the DataHandler types are mapped to byte[] types in the client. Being invoked through this client with the data passed as a byte array, the web service gets null values in the server.

      Could anyone help me with this, please?

      Comment

      Working...
      X