CXF
  1. CXF
  2. CXF-3812

Problem with DynamicClient failing to invoke service now webservice

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not a Problem
    • Affects Version/s: 2.4.2
    • Fix Version/s: Invalid
    • Labels:
      None
    • Environment:

      CXF 2.4.2 on Max OS X 10.6.8

      java version "1.6.0_26"
      Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
      Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)

    • Estimated Complexity:
      Unknown

      Description

      Using CXF dynamic client with CXF service model fails to invoke the ServiceNow public demo web service. It throws a ClassCastException. Attaching a sample project that has test case that shows this problem. Appreciate if you could advice on this behavior. I tried debugging, but it looks like the wrapper helpers (com.service_now.incident.GetRecords_WrapperTypeHelper1) are created on the fly and could not step through.

      Sep 20, 2011 9:47:28 AM org.apache.cxf.jaxb.JAXBUtils logGeneratedClassNames
      INFO: Created classes: com.service_now.incident.DeleteMultiple, com.service_now.incident.DeleteMultipleResponse, com.service_now.incident.DeleteRecord, com.service_now.incident.DeleteRecordResponse, com.service_now.incident.Get, com.service_now.incident.GetKeys, com.service_now.incident.GetKeysResponse, com.service_now.incident.GetRecords, com.service_now.incident.GetRecordsResponse, com.service_now.incident.GetResponse, com.service_now.incident.Insert, com.service_now.incident.InsertResponse, com.service_now.incident.ObjectFactory, com.service_now.incident.Update, com.service_now.incident.UpdateResponse
      com.service_now.incident.GetRecords
      Sep 20, 2011 9:47:29 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
      WARNING: Interceptor for

      {http://www.service-now.com}

      ServiceNow_incident#

      {http://www.service-now.com}

      getRecords has thrown exception, unwinding now
      org.apache.cxf.interceptor.Fault: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
      at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:121)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
      at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
      at ServiceNowTest.testCXFModelClient(ServiceNowTest.java:59)
      at ServiceNowTest.main(ServiceNowTest.java:23)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      Caused by: java.lang.ClassCastException: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
      at com.service_now.incident.GetRecords_WrapperTypeHelper1.createWrapperObject(Unknown Source)
      at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
      ... 13 more
      Exception in thread "main" org.apache.cxf.interceptor.Fault: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
      at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:121)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
      at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
      at ServiceNowTest.testCXFModelClient(ServiceNowTest.java:59)
      at ServiceNowTest.main(ServiceNowTest.java:23)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      Caused by: java.lang.ClassCastException: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
      at com.service_now.incident.GetRecords_WrapperTypeHelper1.createWrapperObject(Unknown Source)
      at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
      ... 13 more

      1. servicenow-cxf.zip
        59 kB
        Arul Dhesiaseelan

        Activity

        Arul Dhesiaseelan created issue -
        Arul Dhesiaseelan made changes -
        Field Original Value New Value
        Attachment servicenow-cxf.zip [ 12495234 ]
        Hide
        Arul Dhesiaseelan added a comment -

        Some more details on the test case, the web service is protected with HTTP basic auth and the credentials are set on the request context.
        The WSDL2Java artifacts are generated using CXF tool using the following command:
        ./wsdl2java -d tmp -fe jaxws21 incident.wsdl

        enableWrapperStyle jaxws binding property is set to false in the WSDL.

        Show
        Arul Dhesiaseelan added a comment - Some more details on the test case, the web service is protected with HTTP basic auth and the credentials are set on the request context. The WSDL2Java artifacts are generated using CXF tool using the following command: ./wsdl2java -d tmp -fe jaxws21 incident.wsdl enableWrapperStyle jaxws binding property is set to false in the WSDL.
        Arul Dhesiaseelan made changes -
        Description Using CXF dynamic client with CXF service model fails to invoke the ServiceNow public demo web service. It throws a ClassCastException. Attaching a sample project that has test case that shows this problem. Appreciate if you could advice on this behavior. I tried debugging, but it looks like the wrapper helpers are created on the fly and could not step through.

        Sep 20, 2011 9:47:28 AM org.apache.cxf.jaxb.JAXBUtils logGeneratedClassNames
        INFO: Created classes: com.service_now.incident.DeleteMultiple, com.service_now.incident.DeleteMultipleResponse, com.service_now.incident.DeleteRecord, com.service_now.incident.DeleteRecordResponse, com.service_now.incident.Get, com.service_now.incident.GetKeys, com.service_now.incident.GetKeysResponse, com.service_now.incident.GetRecords, com.service_now.incident.GetRecordsResponse, com.service_now.incident.GetResponse, com.service_now.incident.Insert, com.service_now.incident.InsertResponse, com.service_now.incident.ObjectFactory, com.service_now.incident.Update, com.service_now.incident.UpdateResponse
        com.service_now.incident.GetRecords
        Sep 20, 2011 9:47:29 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
        WARNING: Interceptor for {http://www.service-now.com}ServiceNow_incident#{http://www.service-now.com}getRecords has thrown exception, unwinding now
        org.apache.cxf.interceptor.Fault: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
        at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:121)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
        at ServiceNowTest.testCXFModelClient(ServiceNowTest.java:59)
        at ServiceNowTest.main(ServiceNowTest.java:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
        Caused by: java.lang.ClassCastException: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
        at com.service_now.incident.GetRecords_WrapperTypeHelper1.createWrapperObject(Unknown Source)
        at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
        ... 13 more
        Exception in thread "main" org.apache.cxf.interceptor.Fault: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
        at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:121)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
        at ServiceNowTest.testCXFModelClient(ServiceNowTest.java:59)
        at ServiceNowTest.main(ServiceNowTest.java:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
        Caused by: java.lang.ClassCastException: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
        at com.service_now.incident.GetRecords_WrapperTypeHelper1.createWrapperObject(Unknown Source)
        at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
        ... 13 more
        Using CXF dynamic client with CXF service model fails to invoke the ServiceNow public demo web service. It throws a ClassCastException. Attaching a sample project that has test case that shows this problem. Appreciate if you could advice on this behavior. I tried debugging, but it looks like the wrapper helpers (com.service_now.incident.GetRecords_WrapperTypeHelper1) are created on the fly and could not step through.

        Sep 20, 2011 9:47:28 AM org.apache.cxf.jaxb.JAXBUtils logGeneratedClassNames
        INFO: Created classes: com.service_now.incident.DeleteMultiple, com.service_now.incident.DeleteMultipleResponse, com.service_now.incident.DeleteRecord, com.service_now.incident.DeleteRecordResponse, com.service_now.incident.Get, com.service_now.incident.GetKeys, com.service_now.incident.GetKeysResponse, com.service_now.incident.GetRecords, com.service_now.incident.GetRecordsResponse, com.service_now.incident.GetResponse, com.service_now.incident.Insert, com.service_now.incident.InsertResponse, com.service_now.incident.ObjectFactory, com.service_now.incident.Update, com.service_now.incident.UpdateResponse
        com.service_now.incident.GetRecords
        Sep 20, 2011 9:47:29 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
        WARNING: Interceptor for {http://www.service-now.com}ServiceNow_incident#{http://www.service-now.com}getRecords has thrown exception, unwinding now
        org.apache.cxf.interceptor.Fault: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
        at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:121)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
        at ServiceNowTest.testCXFModelClient(ServiceNowTest.java:59)
        at ServiceNowTest.main(ServiceNowTest.java:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
        Caused by: java.lang.ClassCastException: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
        at com.service_now.incident.GetRecords_WrapperTypeHelper1.createWrapperObject(Unknown Source)
        at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
        ... 13 more
        Exception in thread "main" org.apache.cxf.interceptor.Fault: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
        at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:121)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
        at ServiceNowTest.testCXFModelClient(ServiceNowTest.java:59)
        at ServiceNowTest.main(ServiceNowTest.java:23)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
        Caused by: java.lang.ClassCastException: com.service_now.incident.GetRecords cannot be cast to java.lang.Boolean
        at com.service_now.incident.GetRecords_WrapperTypeHelper1.createWrapperObject(Unknown Source)
        at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
        ... 13 more
        Hide
        Daniel Kulp added a comment -

        This is more or less working as designed. If you use the "invoke" method that takes the QName, the parameters that are passed in are assumed to represent the "unwrapped" form of the operation. Thus, you have a couple options:

        1) if you call boi.getUnwrappedOperation(), you can get a new boi that has the parameters in that form.

        2) call client.invoke(boi, params) instead. When you do that, it uses the exact boi that you were using to setup the params.

        Show
        Daniel Kulp added a comment - This is more or less working as designed. If you use the "invoke" method that takes the QName, the parameters that are passed in are assumed to represent the "unwrapped" form of the operation. Thus, you have a couple options: 1) if you call boi.getUnwrappedOperation(), you can get a new boi that has the parameters in that form. 2) call client.invoke(boi, params) instead. When you do that, it uses the exact boi that you were using to setup the params.
        Daniel Kulp made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Daniel Kulp [ dkulp ]
        Fix Version/s Invalid [ 12312706 ]
        Resolution Not A Problem [ 8 ]
        Daniel Kulp made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Daniel Kulp
            Reporter:
            Arul Dhesiaseelan
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development