You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Matthieu Cormier <Ma...@concertia.com> on 2010/12/16 20:49:50 UTC

WS-Notification

Hello all,

I've been experimenting with the WS-Notification support in servicemix 3.3.2 and am now testing it in 4.2.0.  

This begs the question, how stable is 4.2.0?  I've stuck with 3.3.2 thus far because the wsn-http-biding example is not part of the examples provided in 4.2.0 distribution.  Here is what I've found so far:

You have to patch 3.3.2 to get the wsn-http-binding to work
https://issues.apache.org/jira/browse/SM-1783
The simplest way to do this is to grab the class FragmentStreamReader.class out of the servicemix-utils jar file in 4.2.0 and put it in the servicemix-utils, or you could more prudently compile the version attached to the JIRA issue.

PullPoint(i.e. Queue)
After this was done I successfully created a pullpoint, sent notify messages to that pullpoint and got the messages back with a getmessages call.  

Subscription(i.e. Topic)
I also created a subscription to a topic by subscribing a simple echo server on localhost:4444.  It simply echos whatever is sent to it and sends back HTTP OK 200.
I then sent a notify message to that topic (no <wsa:To> field specified in the header) and received the message from the echo server.

The creation of subscriptions and pullpoints works great in 3.3.2 but tearing them down is more difficult.  

Unsubscribing
-----------------
  When creating a subscription it returns an address like the one below in the response
<ns2:Address>http://servicemix.org/wsnotification/Subscription/ID-192-168-0-164-12cf0719623-0-1</ns2:Address>
This is an internal endpoint address and cannot be accessed externally.  It has been previously mentioned on the mailing list that to perform an unsubscribe you must send  <wsnt:Unsubscribe/> to that internal endpoint.  I modified the wsdl-first example to use the personId to perform the unsubscribe operation.

Here sample code to perform the unsubscribe operation inside a POJO.
----------------------------------------------------------------------------
      ServiceMixClient client = new ServiceMixClientFacade(this.context);
      Destination destination = client.createDestination("service:http://servicemix.org/wsnotification/Subscription");

      InOut exchange = destination.createInOutExchange();

      NormalizedMessage message = exchange.getInMessage();
      message.setProperty("endpoint", subId);
      message.setContent(new StreamSource(new StringReader( "<wsnt:Unsubscribe xmlns:wsnt=\"http://docs.oasis-open.org/wsn/b-2\"/>") ));

      client.sendSync(exchange);
----------------------------------------------------------------------------

DestroyPullPoint
----------------
To Destroy a pullpoint the following xml must be sent.

<wsnt:DestroyPullPoint 
  xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
  xmlns:sm="http://servicemix.apache.org/wsn2005/1.0">
<sm:address> 
    http://www.consumer.org/service/endpoint
  </sm:address>
</wsnt:DestroyPullPoint>

This is where I get confused.  The two wsn-http bindings (CreatePullPoint and NotificationBroker) display the following operations when accessed with SOAPUI 
- CreatePullPoint
- GetCurrentMessage
- Notify
- RegisterPublisher
- Subscribe

Athough neither binding states in it's wsdl that it accepts DestroyPullPoint both endpoints (http://localhost:8192/CreatePullPoint and http://localhost:8192/NotificationBroker) accept a DestroyPullPoint request.  How does this work?

In 4.2.0 DestroyPullPoint does not work  and generates the following in the log:

-------- Begin Error --------

293 | Error processing exchange [
  id:        c7c88687-507a-4e45-b39e-580ad0d7c0ab
  mep:       InOut
  status:    Done
  role:      Consumer
  target:    PropertyMatchingReference[{INTERFACE_NAME={http://docs.oasis-open.org/wsn/bw-2}PullPoint}]
  operation: {http://docs.oasis-open.org/wsn/bw-2}DestroyPullPointRequest
  properties: [
      javax.jbi.servicedesc.ServiceEndpoint = org.apache.servicemix.jbi.runtime.impl.EndpointImpl@1f86f75
      org.apache.servicemix.senderEndpoint = {http://servicemix.org/wsnotification}NotificationBroker:http-bin
ding
      javax.jbi.messaging.MessageExchange = org.apache.servicemix.jbi.runtime.impl.InOutImpl@4bbcb1
      javax.jbi.messaging.sendSync = <null>
      javax.jbi.InterfaceName = {http://docs.oasis-open.org/wsn/bw-2}PullPoint
      javax.jbi.ServiceEndpoint = org.apache.servicemix.jbi.runtime.impl.ServiceEndpointImpl@512035
      javax.jbi.transaction.jta = <null>
      org.apache.servicemix.correlationId = c7c88687-507a-4e45-b39e-580ad0d7c0ab
      javax.jbi.ServiceName = <null>
  ]
  In: [
    content: org.apache.servicemix.jbi.jaxp.StaxSource@1a60e09
    properties: [
      org.apache.servicemix.soap.headers = {{http://www.w3.org/2005/08/addressing}Action=[#document-fragment:
null]}
    ]
  ]
  Out: [
    content: <?xml version="1.0" encoding="UTF-8" standalone="no"?><ns5:DestroyPullPointResponse xmlns:ns5="ht
tp://docs.oasis-open.org/wsn/b-2" xmlns:ns2="http://www.w3.org/2005/08/addressing" xmlns:ns3="http://docs.oasi
s-open.org/wsrf/bf-2" xmlns:ns4="http://docs.oasis-open.org/wsrf/rp-2" xmlns:ns6="http://docs.oasis-open.org/w
sn/t-1"/>
  ]
]

org.apache.servicemix.nmr.core.ChannelClosedException
        at org.apache.servicemix.nmr.core.ChannelImpl.deliver(ChannelImpl.java:192)

---- End Error ------------

Create/Create/Destroy -- Bug?
I found what I believe may be a bug when I was playing with CreatePullPoint and DestroyPullPoint.  In 3.3.2 you can create the pullpoint and then destroy the pullpoint as much as you like.  But if you accidently call the create twice in a row using the same defined address the server appears to get in a bad state. The second CreatePullPoint will cause a soap fault but then the DestroyPullPoint will receive an HTTP 500 error response with a stack trace.

   <h2>HTTP ERROR 500</h2>
      <p>
         Problem accessing /CreatePullPoint/. Reason:
         <pre>INTERNAL_SERVER_ERROR</pre>
      </p>
      <h3>Caused by:</h3>
      <pre>java.lang.NullPointerException
	at org.apache.servicemix.wsn.component.WSNEndpoint.process(WSNEndpoint.java:141)
	at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
	at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
	at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:478)
	at org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:347)
	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)</pre>
      <hr/>
      <i>
         <small>Powered by Jetty://</small>
      </i>




I've tested pullpoints in 4.2.0 but subscriptions do not appear to work.

To setup the subscription I send a subscribe request and then test it with a notify request.

-- Subscription request --
<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 Subscription request --

-- Notification -
<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 Notification --

Service mix throws the following error:

15:44:34,369 | WARN  | eMQ Session Task | NMR                              | .servicemix.nmr.core.ChannelImpl
 293 | Error processing exchange [
  id:        4bb50aca-6177-4062-9d2b-c1b403341dae
  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
64-12cf0b213b4-2-0
      javax.jbi.messaging.MessageExchange = org.apache.servicemix.jbi.runtime.impl.InOnlyImpl@ff9738
      javax.jbi.messaging.sendSync = <null>
      javax.jbi.transaction.jta = <null>
      javax.jbi.ServiceEndpoint = org.apache.servicemix.common.ResolvedEndpoint@2103ff
      org.apache.servicemix.correlationId = 4bb50aca-6177-4062-9d2b-c1b403341dae
  ]
  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)


Is version 4.2.0 interpreting http://localhost:4444 as an internal endpoint address?

If you've made it this far, congratulations.  Here is a quick summary of the questions:

How stable is 4.2.0 with regard to WS-Notifications?  
How is the destroyPullPoint operation working successfully in 3.3.2 even though the operation is not defined in the WSDL?
Is version 4.2.0 interpreting http://localhost:4444 as an internal endpoint address?

Thanks in advance

Matthieu Cormier
Cell: (902) 229-1677
concertia Technologies Inc.
1869 Upper Water Street
Halifax NS B3J 1S9 
www.concertia.com


Re: WS-Notification

Posted by rvasisht <ra...@gmail.com>.
Hello Matthieu, Guillaume, All - I just installed ServiceMix 4.3 locally and
am brand new to open source ESBs after spending the past several years with
COTS (e.g. webMethods, IBM MQ). I'd like to implement a very basic
WS-Notification use case and wanted to get your advice on where to start
(e.g. sample code, documentation, etc.). Here's the use case: 

- a stub Publisher program puts messages on a topics T1, T2, etc.
- the ServiceMix broker routes those message to subscribers 
- for the sake of simplicity, I just need a single subscriber which will be
implemented via a Flex widget at the UI layer that talks to the activeMQ
broker over HTTP

I saw in Matthieu's post and other documentation I've read that this seems
to be most similar to the "wsn-http-binding" example which was provided by
an earlier version of ServiceMix (e.g. 3.3.2). Is there another example in
the ServiceMix 4.3 download which would help get me started? 

Thanks,
Rajesh

--
View this message in context: http://servicemix.396122.n5.nabble.com/WS-Notification-tp3308488p4330646.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

RE: WS-Notification

Posted by rvasisht <ra...@gmail.com>.
Hello Matthieu, Guillaume, All - I just installed ServiceMix 4.3 locally and
am brand new to open source ESBs after spending the past several years with
COTS (e.g. webMethods, IBM MQ). I'd like to implement a very basic
WS-Notification use case and wanted to get your advice on where to start
(e.g. sample code, documentation, etc.). Here's the use case: 

- a stub Publisher program puts messages on a topics T1, T2, etc. 
- the ServiceMix broker routes those message to subscribers 
- for the sake of simplicity, I just need a single subscriber which will be
implemented via a Flex widget at the UI layer that talks to the activeMQ
broker over HTTP 

I saw in Matthieu's post and other documentation I've read that this seems
to be most similar to the "wsn-http-binding" example which was provided by
an earlier version of ServiceMix (e.g. 3.3.2). Is there another example in
the ServiceMix 4.3 download which would help get me started? 

Thanks, 
Rajesh  

--
View this message in context: http://servicemix.396122.n5.nabble.com/WS-Notification-tp3308488p4333273.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

RE: WS-Notification

Posted by Matthieu Cormier <Ma...@concertia.com>.
Hello Guillaume,

I've documented this issue as SM-2033.

https://issues.apache.org/jira/browse/SM-2033

Matthieu,

-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com] 
Sent: Wednesday, December 22, 2010 6:09 AM
To: users@servicemix.apache.org
Subject: Re: WS-Notification

I guess WS-Notification has not been well tested in 4.2, but I'm sure
we can work on fixing those problems.

On Thu, Dec 16, 2010 at 20:49, Matthieu Cormier
<Ma...@concertia.com> wrote:
> Hello all,
>
> I've been experimenting with the WS-Notification support in servicemix 3.3.2 and am now testing it in 4.2.0.
>
> This begs the question, how stable is 4.2.0?  I've stuck with 3.3.2 thus far because the wsn-http-biding example is not part of the examples provided in 4.2.0 distribution.  Here is what I've found so far:
>
> You have to patch 3.3.2 to get the wsn-http-binding to work
> https://issues.apache.org/jira/browse/SM-1783
> The simplest way to do this is to grab the class FragmentStreamReader.class out of the servicemix-utils jar file in 4.2.0 and put it in the servicemix-utils, or you could more prudently compile the version attached to the JIRA issue.

Building servicemix-utils locally and deploying the snapshot as a
bundle (and removing the old version) should work too I suppose.

>
> PullPoint(i.e. Queue)
> After this was done I successfully created a pullpoint, sent notify messages to that pullpoint and got the messages back with a getmessages call.
>
> Subscription(i.e. Topic)
> I also created a subscription to a topic by subscribing a simple echo server on localhost:4444.  It simply echos whatever is sent to it and sends back HTTP OK 200.
> I then sent a notify message to that topic (no <wsa:To> field specified in the header) and received the message from the echo server.
>
> The creation of subscriptions and pullpoints works great in 3.3.2 but tearing them down is more difficult.
>
> Unsubscribing
> -----------------
>  When creating a subscription it returns an address like the one below in the response
> <ns2:Address>http://servicemix.org/wsnotification/Subscription/ID-192-168-0-164-12cf0719623-0-1</ns2:Address>
> This is an internal endpoint address and cannot be accessed externally.  It has been previously mentioned on the mailing list that to perform an unsubscribe you must send  <wsnt:Unsubscribe/> to that internal endpoint.  I modified the wsdl-first example to use the personId to perform the unsubscribe operation.
>
> Here sample code to perform the unsubscribe operation inside a POJO.
> ----------------------------------------------------------------------------
>      ServiceMixClient client = new ServiceMixClientFacade(this.context);
>      Destination destination = client.createDestination("service:http://servicemix.org/wsnotification/Subscription");
>
>      InOut exchange = destination.createInOutExchange();
>
>      NormalizedMessage message = exchange.getInMessage();
>      message.setProperty("endpoint", subId);
>      message.setContent(new StreamSource(new StringReader( "<wsnt:Unsubscribe xmlns:wsnt=\"http://docs.oasis-open.org/wsn/b-2\"/>") ));
>
>      client.sendSync(exchange);
> ----------------------------------------------------------------------------
>
> DestroyPullPoint
> ----------------
> To Destroy a pullpoint the following xml must be sent.
>
> <wsnt:DestroyPullPoint
>  xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
>  xmlns:sm="http://servicemix.apache.org/wsn2005/1.0">
> <sm:address>
>    http://www.consumer.org/service/endpoint
>  </sm:address>
> </wsnt:DestroyPullPoint>
>
> This is where I get confused.  The two wsn-http bindings (CreatePullPoint and NotificationBroker) display the following operations when accessed with SOAPUI
> - CreatePullPoint
> - GetCurrentMessage
> - Notify
> - RegisterPublisher
> - Subscribe
>
> Athough neither binding states in it's wsdl that it accepts DestroyPullPoint both endpoints (http://localhost:8192/CreatePullPoint and http://localhost:8192/NotificationBroker) accept a DestroyPullPoint request.  How does this work?

IIRC, the DestroyPullPoint is sent to the PullPoint, but this endpoint
is not exposed externally through http, so you can either access it
directly from inside the bus, or through http by using a WS-Addressing
header to redirect the message to the correct endpoint (the pull
point), which then handle the request.

Ideally, we'd have a way to have those endpoints exposed automatically
as web services through HTTP, but we've never done that.   I suppose
it could be done by listening for new endpoints and exposing them
using the HTTP component.

>
> In 4.2.0 DestroyPullPoint does not work  and generates the following in the log:
>
> -------- Begin Error --------
>
> 293 | Error processing exchange [
>  id:        c7c88687-507a-4e45-b39e-580ad0d7c0ab
>  mep:       InOut
>  status:    Done
>  role:      Consumer
>  target:    PropertyMatchingReference[{INTERFACE_NAME={http://docs.oasis-open.org/wsn/bw-2}PullPoint}]
>  operation: {http://docs.oasis-open.org/wsn/bw-2}DestroyPullPointRequest
>  properties: [
>      javax.jbi.servicedesc.ServiceEndpoint = org.apache.servicemix.jbi.runtime.impl.EndpointImpl@1f86f75
>      org.apache.servicemix.senderEndpoint = {http://servicemix.org/wsnotification}NotificationBroker:http-bin
> ding
>      javax.jbi.messaging.MessageExchange = org.apache.servicemix.jbi.runtime.impl.InOutImpl@4bbcb1
>      javax.jbi.messaging.sendSync = <null>
>      javax.jbi.InterfaceName = {http://docs.oasis-open.org/wsn/bw-2}PullPoint
>      javax.jbi.ServiceEndpoint = org.apache.servicemix.jbi.runtime.impl.ServiceEndpointImpl@512035
>      javax.jbi.transaction.jta = <null>
>      org.apache.servicemix.correlationId = c7c88687-507a-4e45-b39e-580ad0d7c0ab
>      javax.jbi.ServiceName = <null>
>  ]
>  In: [
>    content: org.apache.servicemix.jbi.jaxp.StaxSource@1a60e09
>    properties: [
>      org.apache.servicemix.soap.headers = {{http://www.w3.org/2005/08/addressing}Action=[#document-fragment:
> null]}
>    ]
>  ]
>  Out: [
>    content: <?xml version="1.0" encoding="UTF-8" standalone="no"?><ns5:DestroyPullPointResponse xmlns:ns5="ht
> tp://docs.oasis-open.org/wsn/b-2" xmlns:ns2="http://www.w3.org/2005/08/addressing" xmlns:ns3="http://docs.oasi
> s-open.org/wsrf/bf-2" xmlns:ns4="http://docs.oasis-open.org/wsrf/rp-2" xmlns:ns6="http://docs.oasis-open.org/w
> sn/t-1"/>
>  ]
> ]
>
> org.apache.servicemix.nmr.core.ChannelClosedException
>        at org.apache.servicemix.nmr.core.ChannelImpl.deliver(ChannelImpl.java:192)
>
> ---- End Error ------------
>
> Create/Create/Destroy -- Bug?
> I found what I believe may be a bug when I was playing with CreatePullPoint and DestroyPullPoint.  In 3.3.2 you can create the pullpoint and then destroy the pullpoint as much as you like.  But if you accidently call the create twice in a row using the same defined address the server appears to get in a bad state. The second CreatePullPoint will cause a soap fault but then the DestroyPullPoint will receive an HTTP 500 error response with a stack trace.
>
>   <h2>HTTP ERROR 500</h2>
>      <p>
>         Problem accessing /CreatePullPoint/. Reason:
>         <pre>INTERNAL_SERVER_ERROR</pre>
>      </p>
>      <h3>Caused by:</h3>
>      <pre>java.lang.NullPointerException
>        at org.apache.servicemix.wsn.component.WSNEndpoint.process(WSNEndpoint.java:141)
>        at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
>        at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
>        at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:478)
>        at org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:347)
>        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)</pre>
>      <hr/>
>      <i>
>         <small>Powered by Jetty://</small>
>      </i>
>
>
>
>
> I've tested pullpoints in 4.2.0 but subscriptions do not appear to work.
>
> To setup the subscription I send a subscribe request and then test it with a notify request.
>
> -- Subscription request --
> <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 Subscription request --
>
> -- Notification -
> <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 Notification --
>
> Service mix throws the following error:
>
> 15:44:34,369 | WARN  | eMQ Session Task | NMR                              | .servicemix.nmr.core.ChannelImpl
>  293 | Error processing exchange [
>  id:        4bb50aca-6177-4062-9d2b-c1b403341dae
>  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
> 64-12cf0b213b4-2-0
>      javax.jbi.messaging.MessageExchange = org.apache.servicemix.jbi.runtime.impl.InOnlyImpl@ff9738
>      javax.jbi.messaging.sendSync = <null>
>      javax.jbi.transaction.jta = <null>
>      javax.jbi.ServiceEndpoint = org.apache.servicemix.common.ResolvedEndpoint@2103ff
>      org.apache.servicemix.correlationId = 4bb50aca-6177-4062-9d2b-c1b403341dae
>  ]
>  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)
>
>
> Is version 4.2.0 interpreting http://localhost:4444 as an internal endpoint address?

Those addresses use EPR resolution (see JBI spec).  Supported are:
   endpoint:[service qname]/endpoint
   service:[service qname]
   external url
If using an external url, the JBI layer will ask for binding
components to resolve the url, and servicemix-http should be able to
do that.

>
> If you've made it this far, congratulations.  Here is a quick summary of the questions:
>
> How stable is 4.2.0 with regard to WS-Notifications?

See above, I suppose it has not been so much used in 4.2

> How is the destroyPullPoint operation working successfully in 3.3.2 even though the operation is not defined in the WSDL?

As I said, the WS-Addressing header should use the correct target
endpoint to handle that message.  The WSDL should be available on the
internal endpoint.

> Is version 4.2.0 interpreting http://localhost:4444 as an internal endpoint address?

I'm not sure about that.  The code is the same as in 3.3, so not sure
why it would not work.
Could you set up an easy reproductible test case and attach it to a JIRA ?

> Thanks in advance
>
> Matthieu Cormier
> Cell: (902) 229-1677
> concertia Technologies Inc.
> 1869 Upper Water Street
> Halifax NS B3J 1S9
> www.concertia.com
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: WS-Notification

Posted by Guillaume Nodet <gn...@gmail.com>.
I guess WS-Notification has not been well tested in 4.2, but I'm sure
we can work on fixing those problems.

On Thu, Dec 16, 2010 at 20:49, Matthieu Cormier
<Ma...@concertia.com> wrote:
> Hello all,
>
> I've been experimenting with the WS-Notification support in servicemix 3.3.2 and am now testing it in 4.2.0.
>
> This begs the question, how stable is 4.2.0?  I've stuck with 3.3.2 thus far because the wsn-http-biding example is not part of the examples provided in 4.2.0 distribution.  Here is what I've found so far:
>
> You have to patch 3.3.2 to get the wsn-http-binding to work
> https://issues.apache.org/jira/browse/SM-1783
> The simplest way to do this is to grab the class FragmentStreamReader.class out of the servicemix-utils jar file in 4.2.0 and put it in the servicemix-utils, or you could more prudently compile the version attached to the JIRA issue.

Building servicemix-utils locally and deploying the snapshot as a
bundle (and removing the old version) should work too I suppose.

>
> PullPoint(i.e. Queue)
> After this was done I successfully created a pullpoint, sent notify messages to that pullpoint and got the messages back with a getmessages call.
>
> Subscription(i.e. Topic)
> I also created a subscription to a topic by subscribing a simple echo server on localhost:4444.  It simply echos whatever is sent to it and sends back HTTP OK 200.
> I then sent a notify message to that topic (no <wsa:To> field specified in the header) and received the message from the echo server.
>
> The creation of subscriptions and pullpoints works great in 3.3.2 but tearing them down is more difficult.
>
> Unsubscribing
> -----------------
>  When creating a subscription it returns an address like the one below in the response
> <ns2:Address>http://servicemix.org/wsnotification/Subscription/ID-192-168-0-164-12cf0719623-0-1</ns2:Address>
> This is an internal endpoint address and cannot be accessed externally.  It has been previously mentioned on the mailing list that to perform an unsubscribe you must send  <wsnt:Unsubscribe/> to that internal endpoint.  I modified the wsdl-first example to use the personId to perform the unsubscribe operation.
>
> Here sample code to perform the unsubscribe operation inside a POJO.
> ----------------------------------------------------------------------------
>      ServiceMixClient client = new ServiceMixClientFacade(this.context);
>      Destination destination = client.createDestination("service:http://servicemix.org/wsnotification/Subscription");
>
>      InOut exchange = destination.createInOutExchange();
>
>      NormalizedMessage message = exchange.getInMessage();
>      message.setProperty("endpoint", subId);
>      message.setContent(new StreamSource(new StringReader( "<wsnt:Unsubscribe xmlns:wsnt=\"http://docs.oasis-open.org/wsn/b-2\"/>") ));
>
>      client.sendSync(exchange);
> ----------------------------------------------------------------------------
>
> DestroyPullPoint
> ----------------
> To Destroy a pullpoint the following xml must be sent.
>
> <wsnt:DestroyPullPoint
>  xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
>  xmlns:sm="http://servicemix.apache.org/wsn2005/1.0">
> <sm:address>
>    http://www.consumer.org/service/endpoint
>  </sm:address>
> </wsnt:DestroyPullPoint>
>
> This is where I get confused.  The two wsn-http bindings (CreatePullPoint and NotificationBroker) display the following operations when accessed with SOAPUI
> - CreatePullPoint
> - GetCurrentMessage
> - Notify
> - RegisterPublisher
> - Subscribe
>
> Athough neither binding states in it's wsdl that it accepts DestroyPullPoint both endpoints (http://localhost:8192/CreatePullPoint and http://localhost:8192/NotificationBroker) accept a DestroyPullPoint request.  How does this work?

IIRC, the DestroyPullPoint is sent to the PullPoint, but this endpoint
is not exposed externally through http, so you can either access it
directly from inside the bus, or through http by using a WS-Addressing
header to redirect the message to the correct endpoint (the pull
point), which then handle the request.

Ideally, we'd have a way to have those endpoints exposed automatically
as web services through HTTP, but we've never done that.   I suppose
it could be done by listening for new endpoints and exposing them
using the HTTP component.

>
> In 4.2.0 DestroyPullPoint does not work  and generates the following in the log:
>
> -------- Begin Error --------
>
> 293 | Error processing exchange [
>  id:        c7c88687-507a-4e45-b39e-580ad0d7c0ab
>  mep:       InOut
>  status:    Done
>  role:      Consumer
>  target:    PropertyMatchingReference[{INTERFACE_NAME={http://docs.oasis-open.org/wsn/bw-2}PullPoint}]
>  operation: {http://docs.oasis-open.org/wsn/bw-2}DestroyPullPointRequest
>  properties: [
>      javax.jbi.servicedesc.ServiceEndpoint = org.apache.servicemix.jbi.runtime.impl.EndpointImpl@1f86f75
>      org.apache.servicemix.senderEndpoint = {http://servicemix.org/wsnotification}NotificationBroker:http-bin
> ding
>      javax.jbi.messaging.MessageExchange = org.apache.servicemix.jbi.runtime.impl.InOutImpl@4bbcb1
>      javax.jbi.messaging.sendSync = <null>
>      javax.jbi.InterfaceName = {http://docs.oasis-open.org/wsn/bw-2}PullPoint
>      javax.jbi.ServiceEndpoint = org.apache.servicemix.jbi.runtime.impl.ServiceEndpointImpl@512035
>      javax.jbi.transaction.jta = <null>
>      org.apache.servicemix.correlationId = c7c88687-507a-4e45-b39e-580ad0d7c0ab
>      javax.jbi.ServiceName = <null>
>  ]
>  In: [
>    content: org.apache.servicemix.jbi.jaxp.StaxSource@1a60e09
>    properties: [
>      org.apache.servicemix.soap.headers = {{http://www.w3.org/2005/08/addressing}Action=[#document-fragment:
> null]}
>    ]
>  ]
>  Out: [
>    content: <?xml version="1.0" encoding="UTF-8" standalone="no"?><ns5:DestroyPullPointResponse xmlns:ns5="ht
> tp://docs.oasis-open.org/wsn/b-2" xmlns:ns2="http://www.w3.org/2005/08/addressing" xmlns:ns3="http://docs.oasi
> s-open.org/wsrf/bf-2" xmlns:ns4="http://docs.oasis-open.org/wsrf/rp-2" xmlns:ns6="http://docs.oasis-open.org/w
> sn/t-1"/>
>  ]
> ]
>
> org.apache.servicemix.nmr.core.ChannelClosedException
>        at org.apache.servicemix.nmr.core.ChannelImpl.deliver(ChannelImpl.java:192)
>
> ---- End Error ------------
>
> Create/Create/Destroy -- Bug?
> I found what I believe may be a bug when I was playing with CreatePullPoint and DestroyPullPoint.  In 3.3.2 you can create the pullpoint and then destroy the pullpoint as much as you like.  But if you accidently call the create twice in a row using the same defined address the server appears to get in a bad state. The second CreatePullPoint will cause a soap fault but then the DestroyPullPoint will receive an HTTP 500 error response with a stack trace.
>
>   <h2>HTTP ERROR 500</h2>
>      <p>
>         Problem accessing /CreatePullPoint/. Reason:
>         <pre>INTERNAL_SERVER_ERROR</pre>
>      </p>
>      <h3>Caused by:</h3>
>      <pre>java.lang.NullPointerException
>        at org.apache.servicemix.wsn.component.WSNEndpoint.process(WSNEndpoint.java:141)
>        at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
>        at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
>        at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:478)
>        at org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:347)
>        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)</pre>
>      <hr/>
>      <i>
>         <small>Powered by Jetty://</small>
>      </i>
>
>
>
>
> I've tested pullpoints in 4.2.0 but subscriptions do not appear to work.
>
> To setup the subscription I send a subscribe request and then test it with a notify request.
>
> -- Subscription request --
> <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 Subscription request --
>
> -- Notification -
> <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 Notification --
>
> Service mix throws the following error:
>
> 15:44:34,369 | WARN  | eMQ Session Task | NMR                              | .servicemix.nmr.core.ChannelImpl
>  293 | Error processing exchange [
>  id:        4bb50aca-6177-4062-9d2b-c1b403341dae
>  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
> 64-12cf0b213b4-2-0
>      javax.jbi.messaging.MessageExchange = org.apache.servicemix.jbi.runtime.impl.InOnlyImpl@ff9738
>      javax.jbi.messaging.sendSync = <null>
>      javax.jbi.transaction.jta = <null>
>      javax.jbi.ServiceEndpoint = org.apache.servicemix.common.ResolvedEndpoint@2103ff
>      org.apache.servicemix.correlationId = 4bb50aca-6177-4062-9d2b-c1b403341dae
>  ]
>  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)
>
>
> Is version 4.2.0 interpreting http://localhost:4444 as an internal endpoint address?

Those addresses use EPR resolution (see JBI spec).  Supported are:
   endpoint:[service qname]/endpoint
   service:[service qname]
   external url
If using an external url, the JBI layer will ask for binding
components to resolve the url, and servicemix-http should be able to
do that.

>
> If you've made it this far, congratulations.  Here is a quick summary of the questions:
>
> How stable is 4.2.0 with regard to WS-Notifications?

See above, I suppose it has not been so much used in 4.2

> How is the destroyPullPoint operation working successfully in 3.3.2 even though the operation is not defined in the WSDL?

As I said, the WS-Addressing header should use the correct target
endpoint to handle that message.  The WSDL should be available on the
internal endpoint.

> Is version 4.2.0 interpreting http://localhost:4444 as an internal endpoint address?

I'm not sure about that.  The code is the same as in 3.3, so not sure
why it would not work.
Could you set up an easy reproductible test case and attach it to a JIRA ?

> Thanks in advance
>
> Matthieu Cormier
> Cell: (902) 229-1677
> concertia Technologies Inc.
> 1869 Upper Water Street
> Halifax NS B3J 1S9
> www.concertia.com
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com