This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Difference between Endpoint and EndpointReference" Watch "Difference between Endpoint and EndpointReference" New topic

Difference between Endpoint and EndpointReference

Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1340

I want to know the difference between Endpoint and EndpointReference.

Oracle certified Java 8 Programmer I (1Z0-808), 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, CIW Certified Ecommerce specialist
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper

Joined: Apr 07, 2010
Posts: 2007

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=""><Address>http://Localhost:8080/MultiplyWS/AddWSService</Address><Metadata wsdli:wsdlLocation=" http://Localhost:8080/MultiplyWS/AddWSService?wsdl" xmlns:wsdli=""><wsam:InterfaceName xmlns:ns2="" xmlns:wsa="" xmlns:ns3="" xmlns:wsaw="" xmlns:wsns="" xmlns:wsam="">wsns:AddWS</wsam:InterfaceName><wsam:ServiceName EndpointName="AddWSPort" xmlns:ns2="" xmlns:wsa="" xmlns:ns3="" xmlns:wsaw="" xmlns:wsns="" xmlns:wsam="">wsns:AddWSService</wsam:ServiceName></Metadata></EndpointReference>

And the browser will show:
Servlet AddServlet at /MultiplyWS

Add 4+3: 7

Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1340

Hi Frits

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

I passed 1z0-897 exam today -
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Difference between Endpoint and EndpointReference
It's not a secret anymore!