none
External Publish Subscribe WCF Service - question on writing the consumer (subscriber part)... RRS feed

  • Question

  • I have to consume an external Java web service that is using a publish subscribe message exchange pattern.  I was told that I have to pass my endpoint url where I want data to be received, and I have to implement the Notify operation in the Web Service Base Notification v1.3 specification, and I will start receiving data after I send my initial subscription request.  Consuming the service and sending the subscription is all well and good, the question is, what exactly is the Notify operation and how do I implement it programatically so that the external service knows where/how to send me the data?  The data they are sending is of a specific object type, so logically I would think I just need to have a wcf service hosted that has a publically accessible method which accepts the data object?
    Wednesday, January 9, 2013 9:24 PM

Answers

  • Quick answer is yes.

    Here is a link to the Web Service Base Notification v1.3 specification, which if you haven't read through I would recommend doing, since I will use some of the terms from that specification in some my comments below.

    http://docs.oasis-open.org/wsn/wsn-ws_base_notification-1.3-spec-os.htm

    To allow the NotificationProducer (the java web service) to push Notifications via literal HTTP POSTs of XML documents to your NotificationConsumer service (the wcf web service), then yes your NotificationConsumer would need to be a RESTful WCF Web service.

    Here is a link to an overview REST with WCF Web Services, which I would recommend reviewing if this is your first time with RESTfel WCF services, as it provides implementation level details that you will need to make this work.  This will show you how to map what method (service operation) the HTTP POST is routed to.

    http://msdn.microsoft.com/en-us/magazine/dd315413.aspx

    Here is an existing post with some code samples as well that demonstrates someone working through an HTTP POST of a file to a WCF Web Service.

    http://social.msdn.microsoft.com/Forums/eu/wcf/thread/39e18c76-a395-4ba9-af4d-4a6ed9f26d79

    Hope this helps!


    • Edited by BotHead Saturday, January 12, 2013 8:29 PM
    • Marked as answer by Pork_Chop_Express Sunday, January 13, 2013 6:24 AM
    Saturday, January 12, 2013 8:28 PM

All replies

  • If it is true that the external java web service provider wants you to pass an endpoint URI so that they intern can create a client connection to it, then yes you would need to host your own WCF service at the endpoint URI for them to connect to and start passing you data.  They will need to provide you with the WSDL of the service data contracts (which is sounds like they already have and you are already using), implement that service interface and host the service.

    Here is a link to some existing WCF contract definitions for the Web Service Base Notification v1.3 specification:

    http://commoncontracts.codeplex.com/workitem/247

    WCF handles duplex relationships like this very well under the hood for you, however when crossing the interopable boundaries to something like java there seems to be some debate about getting this done effectively.  Here is a post to what I am talking about...

    http://stackoverflow.com/questions/3915702/wcf-callback-is-it-interoperable-with-java

    Hope this helps.

    Wednesday, January 9, 2013 10:13 PM
  • Thanks for the info. In terms of the uri I provide them to connect to, how will they map it to the specific method? For example, the uri format of the wcf service I am hosting is of format "http://someservice/report.svc", wherein a public method is provided. Is this possible for them if they don't generate a proxy class?
    Friday, January 11, 2013 12:39 AM
  • Yes, it is possible, they could be manually assembling the SOAP message and trasmitting it to your service endpoint at that URI.  As long as it is correctly formatted WCF will do all the work for you of dismanlting that SOAP message and invoking the proper method (service operation) on your service, and visa-versa when you call your client proxy WCF will assemble a SOAP message and trasmit it to their service.

    Friday, January 11, 2013 4:42 PM
  • They just told me they are going to post an XML doc to the uri address I supply them.  To allow for that, should my hosting service just be WFC Rest?
    Friday, January 11, 2013 8:39 PM
  • Quick answer is yes.

    Here is a link to the Web Service Base Notification v1.3 specification, which if you haven't read through I would recommend doing, since I will use some of the terms from that specification in some my comments below.

    http://docs.oasis-open.org/wsn/wsn-ws_base_notification-1.3-spec-os.htm

    To allow the NotificationProducer (the java web service) to push Notifications via literal HTTP POSTs of XML documents to your NotificationConsumer service (the wcf web service), then yes your NotificationConsumer would need to be a RESTful WCF Web service.

    Here is a link to an overview REST with WCF Web Services, which I would recommend reviewing if this is your first time with RESTfel WCF services, as it provides implementation level details that you will need to make this work.  This will show you how to map what method (service operation) the HTTP POST is routed to.

    http://msdn.microsoft.com/en-us/magazine/dd315413.aspx

    Here is an existing post with some code samples as well that demonstrates someone working through an HTTP POST of a file to a WCF Web Service.

    http://social.msdn.microsoft.com/Forums/eu/wcf/thread/39e18c76-a395-4ba9-af4d-4a6ed9f26d79

    Hope this helps!


    • Edited by BotHead Saturday, January 12, 2013 8:29 PM
    • Marked as answer by Pork_Chop_Express Sunday, January 13, 2013 6:24 AM
    Saturday, January 12, 2013 8:28 PM
  • Perfect. Thanks for the info!
    Sunday, January 13, 2013 6:25 AM