can you send the stack trace from muse.log? thanks, Dan
dnguyen <[EMAIL PROTECTED]> wrote on 03/01/2007 02:02:14 PM: > > Hi Dan. Thanks for your efforts. With the latest nightly build, we are now > able to change filters using subscription.setResourceProperty(). However > when we subscribe to a producer specifying a MessageContentFilter, we get an > exception: > > > ***************************** > <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> > <soap:Header> > <wsa:To > xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3. > org/2005/08/addressing/role/anonymous</wsa:To> > <wsa:Action > xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3. > org/2005/08/addressing/fault</wsa:Action> > <wsa:MessageID > xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:d65ebd52-880f-f3d0-d44f- > d3f4535864b9</wsa:MessageID> > <wsa:RelatesTo RelationshipType="wsa:Reply" > xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:9e968c17-0a16-1256- > ade2-802745174af6</wsa:RelatesTo> > <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing"> > > <wsa:Address>http://localhost:8080/wsn-producer/services/WsResource</wsa:Address> > </wsa:From> > </soap:Header> > <soap:Body> > <soap:Fault> > <soap:Code> > <soap:Value>soap:Receiver</soap:Value> > </soap:Code> > <soap:Reason> > <soap:Text>[ID = 'InvalidDialect'] Subscription filters do > not support the dialect 'http://www.w3.org/TR/1999/REC-xpath-19991116'. The > supported dialects are: > http://www.w3.org/TR/1999/REC-xpath-19991116</soap:Text> > </soap:Reason> > <soap:Detail> > <wsnt:TopicExpressionDialectUnknownFault > xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"> > <wsrf-bf:Timestamp > xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2">2007-03-01T11:13:31-06: > 00</wsrf-bf:Timestamp> > </wsnt:TopicExpressionDialectUnknownFault> > </soap:Detail> > </soap:Fault> > </soap:Body> > </soap:Envelope> > > org.apache.muse.ws.addressing.soap.SoapFault: [ID = 'InvalidDialect'] > Subscription filters do not support the dialect > 'http://www.w3.org/TR/1999/REC-xpath-19991116'. The supported dialects are: > http://www.w3.org/TR/1999/REC-xpath-19991116 > at > org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.java:294) > at > org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.java:250) > at > org.apache.muse.ws.notification.remote.NotificationProducerClient. > subscribe(NotificationProducerClient.java:93) > at org.apache.muse.test.wsn.WsnTestClient.main(Unknown Source) > *************************************** > > > This only happens during subscription. We tried subscribing with the > default filter or a TopicFilter and then changing it afterwards, and this > works. > > > > Daniel Jemiolo wrote: > > > > ok, two things: > > > > 1. I added a FilterSerializer and registered it as part of the WSN > > capability initialization. This means that you should be able to change a > > subscription's filter using SetResourceProperties so long as you add that > > operation to your WSDL and make sure the capability is listed in muse.xml. > > > > 2. I updated the NotificationProducer implementation so that you can add > > custom filter types. Here's what you have to do: > > > > a. Implement the Filter interface (it has one method, accepts()) to do the > > message analysis you want. In your case, your Filter class will be using > > custom XPath functions on the message content. > > > > b. Implement the FilterFactoryHandler interface (two methods) and have it > > return a new instance of your Filter class when the XML provided has the > > right dialect. It should look something like this: > > > > public MyFilterHandler implements FilterFactoryHandler > > { > > public boolean accepts(QName filterName, String filterDialect) > > { > > return > > filterName.equals(WsnConstants.MESSAGE_CONTENT_QNAME) && > > filterDialect.equals("some URI you made up"); > > } > > > > public Filter newInstance(Element filterXML) > > { > > String expression = XmlUtils.extractText(filterXML); > > return new MyFilter(); > > } > > } > > > > c. add the handler to the FilterFactory in one of your initialize() > > methods: > > > > FilterFactory.getInstance().addHandler(new MyFilterHandler()); > > > > > > This will make it so that your handler is queried during the subscribe() > > requests and allowed to create your custom Filter objects if appropriate. > > Your filter will then be used by the subscription resource to decide what > > messages to send out. > > > > > > As a bonus, you now get to test both scenarios and let me know if they > > work. :) I am taking care of the regression testing for previous > > projects. > > > > Dan > > > > > > dnguyen <[EMAIL PROTECTED]> wrote on 02/28/2007 05:06:20 PM: > > > >> > >> Whoops! Sorry about that...I copied the wrong thing from the muse.xml > > file. > >> I did use the Get capability, which is what the original post should > > have > >> had. That did not work for me. It looked like this: > >> > >> ********************************************* > >> <resource-type> > >> <context-path>SubscriptionManager</context-path> > >> <wsdl> > >> <wsdl-file>wsdl/WS-BaseNotification-1_3.wsdl</wsdl-file> > >> <wsdl-port-type>wsntw:SubscriptionManager</wsdl-port-type> > >> </wsdl> > >> > >> <java-id-factory-class>org.apache.muse.core.routing. > >> CounterResourceIdFactory</java-id-factory-class> > >> > >> > > <java-resource-class>org.apache.muse.ws.resource.impl.SimpleWsResource</java- > >> resource-class> > >> <capability> > >> > >> > > <capability-uri>http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata</capability-uri> > >> > >> <java-capability-class>org.apache.muse.ws.metadata.impl. > >> SimpleMetadataExchange</java-capability-class> > >> </capability> > >> <capability> > >> > >> > > <capability-uri>http://docs.oasis-open.org/wsrf/rpw-2/Get</capability-uri> > >> > >> <java-capability-class>org.apache.muse.ws.resource.properties.get.impl. > >> SimpleGetCapability</java-capability-class> > >> </capability> > >> <capability> > >> > >> > > <capability-uri>http://docs.oasis-open.org/wsrf/rpw-2/Set</capability-uri> > >> > >> <java-capability-class>org.apache.muse.ws.resource.properties.set.impl. > >> SimpleSetCapability</java-capability-class> > >> </capability> > >> <capability> > >> > >> > > <capability-uri>http://docs.oasis-open. > org/wsn/bw-2/SubscriptionManager</capability-uri> > >> > >> <java-capability-class>org.apache.muse.ws.notification.impl. > >> SimpleSubscriptionManager</java-capability-class> > >> <init-param> > >> <param-name>trace-notifications</param-name> > >> <param-value>true</param-value> > >> </init-param> > >> </capability> > >> <capability> > >> > >> <capability-uri>http://docs.oasis-open. > >> org/wsrf/rlw-2/ImmediateResourceTermination</capability-uri> > >> > >> <java-capability-class>org.apache.muse.ws.resource.lifetime.impl. > >> SimpleImmediateTermination</java-capability-class> > >> </capability> > >> <capability> > >> > >> <capability-uri>http://docs.oasis-open. > >> org/wsrf/rlw-2/ScheduledResourceTermination</capability-uri> > >> > >> <java-capability-class>org.apache.muse.ws.resource.lifetime.impl. > >> SimpleScheduledTermination</java-capability-class> > >> </capability> > >> <init-param> > >> <param-name>validate-wsrp-schema</param-name> > >> <param-value>false</param-value> > >> </init-param> > >> </resource-type> > >> ************************************************ > >> > >> > >> Vinh Nguyen (vinguye2) wrote: > >> > > >> > The operation you are calling is SetResourceProperties, but you are > >> > adding a Get operation to muse.xml. You need to add the correct "Set" > >> > operation to muse.xml. If you are using Axis2, you also need to add > > the > >> > appropriate action to services.xml. > >> > > >> > > >> > -----Original Message----- > >> > From: dnguyen [mailto:[EMAIL PROTECTED] > >> > Sent: Wednesday, February 28, 2007 1:39 PM > >> > To: [email protected] > >> > Subject: Problem updating subscription resource property. > >> > > >> > > >> > I am trying to update the filter in the SubscriptionClient through the > >> > updateResourceProperty() method but not having any success. I get the > >> > error > >> > below: > >> > > >> > > >> > ****************************** > >> > org.apache.muse.ws.addressing.soap.SoapFault: [ID = > >> > 'ActionNotSupported'] The re source at 'SubscriptionManager' does not > >> > expose an operation with the WS-Action > >> > > > 'http://docs.oasis-open.org/wsrf/rpw-2/SetResourceProperties/SetResource > >> > PropertiesRequest' > >> > through any of its capabilities. > >> > at > >> > > > org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClien > >> > t.java:279) > >> > at > >> > > > org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClien > >> > t.java:235) > >> > at > >> > > > org.apache.muse.ws.resource.remote.WsResourceClient.setResourcePropertie > >> > s(WsResourceClient.java:175) > >> > at > >> > > > org.apache.muse.ws.resource.remote.WsResourceClient.updateResourceProper > >> > ty(WsResourceClient.java:202) > >> > at org.apache.muse.test.wsn.WsnTestClient2.main(Unknown > > Source) > >> > ************************************ > >> > > >> > > >> > I then added this to the SubscriptionManager resource in the > >> > wsn-producer muse.xml file: > >> > > >> > > >> > ************************************* > >> > <capability> > >> > > >> > > > <capability-uri>http://docs.oasis-open.org/wsrf/rpw-2/Get</capability-ur > >> > i> > >> > > >> > > > <java-capability-class>org.apache.muse.ws.resource.properties.get.impl.S > >> > impleGetCapability</java-capability-class> > >> > </capability> > >> > ************************************ > >> > > >> > > >> > But I still get the same exception. I looked in the source code for > >> > anything related to SetResourceProperties but didn't find anything > >> > helpful. > >> > I read that the WS-N spec states that the impl can throw an exception > > in > >> > this case, but it also says this is allowed. I am not sure if this is > >> > allowable in Muse, but the error message indicates it is possible by > >> > adding the correct capability. Also, I am not sure I am doing this > >> > right. The example I am using is below > >> > > >> > > >> > ******************************* > >> > package org.apache.muse.test.wsn; > >> > > >> > import javax.xml.namespace.QName; > >> > > >> > import java.net.InetAddress; > >> > import java.net.URI; > >> > import java.net.UnknownHostException; > >> > > >> > import org.apache.muse.ws.addressing.EndpointReference; > >> > import > >> > org.apache.muse.ws.notification.remote.NotificationProducerClient; > >> > import org.apache.muse.ws.notification.remote.SubscriptionClient; > >> > import org.apache.muse.ws.notification.impl.*; > >> > import org.apache.muse.ws.notification.WsnConstants; > >> > import org.apache.muse.util.xml.*; > >> > > >> > > >> > public class WsnTestClient2 > >> > { > >> > public static URI getLocalAddress(String contextPath, int port) > >> > throws UnknownHostException > >> > { > >> > String ip = InetAddress.getLocalHost().getHostAddress(); > >> > > >> > StringBuffer address = new StringBuffer(); > >> > address.append("http://"); > >> > address.append(ip); > >> > address.append(':'); > >> > address.append(port); > >> > > >> > if (contextPath.charAt(0) != '/') > >> > address.append('/'); > >> > > >> > address.append(contextPath); > >> > > >> > return URI.create(address.toString()); > >> > } > >> > > >> > public static void main(String[] args) > >> > { > >> > try > >> > { > >> > // > >> > // change these to point to different applications/servers > >> > // > >> > String webAppRoot = "/isr-producer/services"; > >> > int producer_port = > >> > Integer.parseInt(System.getProperty("producer_port","8080")); > >> > int consumer_port = > >> > Integer.parseInt(System.getProperty("consumer_port","8080")); > >> > > >> > // > >> > // create producer EPR/client, and use it to subscribe > >> > // the consumer to all messages > >> > // > >> > > >> > String contextPath = webAppRoot + "/IsrResource"; > >> > URI address = (args.length == 0) ? > >> > getLocalAddress(contextPath, > >> > producer_port) : URI.create(args[0] + contextPath); > >> > EndpointReference epr = new EndpointReference(address); > >> > > >> > webAppRoot = "/isr-consumer/services"; > >> > contextPath = webAppRoot + "/IsrConsumer"; > >> > address = getLocalAddress(contextPath, consumer_port); > >> > EndpointReference consumer = new > > EndpointReference(address); > >> > > >> > // > >> > // null filter == send all messages to consumer > >> > // > >> > NotificationProducerClient producer = new > >> > NotificationProducerClient(epr); > >> > producer.setTrace(true); > >> > > >> > SubscriptionClient subscription = null; > >> > > >> > while( true ) > >> > { > >> > System.out.println( "s - subscribe, u - unsubscribe, v > > - > >> > view, q - quit" ); > >> > > >> > char choice = (char)System.in.read(); > >> > > >> > if( choice == 's' ) > >> > { > >> > subscription = producer.subscribe(consumer, null, > >> > null); > >> > } > >> > else if( choice == 'u' ) > >> > { > >> > subscription.destroy(); > >> > } > >> > else if( choice == 'v' ) > >> > { > >> > > >> > > > System.out.println(XmlUtils.toString(subscription.getResourceProperty(Ws > >> > nConstants.FILTER_QNAME)[0])); > >> > } > >> > else if( choice == 'f' ) > >> > { > >> > QName messageName = new > >> > QName("http://ws.apache.org/muse/test/wsrf", "MyTopic", "tns"); > >> > > >> > subscription.updateResourceProperty(WsnConstants.FILTER_QNAME, new > >> > Object[] { new TopicFilter(messageName) }); > >> > } > >> > else if( choice == 'q' ) > >> > { > >> > break; > >> > } > >> > } > >> > } > >> > > >> > catch (Throwable error) > >> > { > >> > error.printStackTrace(); > >> > } > >> > } > >> > } > >> > > >> > -- > >> > View this message in context: > >> > > > http://www.nabble.com/Problem-updating-subscription-resource-property.-t > >> > f3323382.html#a9239032 > >> > Sent from the Muse User mailing list archive at Nabble.com. > >> > > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> > For additional commands, e-mail: [EMAIL PROTECTED] > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> > For additional commands, e-mail: [EMAIL PROTECTED] > >> > > >> > > >> > > >> > >> -- > >> View this message in context: http://www.nabble.com/Problem-updating- > >> subscription-resource-property.-tf3323382.html#a9239571 > >> Sent from the Muse User mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: http://www.nabble.com/Problem-updating- > subscription-resource-property.-tf3323382.html#a9256210 > Sent from the Muse User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
