This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Services and the fly likes WebService using Local Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "WebService using Local Interface" Watch "WebService using Local Interface" New topic
Author

WebService using Local Interface

Pratul Chakre
Greenhorn

Joined: Oct 27, 2003
Posts: 18
Hi,

I created a WSDL for an EJB, for it to be used as a WebService. I used the SOAP/HTTP protocol.

Now, what I understand ( I am a newbie to WebServices), that the endpoint for the WebService is the Remote Interface of the bean. That is, if I have a bean named myPackage.Sample and the various bean classes as:

myPackage.Sample (Remote)
myPackage.SampleHome (Home Intf)
myPackage.SampleBean (Bean)
myPackage.SampleLocal (Local Intf)
myPackage.SampleLocalHome (Local Home)

the WebService would be exposed using the myPackage.Sample remote interface.

What I am trying to understand is whether I can have the WebService exposed over the local interface i.e. myPackage.SampleLocal.

I am trying this to explore that if the client and the WebServices are co-located in the same VM, then what are the different endpoints that can be defined for them to communicate.

Could somebody please help me in this regard? Also, if there are any samples/documentation/books on how this and other WebServices work in general would also be helpful.

Thanks & Regards,
Pratul Chakre
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Pratul Chakre:
I created a WSDL for an EJB, for it to be used as a WebService. I used the SOAP/HTTP protocol.


Interesting � usually you define the endpoint interface first and have your application server tools generated the WSDL for you.

Originally posted by Pratul Chakre:
�whether I can have the WebService exposed over the local interface i.e. myPackage.SampleLocal.


Yes you can (but should you?).

Supply the SLSB (implementing javax.ejb.SessionBean)

Expose as a EJB service endpoint:
  • Supply the Endpoint Interface (implementing javax.rmi.Remote)

  • EJB 2.1 Web Services: Part1

    Expose as a remote stateless session bean:
  • Supply the Component Interface (implementing javax.ejb.EJBObject; note that this will automatically implement javax.rmi.Remote. Theoretically a component interface could serve as an endpoint interface)
  • Supply the Home Interface (implementing javax.ejb.EJBHome)


  • Expose as a local stateless session bean:
  • Supply the Local Component Interface (implementing javax.ejb.EJBLocalObject)
  • Supply the Local Home Interface (implementing javax.ejb.EJBLocalHome)


  • However before doing so, carefully consider the architectural implications:
    SLB-local, home, endpoint interface
    Local Client vs. Remote Client
    Pratul Chakre
    Greenhorn

    Joined: Oct 27, 2003
    Posts: 18
    Thank you Peer, for your explanations.

    I am using WSAD v5.1 to create the WebServices out of an EJB. And I am not able to set the Local Interface of my bean as the SEI for the WebService.

    Also, using the IDE to create my WebServices, a whole bunch of files are created (eg: webservices.xml, webservicesclient.xml, etc). Though I know and have understaood what these files individually stand for, what I have not been able to relate is how all these components come together when a client initiates a request to the WebService.

    Pardon me if this questions sounds very basic but I am new to the WebServices world. Using IDE, though reduces the work during development time, it really has not helped me to understand the concept of WebServices as a whole and the exact path of execution when a client calls a WebService using SOAP/HTTP.

    Any pointers in this directions would be of great help (books, documents, etc).

    Thanks in adavnce.
    Pratul Chakre
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2922
        
        5
    Originally posted by Pratul Chakre:
    Using IDE, though reduces the work during development time, it really has not helped me to understand the concept of WebServices as a whole and the exact path of execution when a client calls a WebService using SOAP/HTTP.
    Any pointers in this directions would be of great help (books, documents, etc).


    A good IDE doesn�t necessarily help you learn a new area, but it should increase the productivity of the developer that is already competent in that area � this is a point that seems to be lost on some people. There are many technical endeavors that are much easier learned by getting your hands dirty � at least initially, and in my personal opinion Web Services is one of them. It doesn�t help that each vendor puts their own spin on things by changing deployment descriptor names, filenames, etc. from what they are in the initial specifications.

    You may want to check out this topic (ignore the title � and yes the suggestions are heavily slanted toward SCDJWS preparation, so just pick what you like).

    Files to create a Java web services by hand
    [ June 29, 2006: Message edited by: Peer Reynders ]
    Pratul Chakre
    Greenhorn

    Joined: Oct 27, 2003
    Posts: 18
    Thank you Peer! I have just started looking into the docs and it has helped me a lot to understand stuff.



    Thank you once again !

    Regards,
    Pratul Chakre
     
     
    subject: WebService using Local Interface