cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjay Gautam (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6197) Although the Parts classes are same PhaseInterceptorChain not able to recognize it that they are bother same object of same class type
Date Wed, 11 Feb 2015 05:13:12 GMT

    [ https://issues.apache.org/jira/browse/CXF-6197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14315580#comment-14315580
] 

Sanjay Gautam commented on CXF-6197:
------------------------------------

Thanks Daniel for looking into this code and details, I will be trying to provide a full Test
Case soon to you. having said that I did created some small example and things worked without
any issue though. but inside the JBPM the default code is not working. I will try to provide
more details to you . 

But it will be great if you can answer my a simple question related with WS Dynamic CXF clients

Lets say I have a 

https://github.com/droolsjbpm/jbpm/blob/master/jbpm-workitems/src/main/java/org/jbpm/process/workitem/webservice/WebServiceWorkItemHandler.java

If you look at this code you will see that the what this client is doing . 

It tries to create a DynamicCXF WS client using following details. 
1. wsdl URL 
2. Operation Name 
3. End Point Interface details
4. Parameters which are nothing but Operations method parameter objects. 

The Dynamic Dispatch CXF apis creates or compiles the generated proxy clients for SOAP service
and then does something. 

Object[] result = client.invoke(operationRef, parameters);

1. Lets say in end point there are two methods. 

a. getOrder(OrderDTO) in this case parameter is array of Object referencing OrderDTO passed
with populated
info. 	
b. getShipmentInfo(ShipmentDTO) in this case parameter is array of Object referencing ShipmentDTO
 passed with populated info. 

Questions 

a) Will the CXF will create a OrderDTO from the generated class and using reflection will
populate the information from the OrderDTO which is from my system ? 

b) Do you think that above class is correctly written , will this above class can be used
to call any web services with different Operations and with different number of Parameters.
in your examples I haven't seen such example or client like above URL 

Thanks 
Sanjay Gautam 






> Although the Parts classes are same PhaseInterceptorChain not able to recognize it that
they are bother same object of same class type
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-6197
>                 URL: https://issues.apache.org/jira/browse/CXF-6197
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding, Soap Binding
>    Affects Versions: 3.0.1, 2.7.14
>         Environment: JBPM 6.1.0.Final and CXF and wildfly 8.2.0 
>            Reporter: Sanjay Gautam
>             Fix For: NeedMoreInfo
>
>         Attachments: object-Item-Inspect.png, typeClass-debug-inspect.png
>
>
> JBPM using the call like this below 
> I don't see any issue with the client code and the cxf not able to figure out that that
two instance are same. 
> Cxf using the comparison method exactly at this place fails 
> ClientImpl.java 
>    private void checkPart(MessagePartInfo part, Object object) {
>         if (part == null || part.getTypeClass() == null || object == null) {
>             return;
>         }
>         Class<?> typeClass = part.getTypeClass();
>         if (typeClass == null) {
>             return;
>         }
>         if (typeClass.isPrimitive()) {
>             if (typeClass == Long.TYPE) {
>                 typeClass = Long.class;
>             } else if (typeClass == Integer.TYPE) {
>                 typeClass = Integer.class;
>             } else if (typeClass == Short.TYPE) {
>                 typeClass = Short.class;
>             } else if (typeClass == Byte.TYPE) {
>                 typeClass = Byte.class;
>             } else if (typeClass == Character.TYPE) {
>                 typeClass = Character.class;
>             } else if (typeClass == Double.TYPE) {
>                 typeClass = Double.class;
>             } else if (typeClass == Float.TYPE) {
>                 typeClass = Float.class;
>             } else if (typeClass == Boolean.TYPE) {
>                 typeClass = Boolean.class;
>             }
>         } else if (typeClass.isArray() && object instanceof Collection) {
>             //JAXB allows a pseudo [] <--> List equivalence
>             return;
>         }
>         if (!typeClass.isInstance(object)) {
>             throw new IllegalArgumentException("Part " + part.getName() + " should be
of type " 
>                 + typeClass.getName() + ", not " 
>                 + object.getClass().getName());
>         }
>     }
>  
> #######   CODE SNIPPETS  ########
>  public void executeWorkItem(WorkItem workItem, final WorkItemManager manager) {
>     	Object[] parameters = null;
>         String interfaceRef = (String) workItem.getParameter("Interface");
>         String operationRef = (String) workItem.getParameter("Operation");
>         String endpointAddress = (String) workItem.getParameter("Endpoint");
>         if ( workItem.getParameter("Parameter") instanceof Object[]) {
>         	parameters =  (Object[]) workItem.getParameter("Parameter");
>         } else if (workItem.getParameter("Parameter") != null && workItem.getParameter("Parameter").getClass().isArray())
{
>         	int length = Array.getLength(workItem.getParameter("Parameter"));
>             parameters = new Object[length];
>             for(int i = 0; i < length; i++) {
>             	parameters[i] = Array.get(workItem.getParameter("Parameter"), i);
>             }            
>         } else {
>         	parameters = new Object[]{ workItem.getParameter("Parameter")};
>         }
>         
>         String modeParam = (String) workItem.getParameter("Mode");
>         WSMode mode = WSMode.valueOf(modeParam == null ? "SYNC" : modeParam.toUpperCase());
>             
>         try {
>              Client client = getWSClient(workItem, interfaceRef);
>              if (client == null) {
>                  throw new IllegalStateException("Unable to create client for web service
" + interfaceRef + " - " + operationRef);
>              }
>              //Override endpoint address if configured.
>              if (endpointAddress != null && !"".equals(endpointAddress)) {
>             	 client.getRequestContext().put(Message.ENDPOINT_ADDRESS, endpointAddress)
;
>              }
>              
>              switch (mode) {
>                 case SYNC:
>                     Object[] result = client.invoke(operationRef, parameters);
>                     
>                     Map<String, Object> output = new HashMap<String, Object>();
         
>    
>                     if (result == null || result.length == 0) {
>                       output.put("Result", null);
>                     } else {
>                         output.put("Result", result[0]);
>                     }
>                     logger.debug("Received sync response {} completeing work item {}",
result, workItem.getId());
>                     manager.completeWorkItem(workItem.getId(), output);
>                     break;
> -------------------------------
>  protected synchronized Client getWSClient(WorkItem workItem, String interfaceRef) {
>         if (clients.containsKey(interfaceRef)) {
>             return clients.get(interfaceRef);
>         }
>         
>         String importLocation = (String) workItem.getParameter("Url");
>         String importNamespace = (String) workItem.getParameter("Namespace");
>         if (importLocation != null && importLocation.trim().length() > 0 
>         		&& importNamespace != null && importNamespace.trim().length()
> 0) {
>         	Client client = dcf.createClient(importLocation, new QName(importNamespace,
interfaceRef), getInternalClassLoader(), null);
>             clients.put(interfaceRef, client);
>             return client;
>         }
>         
>         
>         long processInstanceId = ((WorkItemImpl) workItem).getProcessInstanceId();
>         WorkflowProcessImpl process = ((WorkflowProcessImpl) ksession.getProcessInstance(processInstanceId).getProcess());
>         List<Bpmn2Import> typedImports = (List<Bpmn2Import>)process.getMetaData("Bpmn2Imports");
>         
>         if (typedImports != null ){
>             Client client = null;
>             for (Bpmn2Import importObj : typedImports) {
>                 if (WSDL_IMPORT_TYPE.equalsIgnoreCase(importObj.getType())) {
>                     try {
>                         client = dcf.createClient(importObj.getLocation(), new QName(importObj.getNamespace(),
interfaceRef), getInternalClassLoader(), null);
>                         clients.put(interfaceRef, client);
>                         return client;
>                     } catch (Exception e) {
>                     	logger.error("Error when creating WS Client", e);
>                         continue;
>                     }
>                 }
>             }
>         }
>         return null;
>     }
> XXXXXXXXXXXXXX  ERROR  XXXXXXXXXXXXXXXXXXXXXXXXX
> 19:16:26,899 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (default task-29) Interceptor
for {http://mdsoasis.caiso.com/}MdsOasisServiceService#{http://mdsoasis.caiso.com/}saveOrUpdateOasisNoti
> fication has thrown exception, unwinding now: java.lang.IllegalArgumentException: Part
{http://mdsoasis.caiso.com/}arg0 should be of type com.caiso.mdsoasis.OasisNotificationCtlDto,
not com.caiso.mdso
> asis.OasisNotificationCtlDto
>         at org.apache.cxf.jaxb.io.DataWriterImpl.checkPart(DataWriterImpl.java:277) [cxf-rt-databinding-jaxb-3.0.1.jar:3.0.1]
>         at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:209) [cxf-rt-databinding-jaxb-3.0.1.jar:3.0.1]
>         at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:121)
[cxf-core-3.0.1.jar:3.0.1]
>         at org.apache.cxf.binding.soap.interceptor.RPCOutInterceptor.handleMessage(RPCOutInterceptor.java:112)
[cxf-rt-bindings-soap-3.0.1.jar:3.0.1]
>         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
[cxf-core-3.0.1.jar:3.0.1]
>         at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514) [cxf-core-3.0.1.jar:3.0.1]
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423) [cxf-core-3.0.1.jar:3.0.1]
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326) [cxf-core-3.0.1.jar:3.0.1]
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279) [cxf-core-3.0.1.jar:3.0.1]
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299) [cxf-core-3.0.1.jar:3.0.1]
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:285) [cxf-core-3.0.1.jar:3.0.1]
>         at org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler.executeWorkItem(WebServiceWorkItemHandler.java:113)
[jbpm-workitems-6.1.0.Final.jar:6.1.0.Final]
>         at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:54)
[drools-persistence-jpa-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:133)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:313)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:61)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:57)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:369)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.node.SplitInstance.executeStrategy(SplitInstance.java:117)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:63)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:313)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:61)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:57)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:162)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:354)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:313)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:66)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]
>         at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:43)
[jbpm-flow-6.1.0.Final.jar:6.1.0.Final]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message