You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-user@ws.apache.org by Asaf Lahav <as...@primagrid.com> on 2006/05/29 18:08:11 UTC
Notifications related question
I have been going through the pubscribe sample code and ran into (the
attached) "RequestUtils.java".
RequestUtils.java has the following function:
public static boolean invokeSubscribe(String consumerURL, String
serviceEPRURL, String topicName)
{
QName topic = QName.valueOf(topicName);
SubscribeDocument requestDoc =
SubscribeDocument.Factory.newInstance();
SubscribeDocument.Subscribe subscribe =
requestDoc.addNewSubscribe();
subscribe.setUseNotify(true);
Calendar instance = Calendar.getInstance();
instance.setTimeInMillis(instance.getTimeInMillis() + 2000000);
subscribe.setInitialTerminationTime(instance);
org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType
consumerRef = subscribe.addNewConsumerReference();
org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI address =
consumerRef.addNewAddress();
address.setStringValue(createEpr(consumerURL).getAddress());
TopicExpressionType topicExpr = subscribe.addNewTopicExpression();
topicExpr.setDialect(TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE.toString());
XmlBeanUtils.setValueAsQName(topicExpr, topic);
XmlObject response = sendRequest(requestDoc,
"http://xyz.com/action/Subscribe", createEpr(serviceEPRURL));
if (!(response instanceof
SubscribeResponseDocument.SubscribeResponse))
{
return false;
}
else
{
return true;
}
}
My question is whether the events provider (which is sending the
notifications) supposed to send the notifications to a specific consumer
service instance?
I simply can't see anywhere in the subscribed document where a consumer
resource identifier is put in.
Asaf Lahav
VP R&D, Prima Grid LTD.
Cellular: 972-54-4717955
Phone: 972-3-6540255
Fax: 972-3-6540254
Re: Notifications related question
Posted by prateek jain <ja...@gmail.com>.
And..what if I want to subscribe to a particular resource instance?Like in
case of factory pattern???
How do I do it?Writing epr of instantied resource and reading it from file
from a Web service throws serialization exception.However the same epr when
read from the client,doesnt throws any exception?What could be the probable
reason of this exception?
Can someone shed some light on it?
Thanks
Regards
Prateek Jain
On 5/29/06, Asaf Lahav <as...@primagrid.com> wrote:
>
> I have been going through the pubscribe sample code and ran into (the
> attached) "RequestUtils.java".
>
>
>
> RequestUtils.java has the following function:
>
>
>
> * public static boolean invokeSubscribe(String consumerURL, String
> serviceEPRURL, String topicName)***
>
> * {***
>
> * QName topic = QName.valueOf(topicName);***
>
> * SubscribeDocument requestDoc =
> SubscribeDocument.Factory.newInstance();***
>
> * SubscribeDocument.Subscribe subscribe =
> requestDoc.addNewSubscribe();***
>
> * subscribe.setUseNotify(true);***
>
> * Calendar instance = Calendar.getInstance();***
>
> * instance.setTimeInMillis(instance.getTimeInMillis() + 2000000);**
> *
>
> * subscribe.setInitialTerminationTime(instance);***
>
> * org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceTypeconsumerRef =
> subscribe.addNewConsumerReference();***
>
> * org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI address
> = consumerRef.addNewAddress();***
>
> * address.setStringValue(createEpr(consumerURL).getAddress());***
>
> * TopicExpressionType topicExpr = subscribe.addNewTopicExpression
> ();***
>
> * topicExpr.setDialect(
> TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE.toString());***
>
> * XmlBeanUtils.setValueAsQName(topicExpr, topic);***
>
> * XmlObject response = sendRequest(requestDoc, "
> http://xyz.com/action/Subscribe", createEpr(serviceEPRURL));***
>
> * if (!(response instanceof
> SubscribeResponseDocument.SubscribeResponse))***
>
> * {***
>
> * return false;***
>
> * }***
>
> * else***
>
> * {***
>
> * return true;***
>
> * }***
>
> * }*
>
>
>
> My question is whether the events provider (which is sending the
> notifications) supposed to send the notifications to a specific consumer
> service instance?
>
> I simply can't see anywhere in the subscribed document where a consumer
> resource identifier is put in.
>
>
>
>
>
>
>
> *Asaf Lahav*
>
> *VP R&D, Prima Grid LTD.*
>
> Cellular: 972-54-4717955
>
> Phone: 972-3-6540255
>
> Fax: 972-3-6540254
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
>
>
--
Prateek Jain
"The way to succeed is to double your error rate."
<img src="http://i25.photobucket.com/albums/c86/sudipta_cht/mypic.gif"/>
Re: Notifications related question
Posted by Sal Campana <sc...@apache.org>.
Asaf Lahav wrote:
> How can a notification producer invoke the Notify operation on the
> notification consumer if the notification producer doesn't have the
> notification consumer resource identifier?
>
>
>
>
>
> **Asaf Lahav**
>
> **VP R&D, Prima Grid LTD.**
>
> Cellular: 972-54-4717955
>
> Phone: 972-3-6540255
>
> Fax: 972-3-6540254
>
> ------------------------------------------------------------------------
>
> *From:* Asaf Lahav [mailto:asaf.lahav@primagrid.com]
> *Sent:* Monday, May 29, 2006 6:08 PM
> *To:* wsrf-user@ws.apache.org; 'Campana Jr., Salvatore J'
> *Subject:* Notifications related question
>
>
>
> I have been going through the pubscribe sample code and ran into (the
> attached) "RequestUtils.java".
>
>
>
> RequestUtils.java has the following function:
>
>
>
> / public static boolean invokeSubscribe(String consumerURL, String
> serviceEPRURL, String topicName)/
>
> / {///
>
> / QName topic = QName.valueOf(topicName);///
>
> / SubscribeDocument requestDoc =
> SubscribeDocument.Factory.newInstance();///
>
> / SubscribeDocument.Subscribe subscribe =
> requestDoc.addNewSubscribe();///
>
> / subscribe.setUseNotify(true);///
>
> / Calendar instance = Calendar.getInstance();///
>
> / instance.setTimeInMillis(instance.getTimeInMillis() +
> 2000000);///
>
> / subscribe.setInitialTerminationTime(instance);///
>
> /
> org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType
> consumerRef = subscribe.addNewConsumerReference();///
>
> / org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI
> address = consumerRef.addNewAddress();///
>
> / address.setStringValue(createEpr(consumerURL).getAddress());///
>
> / TopicExpressionType topicExpr =
> subscribe.addNewTopicExpression();///
>
> /
> topicExpr.setDialect(TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE.toString());///
>
> / XmlBeanUtils.setValueAsQName(topicExpr, topic);///
>
> / XmlObject response = sendRequest(requestDoc,
> "http://xyz.com/action/Subscribe", createEpr(serviceEPRURL));///
>
> / if (!(response instanceof
> SubscribeResponseDocument.SubscribeResponse))///
>
> / {///
>
> / return false;///
>
> / }///
>
> / else///
>
> / {///
>
> / return true;///
>
> / }///
>
> / }///
>
>
>
> My question is whether the events provider (which is sending the
> notifications) supposed to send the notifications to a specific
> consumer service instance?
>
> I simply can't see anywhere in the subscribed document where a
> consumer resource identifier is put in.
>
>
>
>
>
>
>
> **Asaf Lahav**
>
> **VP R&D, Prima Grid LTD.**
>
> Cellular: 972-54-4717955
>
> Phone: 972-3-6540255
>
> Fax: 972-3-6540254
>
>
>
Asaf,
Basically we receive an epr in the subscribe request which points us at
the resource to send notifications to....
This is as per spec...
If you want to look at code, then take a look at SubscriptionHome in the
.../v2004_06 package (too long to write ;-) )....There you will see us
extract the EPR from the request.....
-S
---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org
RE: Notifications related question
Posted by Asaf Lahav <as...@primagrid.com>.
How can a notification producer invoke the Notify operation on the
notification consumer if the notification producer doesn't have the
notification consumer resource identifier?
Asaf Lahav
VP R&D, Prima Grid LTD.
Cellular: 972-54-4717955
Phone: 972-3-6540255
Fax: 972-3-6540254
_____
From: Asaf Lahav [mailto:asaf.lahav@primagrid.com]
Sent: Monday, May 29, 2006 6:08 PM
To: wsrf-user@ws.apache.org; 'Campana Jr., Salvatore J'
Subject: Notifications related question
I have been going through the pubscribe sample code and ran into (the
attached) "RequestUtils.java".
RequestUtils.java has the following function:
public static boolean invokeSubscribe(String consumerURL, String
serviceEPRURL, String topicName)
{
QName topic = QName.valueOf(topicName);
SubscribeDocument requestDoc =
SubscribeDocument.Factory.newInstance();
SubscribeDocument.Subscribe subscribe =
requestDoc.addNewSubscribe();
subscribe.setUseNotify(true);
Calendar instance = Calendar.getInstance();
instance.setTimeInMillis(instance.getTimeInMillis() + 2000000);
subscribe.setInitialTerminationTime(instance);
org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType
consumerRef = subscribe.addNewConsumerReference();
org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI address =
consumerRef.addNewAddress();
address.setStringValue(createEpr(consumerURL).getAddress());
TopicExpressionType topicExpr = subscribe.addNewTopicExpression();
topicExpr.setDialect(TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE.toString());
XmlBeanUtils.setValueAsQName(topicExpr, topic);
XmlObject response = sendRequest(requestDoc,
"http://xyz.com/action/Subscribe", createEpr(serviceEPRURL));
if (!(response instanceof
SubscribeResponseDocument.SubscribeResponse))
{
return false;
}
else
{
return true;
}
}
My question is whether the events provider (which is sending the
notifications) supposed to send the notifications to a specific consumer
service instance?
I simply can't see anywhere in the subscribed document where a consumer
resource identifier is put in.
Asaf Lahav
VP R&D, Prima Grid LTD.
Cellular: 972-54-4717955
Phone: 972-3-6540255
Fax: 972-3-6540254