If an endpoint needs to create an endpoint reference that
represents itself, use the getEndpointReference method of the web
service context object, passing in an Element object representing
the reference parameters to be associated with the endpoint reference
(or a null object if you do not want to specify
any reference parameters). By default, this method creates
a W3CEndpointReference object. If you want to create a SubmissionEndpointReference
object, representing an endpoint that conforms to the 2004/08 WS-Addressing
specification, pass the endpoint reference type as a parameter.
For example, the following code fragment uses the getEndpointReference
method to return a W3CEndpointRerence object that has a ticket ID
associated with it:...
@WebService(name="Calculator",
targetNamespace="http://calculator.org")
public class Calculator {
@Resource
WebServiceContext wsc;
...
// Create the ticket id
element = document.createElementNS(
"http://calculator.jaxws.axis2.apache.org", "TicketId");
element.appendChild( document.createTextNode("123456789") );
...
public W3CEndpointReference getEPR() {
// Get the endpoint reference and associate the ticket id
// with it as a reference parameter
W3CEndpointReference epr = (W3CEndpointReference)wsc.getEndpointReference(element);
return epr;
}
...
The following line of code shows how to create a 2004/08
endpoint reference for the preceding sample:SubmissionEndpointReference epr = (SubmissionEndpointReference)
wsc.getEndpointReference(SubmissionEndpointReference.class, element);