File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Difference between Endpoint and EndpointReference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Difference between Endpoint and EndpointReference" Watch "Difference between Endpoint and EndpointReference" New topic
Author

Difference between Endpoint and EndpointReference

Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1000
    
    1

Hi
I want to know the difference between Endpoint and EndpointReference.
thanks


Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1529
    
  22

Hi Abhay,

The Endpoint is the address or connection point to a Web service. It is typically represented by a simple HTTP URL string.
The EndpointReference is a reference to itself (to this WebService)

Let me try to give you an easy example of the use of an EndpointReference.

We start with a WebService that adds two numbers, apart from that WebMethod there is also a method that returns the reference to itself:

Create an EJB (note that the EJB is invoking the add method again with different integers)

Create a Servlet where you will use both the WebService as the EJB:

When you run the example (don't forget to generate the client artifacts with wsimport), you will see the EJB logging to the console:
INFO: REFERENCE was handed over
INFO: adding 5+6:
INFO: 11
INFO: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><EndpointReference xmlns="http://www.w3.org/2005/08/addressing"><Address>http://Localhost:8080/MultiplyWS/AddWSService</Address><Metadata wsdli:wsdlLocation="http://math.ws/ http://Localhost:8080/MultiplyWS/AddWSService?wsdl" xmlns:wsdli="http://www.w3.org/ns/wsdl-instance"><wsam:InterfaceName xmlns:ns2="http://math.ws/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:ns3="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsns="http://math.ws/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">wsns:AddWS</wsam:InterfaceName><wsam:ServiceName EndpointName="AddWSPort" xmlns:ns2="http://math.ws/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:ns3="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsns="http://math.ws/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">wsns:AddWSService</wsam:ServiceName></Metadata></EndpointReference>

And the browser will show:
Servlet AddServlet at /MultiplyWS

Add 4+3: 7

Regards,
Frits
Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1000
    
    1

Hi Frits

Thanks for the detailed reply. I shall definitely run this sample code at my end.

I passed 1z0-897 exam today - http://www.coderanch.com/t/627706/sr/certification/Passed-exam
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Endpoint and EndpointReference
 
Similar Threads
JAXWS : Service Enpoint Interface and the Service Endpoint Implementation class
ResourceBundle.getBundle() deadlock when called inside a synchronized thread
Servlet endpoint Vs EJB endpoint
What is difference between service and an endpoint..?
Web Service Multiple Endpoints