Hi GT4 users and developers,
I am trying to test WS-Notification in my own Web Service following
Borja's GT4 Programmer's Tutorial.
I have already included the
wsdlpp:extends="wsrpw:GetResourceProperty wsntw:NotificationProducer" in WSDL.
and also included
<parameter name="providers" value="GetRPProvider SubscribeProvider
GetCurrentMessageProvider"/> in wsdd.
The Resource class implements TopicListAccessor interface.
this.topicList = new SimpleTopicList(this);
ResourceProperty prop = null;
// I am using ReflectionResourceProperty
instead of SimpleResourceProperty
prop = new ReflectionResourceProperty(RP_STATUS,
"Status", this);
setStatus(Constants.READY);
ResourcePropertyTopic rpt = new
ResourcePropertyTopic(prop);
(rpt).setSendOldValue(true);
this.topicList.addTopic(rpt);
this.propSet.add(prop);
The listener class also follows the Math notification sample,
implementing NotifyCallback interface. The serviceURI is the URI of
my web service which extends NotificationProvider portType.
The same MathService notification sample works, but in my Web Service,
the following code fails at the invocation to "subscribe" operation.
Subscribe request = new Subscribe();
// Must the notification be delivered using the Notify
operation?
request.setUseNotify(Boolean.TRUE);
// Indicate what the client's EPR is
request.setConsumerReference(consumerEPR);
// The TopicExpression specifies what topic we want to
subscribe to
TopicExpressionType topicExpression = new
TopicExpressionType();
topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT);
topicExpression.setValue(PrimitiveComponentResource.RP_STATUS);
request.setTopicExpression(topicExpression);
WSBaseNotificationServiceAddressingLocator notifLocator
=
new
WSBaseNotificationServiceAddressingLocator();
EndpointReferenceType endpoint = new
EndpointReferenceType();
endpoint.setAddress(new Address(serviceURI));
NotificationProducer producerPort = notifLocator
.getNotificationProducerPort(endpoint);
System.out.println("Starts to subscribe...");
// Start the ball rolling...
producerPort.subscribe(request);
The error shows
org.xml.sax.SAXException: Invalid element in org.oasis.wsn.Subscribe - Address
The detailed stacktrace is as follows:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Invalid element in org.oasis.wsn.Subscri
be - Address
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Invali
d element in org.oasis.wsn.Subscribe - Address
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeseri
alizer.java:223)
at org.apache.axis.encoding.DeserializationContext.startElement(Deserial
izationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.ja
va:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElemen
t.java:1140)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:238)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider
.java:148)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:
319)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:450
)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:285)
at org.globus.wsrf.container.ServiceThread.doPost(ServiceThread.java:664
)
at org.globus.wsrf.container.ServiceThread.process(ServiceThread.java:38
2)
at org.globus.wsrf.container.ServiceThread.run(ServiceThread.java:291)
{http://xml.apache.org/axis/}hostname:TOSHIBA
org.xml.sax.SAXException: Invalid element in org.oasis.wsn.Subscribe - Address
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder
.java:221)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
java:128)
at org.apache.axis.encoding.DeserializationContext.endElement(Deserializ
ationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source
)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknow
n Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(Deserialization
Context.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:645)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
at org.apache.axis.message.addressing.handler.AddressingHandler.processC
lientResponse(AddressingHandler.java:305)
at org.apache.axis.message.addressing.handler.AddressingHandler.invoke(A
ddressingHandler.java:110)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:190)
at org.apache.axis.client.Call.invokeEngine(Call.java:2727)
at org.apache.axis.client.Call.invoke(Call.java:2710)
at org.apache.axis.client.Call.invoke(Call.java:2386)
at org.apache.axis.client.Call.invoke(Call.java:2309)
at org.apache.axis.client.Call.invoke(Call.java:1766)
at org.oasis.wsn.NotificationProducerSOAPBindingStub.subscribe(Notificat
ionProducerSOAPBindingStub.java:719)
at test.soardsgrid.PrimitiveComponentListener.run(PrimitiveComponentList
ener.java:114)
at test.soardsgrid.PrimitiveComponentListener.main(PrimitiveComponentLis
tener.java:211)
Can anyone give some idea why this error happens?
I have tried to use Stubless dynamic invocation on the subscribe
operation of my web service, it doesn't show any error when I run the
Listener, but there is no notification to the Listener when
ResourceProperty changes.
My Stubless dynamic invocation is as follows:
operation = "subscribe";
paramQname = new
QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd",
"Subscribe");
paramXmlQname = new
QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd",
">Subscribe");
paramClass = Subscribe.class;
returnXmlQname = new
QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd",
">SubscribeResponse");
returnClass = SubscribeResponse.class;
SubscribeResponse resSubscribe = (SubscribeResponse)
DynamicInvoker.invoke(producerEPR, operation, encodingStyle, request,
paramQname, paramXmlQname, paramClass, returnXmlQname, returnClass);
Why the second approach can execute without Exception but the
notification doesn't happen?
Thanks for reading this long question.
Regards,
Xinjun