• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between Endpoint and EndpointReference

 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I want to know the difference between Endpoint and EndpointReference.
thanks
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2453
97
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic