Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5110

Wrong processing of @XmlJavaTypeAdapter with RPC style endpoints

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      I've tried building a client for an endpoint whose interface is as follows:

      @WebService(targetNamespace = "http://www.jboss.org/wise/adapter/", name = "Endpoint")
      @XmlSeeAlso({ObjectFactory.class})
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public interface Endpoint {
      
          @WebResult(name = "mimepart", targetNamespace = "http://www.jboss.org/wise/adapter/", partName = "mimepart")
          @XmlJavaTypeAdapter(value = HexBinaryAdapter.class)
          @WebMethod
          public byte[] getData(
              @WebParam(partName = "dataQuery", mode = WebParam.Mode.INOUT, name = "dataQuery")
              javax.xml.ws.Holder<DataQuery> dataQuery
          );
      }
      

      and I'm getting the following exception:

      2013-07-04 16:39:10,209 WARN  [org.apache.cxf.phase.PhaseInterceptorChain] Interceptor for {http://www.jboss.org/wise/adapter/}EndpointService#{http://www.jboss.org/wise/adapter/}getData has thrown exception, unwinding now
      org.apache.cxf.interceptor.Fault: Marshalling Error: org.jboss.wise.adapter.DataQuery cannot be cast to [B
      	at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshalWithBridge(JAXBEncoderDecoder.java:298)
      	at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:174)
      	at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:121)
      	at org.apache.cxf.binding.soap.interceptor.RPCOutInterceptor.handleMessage(RPCOutInterceptor.java:90)
      	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
      	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
      	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
      	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
      	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
      	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
      	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
      	at com.sun.proxy.$Proxy46.getData(Unknown Source)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.wise.core.client.impl.reflection.EndpointMethodCaller.call(EndpointMethodCaller.java:73)
      	at org.jboss.wise.core.client.impl.reflection.EndpointMethodPreview.call(EndpointMethodPreview.java:61)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:722)
      Caused by: javax.xml.bind.MarshalException
       - with linked exception:
      [java.lang.ClassCastException: org.jboss.wise.adapter.DataQuery cannot be cast to [B]
      	at com.sun.xml.bind.v2.runtime.BridgeAdapter._adaptM(BridgeAdapter.java:122)
      	at com.sun.xml.bind.v2.runtime.BridgeAdapter.adaptM(BridgeAdapter.java:109)
      	at com.sun.xml.bind.v2.runtime.BridgeAdapter.marshal(BridgeAdapter.java:85)
      	at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:111)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:54)
      	at com.sun.proxy.$Proxy47.marshal(Unknown Source)
      	at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshalWithBridge(JAXBEncoderDecoder.java:280)
      	... 22 more
      Caused by: java.lang.ClassCastException: org.jboss.wise.adapter.DataQuery cannot be cast to [B
      	at javax.xml.bind.annotation.adapters.HexBinaryAdapter.marshal(HexBinaryAdapter.java:39)
      	at com.sun.xml.bind.v2.runtime.BridgeAdapter._adaptM(BridgeAdapter.java:119)
      	... 32 more
      

      The problem seems to be basically due to JAXBDataBase#getJAXBAnnotation(MessagePartInfo mpi) searching return annotations even for input messages.

      Attachments

        Activity

          People

            asoldano Alessio Soldano
            asoldano Alessio Soldano
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: