< prev index next >

src/java.xml.ws/share/classes/javax/xml/ws/EndpointReference.java

Print this page


   1 /*
   2  * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  71  * type of endpoint reference being passed.
  72  * <p>
  73  * JAX-WS implementors are expected to extract the XML infoset
  74  * from an {@code EndpointReferece} using the
  75  * {@link EndpointReference#writeTo}
  76  * method.
  77  * <p>
  78  * JAXB will bind this class to xs:anyType. If a better binding
  79  * is desired, web services developers should use a concrete
  80  * subclass such as {@link W3CEndpointReference}.
  81  *
  82  * @see W3CEndpointReference
  83  * @see Service
  84  * @since 1.6, JAX-WS 2.1
  85  */
  86 @XmlTransient // to treat this class like Object as far as databinding is concerned (proposed JAXB 2.1 feature)
  87 public abstract class EndpointReference {
  88     //
  89     //Default constructor to be only called by derived types.
  90     //




  91     protected EndpointReference(){}
  92 
  93     /**
  94      * Factory method to read an EndpointReference from the infoset contained in
  95      * {@code eprInfoset}. This method delegates to the vendor specific
  96      * implementation of the {@link javax.xml.ws.spi.Provider#readEndpointReference} method.
  97      *
  98      * @param eprInfoset The {@code EndpointReference} infoset to be unmarshalled
  99      *
 100      * @return the EndpointReference unmarshalled from {@code eprInfoset}
 101      *    never {@code null}
 102      * @throws WebServiceException
 103      *    if an error occurs while creating the
 104      *    {@code EndpointReference} from the {@code eprInfoset}
 105      * @throws java.lang.IllegalArgumentException
 106      *     if the {@code null} {@code eprInfoset} value is given.
 107      */
 108     public static EndpointReference readFrom(Source eprInfoset) {
 109         return Provider.provider().readEndpointReference(eprInfoset);
 110     }


 133      * the service endpoint interface that is supported by the
 134      * returned proxy.
 135      * The {@code EndpointReference} instance specifies the
 136      * endpoint that will be invoked by the returned proxy.
 137      * In the implementation of this method, the JAX-WS
 138      * runtime system takes the responsibility of selecting a protocol
 139      * binding (and a port) and configuring the proxy accordingly from
 140      * the WSDL Metadata from this {@code EndpointReference} or from
 141      * annotations on the {@code serviceEndpointInterface}.  For this method
 142      * to successfully return a proxy, WSDL metadata MUST be available and the
 143      * {@code EndpointReference} instance MUST contain an implementation understood
 144      * {@code serviceName} metadata.
 145      * <p>
 146      * Because this port is not created from a {@code Service} object, handlers
 147      * will not automatically be configured, and the {@code HandlerResolver}
 148      * and {@code Executor} cannot be get or set for this port. The
 149      * {@code BindingProvider().getBinding().setHandlerChain()}
 150      * method can be used to manually configure handlers for this port.
 151      *
 152      *

 153      * @param serviceEndpointInterface Service endpoint interface
 154      * @param features  An array of {@code WebServiceFeatures} to configure on the
 155      *                proxy.  Supported features not in the {@code features
 156      *                } parameter will have their default values.
 157      * @return Object Proxy instance that supports the
 158      *                  specified service endpoint interface
 159      * @throws WebServiceException
 160      *                  <UL>
 161      *                  <LI>If there is an error during creation
 162      *                      of the proxy
 163      *                  <LI>If there is any missing WSDL metadata
 164      *                      as required by this method
 165      *                  <LI>If this
 166      *                      {@code endpointReference}
 167      *                      is invalid
 168      *                  <LI>If an illegal
 169      *                      {@code serviceEndpointInterface}
 170      *                      is specified
 171      *                  <LI>If a feature is enabled that is not compatible with
 172      *                      this port or is unsupported.
 173      *                   </UL>
 174      *
 175      * @see java.lang.reflect.Proxy
 176      * @see WebServiceFeature
 177      **/
 178     public <T> T getPort(Class<T> serviceEndpointInterface,
 179                          WebServiceFeature... features) {
 180         return Provider.provider().getPort(this, serviceEndpointInterface,
 181                                            features);
 182     }
 183 
 184     /**
 185      * Displays EPR infoset for debugging convenience.


 186      */

 187     public String toString() {
 188         StringWriter w = new StringWriter();
 189         writeTo(new StreamResult(w));
 190         return w.toString();
 191     }
 192 }
   1 /*
   2  * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  71  * type of endpoint reference being passed.
  72  * <p>
  73  * JAX-WS implementors are expected to extract the XML infoset
  74  * from an {@code EndpointReferece} using the
  75  * {@link EndpointReference#writeTo}
  76  * method.
  77  * <p>
  78  * JAXB will bind this class to xs:anyType. If a better binding
  79  * is desired, web services developers should use a concrete
  80  * subclass such as {@link W3CEndpointReference}.
  81  *
  82  * @see W3CEndpointReference
  83  * @see Service
  84  * @since 1.6, JAX-WS 2.1
  85  */
  86 @XmlTransient // to treat this class like Object as far as databinding is concerned (proposed JAXB 2.1 feature)
  87 public abstract class EndpointReference {
  88     //
  89     //Default constructor to be only called by derived types.
  90     //
  91 
  92     /**
  93      * Default constructor.
  94      */
  95     protected EndpointReference(){}
  96 
  97     /**
  98      * Factory method to read an EndpointReference from the infoset contained in
  99      * {@code eprInfoset}. This method delegates to the vendor specific
 100      * implementation of the {@link javax.xml.ws.spi.Provider#readEndpointReference} method.
 101      *
 102      * @param eprInfoset The {@code EndpointReference} infoset to be unmarshalled
 103      *
 104      * @return the EndpointReference unmarshalled from {@code eprInfoset}
 105      *    never {@code null}
 106      * @throws WebServiceException
 107      *    if an error occurs while creating the
 108      *    {@code EndpointReference} from the {@code eprInfoset}
 109      * @throws java.lang.IllegalArgumentException
 110      *     if the {@code null} {@code eprInfoset} value is given.
 111      */
 112     public static EndpointReference readFrom(Source eprInfoset) {
 113         return Provider.provider().readEndpointReference(eprInfoset);
 114     }


 137      * the service endpoint interface that is supported by the
 138      * returned proxy.
 139      * The {@code EndpointReference} instance specifies the
 140      * endpoint that will be invoked by the returned proxy.
 141      * In the implementation of this method, the JAX-WS
 142      * runtime system takes the responsibility of selecting a protocol
 143      * binding (and a port) and configuring the proxy accordingly from
 144      * the WSDL Metadata from this {@code EndpointReference} or from
 145      * annotations on the {@code serviceEndpointInterface}.  For this method
 146      * to successfully return a proxy, WSDL metadata MUST be available and the
 147      * {@code EndpointReference} instance MUST contain an implementation understood
 148      * {@code serviceName} metadata.
 149      * <p>
 150      * Because this port is not created from a {@code Service} object, handlers
 151      * will not automatically be configured, and the {@code HandlerResolver}
 152      * and {@code Executor} cannot be get or set for this port. The
 153      * {@code BindingProvider().getBinding().setHandlerChain()}
 154      * method can be used to manually configure handlers for this port.
 155      *
 156      *
 157      * @param <T> Service endpoint interface
 158      * @param serviceEndpointInterface Service endpoint interface
 159      * @param features  An array of {@code WebServiceFeatures} to configure on the
 160      *                proxy.  Supported features not in the {@code features
 161      *                } parameter will have their default values.
 162      * @return Object Proxy instance that supports the
 163      *                  specified service endpoint interface
 164      * @throws WebServiceException
 165      *                  <UL>
 166      *                  <LI>If there is an error during creation
 167      *                      of the proxy
 168      *                  <LI>If there is any missing WSDL metadata
 169      *                      as required by this method
 170      *                  <LI>If this
 171      *                      {@code endpointReference}
 172      *                      is invalid
 173      *                  <LI>If an illegal
 174      *                      {@code serviceEndpointInterface}
 175      *                      is specified
 176      *                  <LI>If a feature is enabled that is not compatible with
 177      *                      this port or is unsupported.
 178      *                   </UL>
 179      *
 180      * @see java.lang.reflect.Proxy
 181      * @see WebServiceFeature
 182      **/
 183     public <T> T getPort(Class<T> serviceEndpointInterface,
 184                          WebServiceFeature... features) {
 185         return Provider.provider().getPort(this, serviceEndpointInterface,
 186                                            features);
 187     }
 188 
 189     /**
 190      * Displays EPR infoset for debugging convenience.
 191      *
 192      * @return a string representation of the object
 193      */
 194     @Override
 195     public String toString() {
 196         StringWriter w = new StringWriter();
 197         writeTo(new StreamResult(w));
 198         return w.toString();
 199     }
 200 }
< prev index next >