ServiceMix Components
  1. ServiceMix Components
  2. SMXCOMP-379

cxf bc provider should support exchange without specifing the operationName if portType only have one operation

    Details

      Activity

      Hide
      Freeman Fang added a comment -

      Hi Edell,

      Yes, if your porttype has more than one operation, specify the operationName is expected behavior

      Regards
      Freeman

      Show
      Freeman Fang added a comment - Hi Edell, Yes, if your porttype has more than one operation, specify the operationName is expected behavior Regards Freeman
      Hide
      Edell Nolan added a comment -

      hi,

      I have upgraded recently to a later snapshot and I am not getting the following error in my demo

      Using orderId [52]INFO - OrderProcessor - Received exchange: In
      Only[
      id: ID:10.5.2.186-11a0be12826-6:1
      status: Active
      role: provider
      endpoint: orderProcessor
      in: <?xml version="1.0" encoding="UTF-8"?><order-id>52</order-id>
      ]
      1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 23659716> executing prepstmnt 12155830 SELECT t0.
      statusId, t0.comments, t1.ORDER_ID, t1.customerId, t1.customerPoNumber, t1.order
      Date, t2.statusId, t2.comments, t2.ORDER_ID, t2.statusCode, t0.statusCode FROM O
      rderStatus t0 LEFT OUTER JOIN Ord t1 ON t0.ORDER_ID = t1.ORDER_ID LEFT OUTER JOI
      N OrderStatus t2 ON t1.orderStatus_statusId = t2.statusId WHERE (t0.ORDER_ID = ?
      ) [params=(long) 52]
      1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 23659716> [0 ms] spent
      1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 13619513> executing prepstmnt 19827612 UPDATE Ord
      erStatus SET comments = ?, statusCode = ?, ORDER_ID = ? WHERE statusId = ? [para
      ms=(String) Thank you for your order! Your order# is 52, (short) 0, (long) 52,
      (long) 102]
      1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 13619513> [0 ms] spent
      1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 13619513> executing prepstmnt 27111789 UPDATE Ord
      SET customerId = ? WHERE ORDER_ID = ? [params=(long) 12345, (long) 51]
      1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 13619513> [0 ms] spent
      1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 13619513> executing prepstmnt 32098716 UPDATE Ord
      erStatus SET statusCode = ? WHERE statusId = ? [params=(short) 1, (long) 101]
      1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 13619513> [0 ms] spent
      1975804 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 13619513> executing prepstmnt 11029186 UPDATE Ord
      SET customerId = ?, customerPoNumber = ?, orderDate = ?, orderStatus_statusId =
      ? WHERE ORDER_ID = ? [params=(long) 12345, (String) 6666, (null) null, (null) n
      ull, (long) 52]
      1975804 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 13619513> [0 ms] spent
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 21056658> executing prepstmnt 14194056 SELECT t0.
      statusId, t0.comments, t1.ORDER_ID, t1.customerId, t1.customerPoNumber, t1.order
      Date, t2.statusId, t2.comments, t2.ORDER_ID, t2.statusCode, t0.statusCode FROM O
      rderStatus t0 LEFT OUTER JOIN Ord t1 ON t0.ORDER_ID = t1.ORDER_ID LEFT OUTER JOI
      N OrderStatus t2 ON t1.orderStatus_statusId = t2.statusId WHERE (t0.ORDER_ID = ?
      ) [params=(long) 52]
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 21056658> [0 ms] spent
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 24726433> executing prepstmnt 6867282 UPDATE Orde
      rStatus SET statusCode = ? WHERE statusId = ? [params=(short) 1, (long) 102]
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 24726433> [0 ms] spent
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 24726433> executing prepstmnt 18081991 UPDATE Ord
      SET customerId = ? WHERE ORDER_ID = ? [params=(long) 12345, (long) 51]
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 24726433> [0 ms] spent
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 24726433> executing prepstmnt 14682501 UPDATE Ord
      erStatus SET statusCode = ? WHERE statusId = ? [params=(short) 1, (long) 101]
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 24726433> [0 ms] spent
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 24726433> executing prepstmnt 30653307 UPDATE Ord
      SET customerId = ? WHERE ORDER_ID = ? [params=(long) 12345, (long) 52]
      1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj
      pa.jdbc.SQL - <t 3927410, conn 24726433> [0 ms] spent
      ERROR - CxfSeComponent - Error processing exchange InOnly[
      id: ID:10.5.2.186-11a0be12826-6:1
      status: Done
      role: consumer
      endpoint: orderProcessor
      in: <?xml version="1.0" encoding="UTF-8"?><order-id>52</order-id>
      ]
      org.apache.cxf.interceptor.Fault: Operation not bound on this MessageExchange
      at org.apache.servicemix.cxfse.CxfSeEndpoint.process(CxfSeEndpoint.java:
      204)
      at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
      feCycle.java:538)
      at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
      BaseLifeCycle.java:512)
      at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
      Cycle.java:46)
      at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
      d(DeliveryChannelImpl.java:610)
      at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
      w.java:172)
      at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
      ava:167)
      at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
      a:134)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
      utor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
      .java:675)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.Exception: Operation not bound on this MessageExchange
      ... 11 more
      ERROR - CxfSeComponent - Error setting exchange status to ERROR
      javax.jbi.messaging.MessagingException: illegal call to send / sendSync
      at org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(Me
      ssageExchangeImpl.java:614)
      at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(Delive
      ryChannelImpl.java:385)
      at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(Delivery
      ChannelImpl.java:431)
      at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
      Cycle.java:58)
      at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
      d(DeliveryChannelImpl.java:610)
      at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
      w.java:172)
      at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
      ava:167)
      at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
      a:134)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
      utor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
      .java:675)
      at java.lang.Thread.run(Thread.java:595)
      21-May-2008 16:05:20 org.apache.cxf.transport.jbi.JBITransportFactory setDeliver
      yChannel
      INFO: configuring DeliveryChannel: org.apache.servicemix.common.EndpointDel
      iveryChannel@316b47

      Freeman - are you expecting that there will always be an operationName set in the Exchange.

      My demo was working before I upgraded. My PortType has two operations in it.

      thanks, Edell.

      Show
      Edell Nolan added a comment - hi, I have upgraded recently to a later snapshot and I am not getting the following error in my demo Using orderId [52] INFO - OrderProcessor - Received exchange: In Only[ id: ID:10.5.2.186-11a0be12826-6:1 status: Active role: provider endpoint: orderProcessor in: <?xml version="1.0" encoding="UTF-8"?><order-id>52</order-id> ] 1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 23659716> executing prepstmnt 12155830 SELECT t0. statusId, t0.comments, t1.ORDER_ID, t1.customerId, t1.customerPoNumber, t1.order Date, t2.statusId, t2.comments, t2.ORDER_ID, t2.statusCode, t0.statusCode FROM O rderStatus t0 LEFT OUTER JOIN Ord t1 ON t0.ORDER_ID = t1.ORDER_ID LEFT OUTER JOI N OrderStatus t2 ON t1.orderStatus_statusId = t2.statusId WHERE (t0.ORDER_ID = ? ) [params=(long) 52] 1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 23659716> [0 ms] spent 1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 13619513> executing prepstmnt 19827612 UPDATE Ord erStatus SET comments = ?, statusCode = ?, ORDER_ID = ? WHERE statusId = ? [para ms=(String) Thank you for your order! Your order# is 52, (short) 0, (long) 52, (long) 102] 1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 13619513> [0 ms] spent 1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 13619513> executing prepstmnt 27111789 UPDATE Ord SET customerId = ? WHERE ORDER_ID = ? [params=(long) 12345, (long) 51] 1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 13619513> [0 ms] spent 1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 13619513> executing prepstmnt 32098716 UPDATE Ord erStatus SET statusCode = ? WHERE statusId = ? [params=(short) 1, (long) 101] 1975788 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 13619513> [0 ms] spent 1975804 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 13619513> executing prepstmnt 11029186 UPDATE Ord SET customerId = ?, customerPoNumber = ?, orderDate = ?, orderStatus_statusId = ? WHERE ORDER_ID = ? [params=(long) 12345, (String) 6666, (null) null, (null) n ull, (long) 52] 1975804 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 13619513> [0 ms] spent 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 21056658> executing prepstmnt 14194056 SELECT t0. statusId, t0.comments, t1.ORDER_ID, t1.customerId, t1.customerPoNumber, t1.order Date, t2.statusId, t2.comments, t2.ORDER_ID, t2.statusCode, t0.statusCode FROM O rderStatus t0 LEFT OUTER JOIN Ord t1 ON t0.ORDER_ID = t1.ORDER_ID LEFT OUTER JOI N OrderStatus t2 ON t1.orderStatus_statusId = t2.statusId WHERE (t0.ORDER_ID = ? ) [params=(long) 52] 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 21056658> [0 ms] spent 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 24726433> executing prepstmnt 6867282 UPDATE Orde rStatus SET statusCode = ? WHERE statusId = ? [params=(short) 1, (long) 102] 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 24726433> [0 ms] spent 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 24726433> executing prepstmnt 18081991 UPDATE Ord SET customerId = ? WHERE ORDER_ID = ? [params=(long) 12345, (long) 51] 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 24726433> [0 ms] spent 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 24726433> executing prepstmnt 14682501 UPDATE Ord erStatus SET statusCode = ? WHERE statusId = ? [params=(short) 1, (long) 101] 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 24726433> [0 ms] spent 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 24726433> executing prepstmnt 30653307 UPDATE Ord SET customerId = ? WHERE ORDER_ID = ? [params=(long) 12345, (long) 52] 1975897 order-processor TRACE [pool-flow.seda.servicemix-bean-thread-3] openj pa.jdbc.SQL - <t 3927410, conn 24726433> [0 ms] spent ERROR - CxfSeComponent - Error processing exchange InOnly[ id: ID:10.5.2.186-11a0be12826-6:1 status: Done role: consumer endpoint: orderProcessor in: <?xml version="1.0" encoding="UTF-8"?><order-id>52</order-id> ] org.apache.cxf.interceptor.Fault: Operation not bound on this MessageExchange at org.apache.servicemix.cxfse.CxfSeEndpoint.process(CxfSeEndpoint.java: 204) at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi feCycle.java:538) at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async BaseLifeCycle.java:512) at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife Cycle.java:46) at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun d(DeliveryChannelImpl.java:610) at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo w.java:172) at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j ava:167) at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav a:134) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec utor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:675) at java.lang.Thread.run(Thread.java:595) Caused by: java.lang.Exception: Operation not bound on this MessageExchange ... 11 more ERROR - CxfSeComponent - Error setting exchange status to ERROR javax.jbi.messaging.MessagingException: illegal call to send / sendSync at org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(Me ssageExchangeImpl.java:614) at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(Delive ryChannelImpl.java:385) at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(Delivery ChannelImpl.java:431) at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife Cycle.java:58) at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun d(DeliveryChannelImpl.java:610) at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo w.java:172) at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j ava:167) at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav a:134) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec utor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:675) at java.lang.Thread.run(Thread.java:595) 21-May-2008 16:05:20 org.apache.cxf.transport.jbi.JBITransportFactory setDeliver yChannel INFO: configuring DeliveryChannel: org.apache.servicemix.common.EndpointDel iveryChannel@316b47 Freeman - are you expecting that there will always be an operationName set in the Exchange. My demo was working before I upgraded. My PortType has two operations in it. thanks, Edell.
      Hide
      Ron Gavlin added a comment -

      Hi Freeman,

      Very nice fix.

      Thanks much!

      • Ron
      Show
      Ron Gavlin added a comment - Hi Freeman, Very nice fix. Thanks much! Ron
      Show
      Freeman Fang added a comment - commit fix http://svn.apache.org/viewvc?rev=656501&view=rev for trunk http://svn.apache.org/viewvc?rev=656503&view=rev for 3.2 branch
      Hide
      Ron Gavlin added a comment -

      In the case an operation is not supplied and more than one operation exists for the interface/port, it would be helpful if a meaningful exception like "An operation is required" were thrown rather than a NPE.

      Show
      Ron Gavlin added a comment - In the case an operation is not supplied and more than one operation exists for the interface/port, it would be helpful if a meaningful exception like "An operation is required" were thrown rather than a NPE.
      Hide
      Ron Gavlin added a comment -

      It appears to me that the following change to CxfBcMessageObserver.onMessage is also required to implement this feature in CXF BC Provider. Without this patch, a NPE is generated if the operation is omitted from the incoming messageExchange.

      CxfBcMessageObserver
      ...
      public void onMessage(Message message) {
      try {

      if (messageExchange.getStatus() != ExchangeStatus.ACTIVE)

      { return; }

      contentType = (String) message.get(Message.CONTENT_TYPE);
      SoapMessage soapMessage = new SoapMessage(message);



      // create XmlStreamReader
      EndpointInfo ei = providerEndpoint.getEndpointInfo();
      QName opeName = messageExchange.getOperation();


      BindingOperationInfo boi = null;
      if (opeName == null) { // if interface only have one operation, may not specify the opeName in MessageExchange boi = ei.getBinding().getOperations().iterator().next(); } else { boi = ei.getBinding().getOperation(opeName); }

      if (boi.getOperationInfo().isOneWay()) { return; }

      contentType = (String) message.get(Message.CONTENT_TYPE);
      SoapMessage soapMessage =
      (SoapMessage) this.providerEndpoint.getCxfEndpoint().getBinding().createMessage(message);

      ...

      Also, this feature should be implemented in servicemix-cxf-se as well.

      Show
      Ron Gavlin added a comment - It appears to me that the following change to CxfBcMessageObserver.onMessage is also required to implement this feature in CXF BC Provider. Without this patch, a NPE is generated if the operation is omitted from the incoming messageExchange. CxfBcMessageObserver ... public void onMessage(Message message) { try { if (messageExchange.getStatus() != ExchangeStatus.ACTIVE) { return; } contentType = (String) message.get(Message.CONTENT_TYPE); SoapMessage soapMessage = new SoapMessage(message); // create XmlStreamReader EndpointInfo ei = providerEndpoint.getEndpointInfo(); QName opeName = messageExchange.getOperation(); BindingOperationInfo boi = null; if (opeName == null) { // if interface only have one operation, may not specify the opeName in MessageExchange boi = ei.getBinding().getOperations().iterator().next(); } else { boi = ei.getBinding().getOperation(opeName); } if (boi.getOperationInfo().isOneWay()) { return; } contentType = (String) message.get(Message.CONTENT_TYPE); SoapMessage soapMessage = (SoapMessage) this.providerEndpoint.getCxfEndpoint().getBinding().createMessage(message); ... Also, this feature should be implemented in servicemix-cxf-se as well.
      Hide
      Freeman Fang added a comment -
      Show
      Freeman Fang added a comment - commit fix http://svn.apache.org/viewvc?rev=627657&view=rev for 3.3 branch http://svn.apache.org/viewvc?rev=627660&view=rev for 3.2.2 branch

        People

        • Assignee:
          Freeman Fang
          Reporter:
          Freeman Fang
        • Votes:
          0 Vote for this issue
          Watchers:
          3 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development