WS-Notification subscriptions work on 3.3.2 but not on 4.2.0
------------------------------------------------------------

                 Key: SM-2033
                 URL: https://issues.apache.org/jira/browse/SM-2033
             Project: ServiceMix
          Issue Type: Bug
         Environment: Windows 7 + Cygwin
            Reporter: Matthieu Cormier
             Fix For: 4.0


In order to explain this issue I will first go through how service mix behaves 
correctly in 3.3.2 and then explain how it works incorrectly in 4.2.0.

1. To see publishing working you need a simple echo server.  An echo server is 
a simple server that listens on a port and prints what it receives to standard 
output.  This is very useful when establishing the behaviour of a server.  For 
this example we will run the echo server on port 4444. (see file X)

2. There is a documented issue in 3.3.2 with regard to WS-Notification.  Jira 
SM-1783 (https://issues.apache.org/jira/browse/SM-1783).  This issue is 
documented as fixed in the yet to be released 3.4.  If you are testing with 
3.3.2 then you must patch the file FragmentStreamReader.class which is located 
in servicemix-utils.jar.  

3.  Once you have the echo server running and the servicemix-utils.jar patched 
you are ready to run the server.  Run the server located in 
examples\wsn-http-binding using  ..\..\bin\servicemix servicemix.xml or some 
derivative.

4.  Once servicemix has started execute the following soap requests.  

-- Subscribe Soap Message -- 

<env:Envelope
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";
    xmlns:wsa="http://www.w3.org/2005/08/addressing";>
<env:Header>
<wsa:ReplyTo>
      <wsa:Address>http://localhost:4444</wsa:Address>
 </wsa:ReplyTo>
 <wsa:From>
      <wsa:Address>http://localhost:4444</wsa:Address>
 </wsa:From>
</env:Header>
  <env:Body>
    <wsnt:Subscribe
      xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2";
      xmlns:ncex="http://www.consumer.org";
      xmlns:npex="http://www.producer.org";>
      <wsnt:ConsumerReference>
        <wsa:Address>
          http://localhost:4444
        </wsa:Address>
      </wsnt:ConsumerReference>
      <wsnt:Filter>
        <wsnt:TopicExpression
            Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple";>
          BrewProcess
        </wsnt:TopicExpression>
      </wsnt:Filter>
    </wsnt:Subscribe>
  </env:Body>
</env:Envelope>

-- End Subscribe Soap Message -- 

This request will subscribe the echo server to any messages sent to the topic 
BrewProcess.  Then the following Soap request which will publish information to 
the BrewProcess Topic.  ServiceMix will see that there is a subscriber to that 
topic and relay that message to localhost:4444 as defined in the subscription 
request above.  The echo server will be listening on port 4444 and will receive 
and print out the message.

-- Notify Soap Message -- 

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";
 xmlns:wsa="http://www.w3.org/2005/08/addressing";>
<env:Header>
</env:Header>
<env:Body>
<wsnt:Notify xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2";>
<wsnt:NotificationMessage>
<wsnt:Topic Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple";>
BrewProcess
</wsnt:Topic>
<wsnt:Message>
<alarm:Alarm xmlns:alarm="http://alarms.some-host";>
<Name>Kettle Overfill</Name>
<Desc>Kettle Overfill Alarm</Desc>
<Date>2007-09-22-12:00:30:100</Date>
<Severity>3</Severity>
<Value>110.2</Value>
<Ack>false</Ack>
</alarm:Alarm>
</wsnt:Message>
</wsnt:NotificationMessage>
</wsnt:Notify>
</env:Body>
</env:Envelope>

-- End Notify Soap Message -- 

This is how things work in 3.3.2.  When using 4.2.0 the following happens.
1. You still need an echo server running
2. Patching servicemix-utils.jar is not necessary in 4.2.0
3. Copy the file 
apache-servicemix-3.3.2/examples/wsn-http-binding/hotdeploy/soap-demo-sa.zip
  to apache-servicemix-4.2.0/deploy/soap-demo-sa.zip
4. Start servicemix 4.2.0

5. Send the subscribe message as above which subscribes localhost:4444 to the 
topic BrewProcess.  You should see the following in the log that shows that the 
subscription was sucessful.

11:22:06,475 | INFO  | wsn2005-thread-2 | ManagementEndpointRegistry       | 
ement.ManagementEndpointRegistry
  56 | Registering endpoint: 
org.apache.servicemix.nmr.core.internalendpointwrap...@d6efc021 with properties 
{
jbi.internal=true, WSDL_URL=document:4, 
NAME={http://servicemix.org/wsnotification}Subscription:ID-192-168-0-1
79-12d51987db7-2-0, 
INTERFACE_NAME={http://docs.oasis-open.org/wsn/bw-2}PausableSubscriptionManager,
 service.i
d=270, objectClass=[Ljava.lang.String;@8bbb40, 
ENDPOINT_NAME=ID-192-168-0-179-12d51987db7-2-0, SERVICE_NAME={h
ttp://servicemix.org/wsnotification}Subscription}

6.  Send the notify message as above.  The message is not received by the echo 
server and the following appears in the log file.


11:26:24,041 | WARN  | eMQ Session Task | NMR                              | 
.servicemix.nmr.core.ChannelImpl
 293 | Error processing exchange [
  id:        9a4e64b1-3a2d-4af3-baea-944b884bdda4
  mep:       InOnly
  status:    Active
  role:      Consumer
  target:    PropertyMatchingReference[{ENDPOINT_NAME=http://localhost:4444, 
SERVICE_NAME={urn:servicemix:http
}HttpComponent}]
  properties: [
      org.apache.servicemix.senderEndpoint = 
{http://servicemix.org/wsnotification}Subscription:ID-192-168-0-1
79-12d51987db7-2-0
      javax.jbi.messaging.MessageExchange = 
org.apache.servicemix.jbi.runtime.impl.inonlyi...@aafcb8
      javax.jbi.messaging.sendSync = <null>
      javax.jbi.transaction.jta = <null>
      javax.jbi.ServiceEndpoint = 
org.apache.servicemix.common.resolvedendpo...@1b5abf7
      org.apache.servicemix.correlationId = 9a4e64b1-3a2d-4af3-baea-944b884bdda4
  ]
  In: [
    content: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify 
xmlns:ns2="http://docs.oasis-open.org/wsn/b-2";
xmlns="http://www.w3.org/2005/08/addressing"; 
xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"; xmlns:ns4="http:
//docs.oasis-open.org/wsrf/rp-2" 
xmlns:ns5="http://docs.oasis-open.org/wsn/t-1";><ns2:NotificationMessage><ns2:
Topic Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple";>
BrewProcess
</ns2:Topic><ns2:Message><alarm:Alarm xmlns:alarm="http://alarms.some-host"; 
xmlns:env="http://schemas.xmlsoap.
org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing"; 
xmlns:wsnt="http://docs.oasis-open.org/ws
n/b-2"><Name xmlns="" xmlns:ns10="http://www.w3.org/2005/08/addressing";>Kettle 
Overfill</Name><Desc xmlns="" x
mlns:ns10="http://www.w3.org/2005/08/addressing";>Kettle Overfill 
Alarm</Desc><Date xmlns="" xmlns:ns10="http:/
/www.w3.org/2005/08/addressing">2007-09-22-12:00:30:100</Date><Severity 
xmlns="" xmlns:ns10="http://www.w3.org
/2005/08/addressing">3</Severity><Value xmlns="" 
xmlns:ns10="http://www.w3.org/2005/08/addressing";>110.2</Valu
e><Ack xmlns="" xmlns:ns10="http://www.w3.org/2005/08/addressing";>false</Ack>
</alarm:Alarm></ns2:Message></ns2:NotificationMessage></ns2:Notify>
  ]
]

org.apache.servicemix.nmr.api.ServiceMixException: Could not dispatch exchange. 
No matching endpoints.
        at 
org.apache.servicemix.nmr.core.FlowRegistryImpl.dispatch(FlowRegistryImpl.java:110)
        at 
org.apache.servicemix.nmr.core.ChannelImpl.dispatch(ChannelImpl.java:286)
        at org.apache.servicemix.nmr.core.ChannelImpl.send(ChannelImpl.java:117)
        at 
org.apache.servicemix.jbi.runtime.impl.DeliveryChannelImpl.send(DeliveryChannelImpl.java:178)
        at 
org.apache.servicemix.common.EndpointDeliveryChannel.send(EndpointDeliveryChannel.java:89)
        at 
org.apache.servicemix.wsn.jbi.JbiSubscription.doNotify(JbiSubscription.java:137)
        at 
org.apache.servicemix.wsn.jms.JmsSubscription.onMessage(JmsSubscription.java:193)
        at 
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1088)
        at 
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:127)
        at 
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:197)
        at 
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
        at 
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)
11:26:24,044 | WARN  | eMQ Session Task | JmsSubscription                  | 
rvicemix.wsn.jms.JmsSubscription
 197 | Error notifying consumer
org.apache.servicemix.nmr.api.ServiceMixException: Could not dispatch exchange. 
No matching endpoints.
        at 
org.apache.servicemix.nmr.core.FlowRegistryImpl.dispatch(FlowRegistryImpl.java:110)
        at 
org.apache.servicemix.nmr.core.ChannelImpl.dispatch(ChannelImpl.java:286)
        at org.apache.servicemix.nmr.core.ChannelImpl.send(ChannelImpl.java:117)
        at 
org.apache.servicemix.jbi.runtime.impl.DeliveryChannelImpl.send(DeliveryChannelImpl.java:178)
        at 
org.apache.servicemix.common.EndpointDeliveryChannel.send(EndpointDeliveryChannel.java:89)
        at 
org.apache.servicemix.wsn.jbi.JbiSubscription.doNotify(JbiSubscription.java:137)
        at 
org.apache.servicemix.wsn.jms.JmsSubscription.onMessage(JmsSubscription.java:193)
        at 
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1088)
        at 
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:127)
        at 
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:197)
        at 
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
        at 
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)






-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to