• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create a notification webservice

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
can anybody suggest me that how can I create a small notification web-service.I have created a web service based upon request/response paradigm but now I have to receive some notification from my service.Please forward me some URL so that I can study
Thanks
Vijay kumar
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are looking for a solution that will send notification to client(from webservices server) on a peroidical basis, then have a look at Quartz[http://www.opensymphony.com/quartz/] or Java Timer.
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Balaji but I want to create my own notification web-service.Please suggest me how to prepare wsdl & what are the chnages required for client and server side for notifications.
Thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain to us how such a service would work? Would it sit on a server, and make WS calls at certain times or intervals? WHat would trigger it? How would it know whom to notify?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first questions that occur to me:

What facilities are your clients going to have? Will they have a client program running all the time?

Are they always connected to the same local network as the server or is connectivity through the Internet.

This might be a case for Java Message Service and a publish/subscribe messaging approach but we need more information.

Bill
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,William
thanks for the reply. scenario is something like
1) The client will be available from login to logout.
2) Client will be identified with a unique session-id.
3) Server is always on
Flow is something like

client 1 ------login()--------------> S
<-----session-id------------- E
R <-- notifications--THIRD PARTY

client 2------login()--------------> V
<-----session-id------------- E
R
4) Here client is a SOAP client and server is notification web-service , which receives notification from external server. This web-services will send a notification to the client as soon it receives any notification from Third party.
I hope I am able to tell you what I want to implement

Thanks
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vijay Kumar:
This web-services will send a notification to the client as soon it receives any notification from Third party.



How will the web service send this notification (or more to the point: how will the client receive the notification)? While a WSDL can express the notification message pattern, an HTTP-based web service can only respond to client requests. The web service can only solicit (i.e. send a request to) the "client", if that "client" is also a web service (running its own web server ***). Alternately you could send the notification via SMTP or JMS.

Asynchronous operations and Web services, Part 2
8.4.3 Refactoring Synchronous to Asynchronous Interactions


*** which is exactly what BEA does - though the container's single web server can host any number of end points for the applications that it hosts. In more complicated scenarios a client application may need to register a "forwarding address" with an allied Web Service Server before engaging with another asynchronous web service so that the allied Web Server can bridge any incoming notifications or solicitation/responses.

Creating Callback Enabled Clients for Asynchronous Web Services

Web service callbacks refer to scenarios that involve the web service provider sending a SOAP message back to its clients. The Web Services Description Language (WSDL) specifications define such operations as being of the type �solicit/response.� Clients of web services that support callback operations must have a web service endpoint themselves, which the web service can use for sending callback requests at any point in time, or, in other words, asynchronously.


[ May 22, 2007: Message edited by: Peer Reynders ]
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peer Reynders thanks for your valuable suggession.for this how can I design wsdl file. can I have a example.I think that generated classes should have some classes in which I have to implement callback.
please correct me if I am wrong
Thanks
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peer Reynders thanks for your valuable suggession.for this how can I design wsdl file. can I have a example.I think that generated classes should have some classes in which I have to implement callback.
please correct me if I am wrong
Thanks
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vijay Kumar:
for this how can I design wsdl file.



I'm not quite sure what your question is - I proposed multiple solutions two of which (SMTP,JMS) have no impact on the WSDL because the asynchronous communication happens outside of the web services protocol.

Some vendors use WSCL (Web Services Conversation Language) to specify the protocol between two interacting web services. However support of WSCL is not that widespread. Without WSCL you need two WSDLs - one provider WSDL and one callback WSDL. The provider WSDL defines the SOAP messages that are needed for the requestor web service to make contact with the provider web service. At least one of the SOAP messages defined in the provider WSDL must carry the address for the requestor web service endpoint that can accept the notifications/solicitations from the provider web service. The callback WSDL defines the endpoint interface that the requestor web service must implement so that the provider web service can contact it. The callback WSDL also contains the definition of the solicitation/notification messages. (This is basically the Pattern 4: Request/Reply operations with posting scenario).

A simpler but less efficient scenario is Pattern 3: Request/Reply operations with polling - however the requestor doesn't need to be web service. In this case the requestor would send a "registration" message to the provider web service. The provider would respond with a Correlation Identifier. Then the requestor would send periodically (every five minutes, hour, day ...) another message type (specifying its Correlation Identifier) to check whether the provider web service has a notification waiting for it. As a result:
  • The requestor will not receive the notification until it requests to see it. So the polling period defines the maximum lag for the notification.
  • The provider web service may be loaded with many (unnecessary) requests for notifications.


  • [ May 23, 2007: Message edited by: Peer Reynders ]
     
    Vijay Kumar
    Ranch Hand
    Posts: 260
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi,Reynders
    Thanks for your posts,but I don't have to implemets the JMS/SMTP.According to my requirment I have to receive the notification from server.I read out from the web-services (http://www.w3.org/TR/wsdl).There are the four type of operations
    1) One-way Operation 2) Request-response Operation 3) Solicit-response Operation 4) Notification Operation.I just want to implemet the fourth one.Theortically it is written but I am looking a simple example.
    Thanks
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Vijay Kumar:
    3) Solicit-response Operation 4) Notification Operation. I just want to implement the fourth one.



    Type 3 and 4 cannot be implemented if HTTP is the transport protocol due to the inherent limitations of HTTP - the HTTP-client can contact the HTTP-server - the HTTP-server cannot contact the HTTP-client, it can only respond to the HTTP client's requests.

    The WSDL specification makes no assumption about the transport protocol used and therefore is oblivious to the inherent limitations. Just because the WSDL lets you specify a messaging pattern doesn't automatically imply that the specified transport protocol can support that messaging pattern. The binding element in the WSDL specifies what transport protocol (and message format � it doesn�t have to be SOAP) you are using to implement your portType. In the binding for an HTTP-based web service you will see something like this:


    However other transport protocols can be specified, e.g.:


    The WSDL transmission primitives are expressed by the combination and order of the input and output messages in each operation definition within the portType:
  • One way: input
  • Request-Response: input, output
  • Solicit-Response: output, input
  • Notification: output


  • For a SOAP over HTTP binding:
  • One way: not directly supported as there is always a HTTP request-response pair. However this is simply solved by sending a SOAP-request in the HTTP-request, while leaving the HTTP-response empty (i.e. it does not contain a SOAP-response).
  • Request-Response: Supported. The HTTP-request carries the SOAP-request, the HTTP-response contains the SOAP-response.
  • Solicit-Response: NOT SUPPORTED. There is no way for the HTTP-server to initiate contact with the HTTP-client.
  • Notification: NOT SUPPORTED. There is no way for the HTTP-server to initiate contact with the HTTP-client.


  • So the WSDL will let you specify a portType (interface) that the transport in your binding cannot handle.

    With HTTP-based web services it is necessary to mimic the type 3 and 4 transmission primitives indirectly either by using a separate standard like WSCL or by using the patterns outlined in Pattern 3: Request/reply operations with polling and Pattern 4: Request/Reply operations with posting. WSCL and Pattern 4 require that both participating parties are web services - not merely web service client and web service.
    [ May 25, 2007: Message edited by: Peer Reynders ]
     
    reply
      Bookmark Topic Watch Topic
    • New Topic