Java Code Examples for javax.xml.ws.Service#Mode

The following examples show how to use javax.xml.ws.Service#Mode . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Stubs.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a new {@link Dispatch} stub that connects to the given pipe.
 *
 * @param portInfo
 *      see <a href="#param">common parameters</a>
 * @param owner
 *      see <a href="#param">common parameters</a>
 * @param binding
 *      see <a href="#param">common parameters</a>
 * @param clazz
 *      Type of the {@link Dispatch} to be created.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param mode
 *      The mode of the dispatch.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param epr
 *      see <a href="#param">common parameters</a>
 * TODO: are these parameters making sense?
 */
public static <T> Dispatch<T> createDispatch(WSPortInfo portInfo,
                                             WSService owner,
                                             WSBinding binding,
                                             Class<T> clazz, Service.Mode mode,
                                             @Nullable WSEndpointReference epr) {
    if (clazz == SOAPMessage.class) {
        return (Dispatch<T>) createSAAJDispatch(portInfo, binding, mode, epr);
    } else if (clazz == Source.class) {
        return (Dispatch<T>) createSourceDispatch(portInfo, binding, mode, epr);
    } else if (clazz == DataSource.class) {
        return (Dispatch<T>) createDataSourceDispatch(portInfo, binding, mode, epr);
    } else if (clazz == Message.class) {
        if(mode==Mode.MESSAGE)
            return (Dispatch<T>) createMessageDispatch(portInfo, binding, epr);
        else
            throw new WebServiceException(mode+" not supported with Dispatch<Message>");
    } else if (clazz == Packet.class) {
        if(mode==Mode.MESSAGE)
            return (Dispatch<T>) createPacketDispatch(portInfo, binding, epr);
        else
            throw new WebServiceException(mode+" not supported with Dispatch<Packet>");
    } else
        throw new WebServiceException("Unknown class type " + clazz.getName());
}
 
Example 2
Source File: DispatchImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void checkNullAllowed(@Nullable Object in, RequestContext rc, WSBinding binding, Service.Mode mode) {

        if (in != null)
            return;

        //With HTTP Binding a null invocation parameter can not be used
        //with HTTP Request Method == POST
        if (isXMLHttp(binding)){
            if (methodNotOk(rc))
                throw new WebServiceException(DispatchMessages.INVALID_NULLARG_XMLHTTP_REQUEST_METHOD(HTTP_REQUEST_METHOD_POST, HTTP_REQUEST_METHOD_GET));
        } else { //soapBinding
              if (mode == Service.Mode.MESSAGE )
                   throw new WebServiceException(DispatchMessages.INVALID_NULLARG_SOAP_MSGMODE(mode.name(), Service.Mode.PAYLOAD.toString()));
        }
    }
 
Example 3
Source File: DispatchImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPAYLOADMode(@NotNull Service.Mode mode) {
       return mode == Service.Mode.PAYLOAD;
}
 
Example 4
Source File: DispatchImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
static boolean isPAYLOADMode(@NotNull Service.Mode mode) {
       return mode == Service.Mode.PAYLOAD;
}
 
Example 5
Source File: JAXBDispatch.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Deprecated
public JAXBDispatch(QName port, JAXBContext jc, Service.Mode mode, WSServiceDelegate service, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
    super(port, mode, service, pipe, binding, epr);
    this.jaxbcontext = jc;
    this.isContextSupported = BindingContextFactory.isContextSupported(jc);
}
 
Example 6
Source File: WSServiceDelegate.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public Dispatch<Object> createDispatch(QName portName, JAXBContext jaxbContext, Service.Mode mode, WebServiceFeature... webServiceFeatures) {
    return createDispatch(portName, jaxbContext, mode, new WebServiceFeatureList(webServiceFeatures));
}
 
Example 7
Source File: WSServiceDelegate.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public <T> Dispatch<T> createDispatch(QName portName, Class<T> aClass, Service.Mode mode, WebServiceFeature... features) {
    return createDispatch(portName, aClass, mode, new WebServiceFeatureList(features));
}
 
Example 8
Source File: Stubs.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new JAXB-based {@link Dispatch} stub that connects to the given pipe.
 *
 * @param portInfo    see <a href="#param">common parameters</a>
 * @param binding     see <a href="#param">common parameters</a>
 * @param jaxbContext {@link JAXBContext} used to convert between objects and XML.
 * @param mode        The mode of the dispatch.
 *                    See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param epr         see <a href="#param">common parameters</a>
 */
public static Dispatch<Object> createJAXBDispatch(
        WSPortInfo portInfo, WSBinding binding,
        JAXBContext jaxbContext, Service.Mode mode,
        @Nullable WSEndpointReference epr) {
    return new JAXBDispatch(portInfo, jaxbContext, mode, (BindingImpl) binding, epr);
}
 
Example 9
Source File: DispatchImpl.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param portportInfo dispatch instance is associated with this wsdl port qName
 * @param mode    Service.mode associated with this Dispatch instance - Service.mode.MESSAGE or Service.mode.PAYLOAD
 * @param pipe    Master pipe for the pipeline
 * @param binding Binding of this Dispatch instance, current one of SOAP/HTTP or XML/HTTP
 * @param allowFaultResponseMsg A packet containing a SOAP fault message is allowed as the response to a request on this dispatch instance.
 */
protected DispatchImpl(WSPortInfo portInfo, Service.Mode mode, Tube pipe, BindingImpl binding, @Nullable WSEndpointReference epr, boolean allowFaultResponseMsg) {
    super(portInfo, binding, pipe, portInfo.getEndpointAddress(), epr);
    this.mode = mode;
    this.soapVersion = binding.getSOAPVersion();
    this.allowFaultResponseMsg = allowFaultResponseMsg;
}
 
Example 10
Source File: Stubs.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new JAXB-based {@link Dispatch} stub that connects to the given pipe.
 *
 * @param portInfo    see <a href="#param">common parameters</a>
 * @param binding     see <a href="#param">common parameters</a>
 * @param jaxbContext {@link JAXBContext} used to convert between objects and XML.
 * @param mode        The mode of the dispatch.
 *                    See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param epr         see <a href="#param">common parameters</a>
 */
public static Dispatch<Object> createJAXBDispatch(
        WSPortInfo portInfo, WSBinding binding,
        JAXBContext jaxbContext, Service.Mode mode,
        @Nullable WSEndpointReference epr) {
    return new JAXBDispatch(portInfo, jaxbContext, mode, (BindingImpl) binding, epr);
}
 
Example 11
Source File: DispatchImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param portportInfo dispatch instance is associated with this wsdl port qName
 * @param mode    Service.mode associated with this Dispatch instance - Service.mode.MESSAGE or Service.mode.PAYLOAD
 * @param pipe    Master pipe for the pipeline
 * @param binding Binding of this Dispatch instance, current one of SOAP/HTTP or XML/HTTP
 * @param allowFaultResponseMsg A packet containing a SOAP fault message is allowed as the response to a request on this dispatch instance.
 */
protected DispatchImpl(WSPortInfo portInfo, Service.Mode mode, Tube pipe, BindingImpl binding, @Nullable WSEndpointReference epr, boolean allowFaultResponseMsg) {
    super(portInfo, binding, pipe, portInfo.getEndpointAddress(), epr);
    this.mode = mode;
    this.soapVersion = binding.getSOAPVersion();
    this.allowFaultResponseMsg = allowFaultResponseMsg;
}
 
Example 12
Source File: DispatchImpl.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 *
 * @param port    dispatch instance is associated with this wsdl port qName
 * @param mode    Service.mode associated with this Dispatch instance - Service.mode.MESSAGE or Service.mode.PAYLOAD
 * @param owner   Service that created the Dispatch
 * @param pipe    Master pipe for the pipeline
 * @param binding Binding of this Dispatch instance, current one of SOAP/HTTP or XML/HTTP
 */
@Deprecated
protected DispatchImpl(QName port, Service.Mode mode, WSServiceDelegate owner, Tube pipe, BindingImpl binding, @Nullable WSEndpointReference epr) {
    super(port, owner, pipe, binding, (owner.getWsdlService() != null)? owner.getWsdlService().get(port) : null , owner.getEndpointAddress(port), epr);
    this.mode = mode;
    this.soapVersion = binding.getSOAPVersion();
    this.allowFaultResponseMsg = false;
}
 
Example 13
Source File: ServiceDelegate.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * Creates a <code>Dispatch</code> instance for use with objects of
 * the user's choosing.
 *
 * @param portName  Qualified name for the target service endpoint
 * @param type The class of object used for messages or message
 * payloads. Implementations are required to support
 * <code>javax.xml.transform.Source</code> and <code>javax.xml.soap.SOAPMessage</code>.
 * @param mode Controls whether the created dispatch instance is message
 * or payload oriented, i.e. whether the user will work with complete
 * protocol messages or message payloads. E.g. when using the SOAP
 * protocol, this parameter controls whether the user will work with
 * SOAP messages or the contents of a SOAP body. Mode MUST be <code>MESSAGE</code>
 * when type is <code>SOAPMessage</code>.
 *
 * @return Dispatch instance
 * @throws WebServiceException If any error in the creation of
 *                  the <code>Dispatch</code> object
 * @see javax.xml.transform.Source
 * @see javax.xml.soap.SOAPMessage
 **/
public abstract <T> Dispatch<T> createDispatch(QName portName, Class<T> type,
        Service.Mode mode);
 
Example 14
Source File: WSService.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Works like {@link #createDispatch(javax.xml.ws.EndpointReference, java.lang.Class, javax.xml.ws.Service.Mode, javax.xml.ws.WebServiceFeature[])}
 * but it takes the port name separately, so that EPR without embedded metadata can be used.
 */
public abstract <T> Dispatch<T> createDispatch(QName portName, WSEndpointReference wsepr, Class<T> aClass, Service.Mode mode, WebServiceFeature... features);
 
Example 15
Source File: Stubs.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new {@link Dispatch} stub for {@link DataSource}.
 *
 * This is short-cut of calling
 * <pre>
 * createDispatch(port,owner,binding,DataSource.class,mode,next);
 * </pre>
 */
public static Dispatch<DataSource> createDataSourceDispatch(WSPortInfo portInfo, WSBinding binding, Service.Mode mode,@Nullable WSEndpointReference epr) {
    DispatchImpl.checkValidDataSourceDispatch(binding, mode);
    return new DataSourceDispatch(portInfo, mode, (BindingImpl)binding, epr);
}
 
Example 16
Source File: ServiceDelegate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a <code>Dispatch</code> instance for use with objects of
 * the user's choosing.
 *
 * @param portName  Qualified name for the target service endpoint
 * @param type The class of object used for messages or message
 * payloads. Implementations are required to support
 * <code>javax.xml.transform.Source</code> and <code>javax.xml.soap.SOAPMessage</code>.
 * @param mode Controls whether the created dispatch instance is message
 * or payload oriented, i.e. whether the user will work with complete
 * protocol messages or message payloads. E.g. when using the SOAP
 * protocol, this parameter controls whether the user will work with
 * SOAP messages or the contents of a SOAP body. Mode MUST be <code>MESSAGE</code>
 * when type is <code>SOAPMessage</code>.
 * @param features  A list of <code>WebServiceFeatures</code> to configure on the
 *                proxy.  Supported features not in the <code>features
 *                </code> parameter will have their default values.
 *
 * @return Dispatch instance
 * @throws WebServiceException If any error in the creation of
 *                  the <code>Dispatch</code> object or if a
 *                  feature is enabled that is not compatible with
 *                  this port or is unsupported.
 *
 * @see javax.xml.transform.Source
 * @see javax.xml.soap.SOAPMessage
 * @see WebServiceFeature
 *
 * @since JAX-WS 2.1
 **/
public abstract <T> Dispatch<T> createDispatch(QName portName, Class<T> type,
        Service.Mode mode, WebServiceFeature... features);
 
Example 17
Source File: ServiceDelegate.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a <code>Dispatch</code> instance for use with JAXB
 * generated objects.
 *
 * @param portName  Qualified name for the target service endpoint
 * @param context The JAXB context used to marshall and unmarshall
 * messages or message payloads.
 * @param mode Controls whether the created dispatch instance is message
 * or payload oriented, i.e. whether the user will work with complete
 * protocol messages or message payloads. E.g. when using the SOAP
 * protocol, this parameter controls whether the user will work with
 * SOAP messages or the contents of a SOAP body.
 * @param features  A list of <code>WebServiceFeatures</code> to configure on the
 *                proxy.  Supported features not in the <code>features
 *                </code> parameter will have their default values.
 *
 * @return Dispatch instance
 * @throws WebServiceException If any error in the creation of
 *                  the <code>Dispatch</code> object or if a
 *                  feature is enabled that is not compatible with
 *                  this port or is unsupported.
 *
 * @see javax.xml.bind.JAXBContext
 * @see WebServiceFeature
 *
 * @since JAX-WS 2.1
 **/
public abstract Dispatch<Object> createDispatch(QName portName,
        JAXBContext context, Service.Mode mode, WebServiceFeature... features);
 
Example 18
Source File: ServiceDelegate.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a <code>Dispatch</code> instance for use with JAXB
 * generated objects.
 *
 * @param portName  Qualified name for the target service endpoint
 * @param context The JAXB context used to marshall and unmarshall
 * messages or message payloads.
 * @param mode Controls whether the created dispatch instance is message
 * or payload oriented, i.e. whether the user will work with complete
 * protocol messages or message payloads. E.g. when using the SOAP
 * protocol, this parameter controls whether the user will work with
 * SOAP messages or the contents of a SOAP body.
 * @param features  A list of <code>WebServiceFeatures</code> to configure on the
 *                proxy.  Supported features not in the <code>features
 *                </code> parameter will have their default values.
 *
 * @return Dispatch instance
 * @throws WebServiceException If any error in the creation of
 *                  the <code>Dispatch</code> object or if a
 *                  feature is enabled that is not compatible with
 *                  this port or is unsupported.
 *
 * @see javax.xml.bind.JAXBContext
 * @see WebServiceFeature
 *
 * @since JAX-WS 2.1
 **/
public abstract Dispatch<Object> createDispatch(QName portName,
        JAXBContext context, Service.Mode mode, WebServiceFeature... features);
 
Example 19
Source File: ServiceDelegate.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a <code>Dispatch</code> instance for use with objects of
 * the user's choosing. If there
 * are any reference parameters in the
 * <code>endpointReference</code>, then those reference
 * parameters MUST appear as SOAP headers, indicating them to be
 * reference parameters, on all messages sent to the endpoint.
 * The <code>endpointReference's</code> address MUST be used
 * for invocations on the endpoint.
 * In the implementation of this method, the JAX-WS
 * runtime system takes the responsibility of selecting a protocol
 * binding (and a port) and configuring the dispatch accordingly from
 * the WSDL associated with this <code>Service</code> instance or
 * from the metadata from the <code>endpointReference</code>.
 * If this <code>Service</code> instance has a WSDL and
 * the <code>endpointReference</code>
 * also has a WSDL in its metadata, then the WSDL from this instance MUST be used.
 * If this <code>Service</code> instance does not have a WSDL and
 * the <code>endpointReference</code> does have a WSDL, then the
 * WSDL from the <code>endpointReference</code> MAY be used.
 * An implementation MUST be able to retrieve the <code>portName</code> from the
 * <code>endpointReference</code> metadata.
 * <p>
 * This method behaves the same as calling
 * <pre>
 * <code>dispatch = service.createDispatch(portName, type, mode, features);</code>
 * </pre>
 * where the <code>portName</code> is retrieved from the
 * WSDL or <code>EndpointReference</code> metadata.
 *
 * @param endpointReference  The <code>EndpointReference</code>
 * for the target service endpoint that will be invoked by the
 * returned <code>Dispatch</code> object.
 * @param type The class of object used to messages or message
 * payloads. Implementations are required to support
 * <code>javax.xml.transform.Source</code> and <code>javax.xml.soap.SOAPMessage</code>.
 * @param mode Controls whether the created dispatch instance is message
 * or payload oriented, i.e. whether the user will work with complete
 * protocol messages or message payloads. E.g. when using the SOAP
 * protocol, this parameter controls whether the user will work with
 * SOAP messages or the contents of a SOAP body. Mode MUST be <code>MESSAGE</code>
 * when type is <code>SOAPMessage</code>.
 * @param features  An array of <code>WebServiceFeatures</code> to configure on the
 *                proxy.  Supported features not in the <code>features
 *                </code> parameter will have their default values.
 *
 * @return Dispatch instance
 * @throws WebServiceException
 *                  <UL>
 *                    <LI>If there is any missing WSDL metadata
 *                      as required by this method.
 *                    <li>If the <code>endpointReference</code> metadata does
 *                      not match the <code>serviceName</code> or <code>portName</code>
 *                      of a WSDL associated
 *                      with this <code>Service</code> instance.
 *                    <li>If the <code>portName</code> cannot be determined
 *                    from the <code>EndpointReference</code> metadata.
 *                    <li>If any error in the creation of
 *                     the <code>Dispatch</code> object.
 *                    <li>If a feature is enabled that is not
 *                    compatible with this port or is unsupported.
 *                  </UL>
 *
 * @see javax.xml.transform.Source
 * @see javax.xml.soap.SOAPMessage
 * @see WebServiceFeature
 *
 * @since JAX-WS 2.1
 **/
public abstract <T> Dispatch<T> createDispatch(EndpointReference endpointReference,
        Class<T> type, Service.Mode mode,
        WebServiceFeature... features);
 
Example 20
Source File: Stubs.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new {@link Dispatch} stub for {@link SOAPMessage}.
 *
 * This is short-cut of calling
 * <pre>
 * createDispatch(port,owner,binding,SOAPMessage.class,mode,next);
 * </pre>
 */
public static Dispatch<SOAPMessage> createSAAJDispatch(WSPortInfo portInfo, WSBinding binding, Service.Mode mode, @Nullable WSEndpointReference epr) {
    DispatchImpl.checkValidSOAPMessageDispatch(binding, mode);
    return new com.sun.xml.internal.ws.client.dispatch.SOAPMessageDispatch(portInfo, mode, (BindingImpl)binding, epr);
}