FileDocCategorySizeDatePackage
W3CEndpointReferenceBuilder.javaAPI DocJava SE 6 API10189Tue Jun 10 00:27:16 BST 2008javax.xml.ws.wsaddressing

W3CEndpointReferenceBuilder

public final class W3CEndpointReferenceBuilder extends Object
This class is used to build W3CEndpointReference instances. The intended use of this clsss is for an application component, for example a factory component, to create an W3CEndpointReference for a web service endpoint published by the same Java EE application. It can also be used to create W3CEndpointReferences for an Java SE based endpoint by providing the address property.

When creating a W3CEndpointReference for an endpoint that is not published by the same Java EE application, the address property MUST be specified.

When creating a W3CEndpointReference for an endpoint published by the same Java EE application, the address property MAY be null but then the serviceName and endpointName MUST specify an endpoint published by the same Java EE application.

When the wsdlDocumentLocation is specified it MUST refer to a valid WSDL document and the serviceName and endpointName (if specified) MUST match a service and port in the WSDL document.

since
JAX-WS 2.1

Fields Summary
private String
address
private List
referenceParameters
private List
metadata
private QName
serviceName
private QName
endpointName
private String
wsdlDocumentLocation
Constructors Summary
public W3CEndpointReferenceBuilder()
Creates a new W3CEndpointReferenceBuilder instance.

        referenceParameters = new ArrayList<Element>();
        metadata = new ArrayList<Element>();
    
Methods Summary
public javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilderaddress(java.lang.String address)
Sets the address to the W3CEndpointReference instance's wsa:Address.

The address MUST be set to a non-null value when building a W3CEndpointReference for a web service endpoint that is not published by the same Java EE application or when running on Java SE.

param
address The address of the endpoint to be targeted by the returned W3CEndpointReference.
return
A W3CEndpointReferenceBuilder instance with the address set to the wsa:Address.

        this.address = address;
        return this;
    
public javax.xml.ws.wsaddressing.W3CEndpointReferencebuild()
Builds a W3CEndpointReference from the accumulated properties set on this W3CEndpointReferenceBuilder instance.

This method can be used to create a W3CEndpointReference for any endpoint by specifying the address property along with any other desired properties. This method can also be used to create a W3CEndpointReference for an endpoint that is published by the same Java EE application. This method can automatically determine the address of an endpoint published by the same Java EE application that is identified by the serviceName and endpointName properties. If the address is null and the serviceName and endpointName do not identify an endpoint published by the same Java EE application, a java.lang.IllegalStateException MUST be thrown.

return
W3CEndpointReference from the accumulated properties set on this W3CEndpointReferenceBuilder instance. This method never returns null.
throws
java.lang.IllegalStateException
  • If the address, serviceName and endpointName are all null.
  • If the serviceName service is null and the endpointName is NOT null.
  • If the address property is null and the serviceName and endpointName do not specify a valid endpoint published by the same Java EE application.
  • If the serviceName is NOT null and is not present in the specified WSDL.
  • If the endpointName port is not null and it is not present in serviceName service in the WSDL.
  • If the wsdlDocumentLocation is NOT null and does not represent a valid WSDL.
throws
WebServiceException If an error occurs while creating the W3CEndpointReference.

        return Provider.provider().createW3CEndpointReference(address,
                serviceName, endpointName, metadata, wsdlDocumentLocation,
                referenceParameters);
    
public javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilderendpointName(javax.xml.namespace.QName endpointName)
Sets the endpointName of the endpoint to be targeted by the returned W3CEndpointRefernce. This method can only be called after the {@link #serviceName} method has been called.

param
endpointName The name of the endpoint to be targeted by the returned W3CEndpointReference. The endpointName (portName) property may also be used with the serviceName property to lookup the address of a web service endpoint published by the same Java EE application.
return
A W3CEndpointReferenceBuilder instance with the endpointName property set.
throws
java.lang.IllegalStateException If the serviceName has not been set.

        if (serviceName == null) {
            throw new IllegalStateException("The W3CEndpointReferenceBuilder's serviceName must be set before setting the endpointName: "+endpointName);
        }
        
        this.endpointName = endpointName;
        return this;
    
public javax.xml.ws.wsaddressing.W3CEndpointReferenceBuildermetadata(org.w3c.dom.Element metadataElement)
Adds the metadataElement to the W3CEndpointReference instance's wsa:Metadata element.

param
metadataElement The element to be added to the wsa:Metadata element.
return
A W3CEndpointReferenceBuilder instance with the metadataElement added to the wsa:Metadata element.
throws
java.lang.IllegalArgumentException if metadataElement is null.

        if (metadataElement == null)
            throw new java.lang.IllegalArgumentException("The metadataElement cannot be null.");
        metadata.add(metadataElement);
        return this;
    
public javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilderreferenceParameter(org.w3c.dom.Element referenceParameter)
Adds the referenceParameter to the W3CEndpointReference instance wsa:ReferenceParameters element.

param
referenceParameter The element to be added to the wsa:ReferenceParameters element.
return
A W3CEndpointReferenceBuilder instance with the referenceParameter added to the wsa:ReferenceParameters element.
throws
java.lang.IllegalArgumentException if referenceParameter is null.

        if (referenceParameter == null)
            throw new java.lang.IllegalArgumentException("The referenceParameter cannot be null.");
        referenceParameters.add(referenceParameter);
        return this;
    
public javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilderserviceName(javax.xml.namespace.QName serviceName)
Sets the serviceName of the endpoint to be targeted by the returned W3CEndpointReference.

param
serviceName The service name of the endpoint to be targeted by the returned W3CEndpointReference. This property may also be used with the endpointName (portName) property to lookup the address of a web service endpoint that is published by the same Java EE application.
return
A W3CEndpointReferenceBuilder instance with the serviceName property set.

        this.serviceName = serviceName;
        return this;
    
public javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilderwsdlDocumentLocation(java.lang.String wsdlDocumentLocation)
Sets the wsdlDocumentLocation associated with the targeted W3CEndpointReference.

param
wsdlDocumentLocation The location of the WSDL document associated with the targeted W3CEndpointReference.
return
A W3CEndpointReferenceBuilder instance with the wsdlDocumentLocation property set.

        this.wsdlDocumentLocation = wsdlDocumentLocation;
        return this;