javax.xml.ws.http.HTTPBinding Java Examples

The following examples show how to use javax.xml.ws.http.HTTPBinding. 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: DispatchImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void checkError() {
    if (error != null) {
        if (getBinding() instanceof SOAPBinding) {
            SOAPFault soapFault = null;
            try {
                soapFault = JaxWsClientProxy.createSoapFault((SOAPBinding)getBinding(),
                                                             new Exception(error.toString()));
            } catch (SOAPException e) {
                //ignore
            }
            if (soapFault != null) {
                throw new SOAPFaultException(soapFault);
            }
        } else if (getBinding() instanceof HTTPBinding) {
            HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
            exception.initCause(new Exception(error.toString()));
            throw exception;
        }
        throw new WebServiceException(error.toString());
    }
}
 
Example #2
Source File: DispatchImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidDataSourceDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<DataSource> is only valid with xml/http binding and in Service.Mode.MESSAGE
    if (!DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_BINDING("SOAP/HTTP", HTTPBinding.HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}
 
Example #3
Source File: DispatchImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidDataSourceDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<DataSource> is only valid with xml/http binding and in Service.Mode.MESSAGE
    if (!DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_BINDING("SOAP/HTTP", HTTPBinding.HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}
 
Example #4
Source File: DeploymentDescriptorParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * JSR-109 defines short-form tokens for standard binding Ids. These are
 * used only in DD. So stand alone deployment descirptor should also honor
 * these tokens. This method converts the tokens to API's standard
 * binding ids
 *
 * @param lexical binding attribute value from DD. Always not null
 * @return returns corresponding API's binding ID or the same lexical
 */
public static @NotNull String getBindingIdForToken(@NotNull String lexical) {
    if (lexical.equals("##SOAP11_HTTP")) {
        return SOAPBinding.SOAP11HTTP_BINDING;
    } else if (lexical.equals("##SOAP11_HTTP_MTOM")) {
        return SOAPBinding.SOAP11HTTP_MTOM_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP")) {
        return SOAPBinding.SOAP12HTTP_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP_MTOM")) {
        return SOAPBinding.SOAP12HTTP_MTOM_BINDING;
    } else if (lexical.equals("##XML_HTTP")) {
        return HTTPBinding.HTTP_BINDING;
    }
    return lexical;
}
 
Example #5
Source File: Stub.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final WSEndpointReference getWSEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")
                );
    }

    if (endpointReference != null) {
        return endpointReference;
    }

    String eprAddress = requestContext.getEndpointAddress().toString();
    QName portTypeName = null;
    String wsdlAddress = null;
    List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<WSEndpointReference.EPRExtension>();
    if (wsdlPort != null) {
        portTypeName = wsdlPort.getBinding().getPortTypeName();
        wsdlAddress = eprAddress + "?wsdl";

        //gather EPRExtensions specified in WSDL.
        try {
            WSEndpointReference wsdlEpr = wsdlPort.getEPR();
            if (wsdlEpr != null) {
                for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                    wsdlEPRExtensions.add(new WSEPRExtension(
                            XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
                }
            }

        } catch (XMLStreamException ex) {
            throw new WebServiceException(ex);
        }
    }
    AddressingVersion av = AddressingVersion.W3C;
    this.endpointReference = new WSEndpointReference(
            av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);

    return this.endpointReference;
}
 
Example #6
Source File: Stub.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final W3CEndpointReference getEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding"));
    }
    return getEndpointReference(W3CEndpointReference.class);
}
 
Example #7
Source File: DispatchImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidSOAPMessageDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<SOAPMessage> is only valid for soap binding and in Service.Mode.MESSAGE
    if (DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_BINDING(HTTPBinding.HTTP_BINDING, SOAPBinding.SOAP11HTTP_BINDING + " or " + SOAPBinding.SOAP12HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}
 
Example #8
Source File: DispatchImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidDataSourceDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<DataSource> is only valid with xml/http binding and in Service.Mode.MESSAGE
    if (!DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_BINDING("SOAP/HTTP", HTTPBinding.HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}
 
Example #9
Source File: DeploymentDescriptorParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * JSR-109 defines short-form tokens for standard binding Ids. These are
 * used only in DD. So stand alone deployment descirptor should also honor
 * these tokens. This method converts the tokens to API's standard
 * binding ids
 *
 * @param lexical binding attribute value from DD. Always not null
 * @return returns corresponding API's binding ID or the same lexical
 */
public static @NotNull String getBindingIdForToken(@NotNull String lexical) {
    if (lexical.equals("##SOAP11_HTTP")) {
        return SOAPBinding.SOAP11HTTP_BINDING;
    } else if (lexical.equals("##SOAP11_HTTP_MTOM")) {
        return SOAPBinding.SOAP11HTTP_MTOM_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP")) {
        return SOAPBinding.SOAP12HTTP_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP_MTOM")) {
        return SOAPBinding.SOAP12HTTP_MTOM_BINDING;
    } else if (lexical.equals("##XML_HTTP")) {
        return HTTPBinding.HTTP_BINDING;
    }
    return lexical;
}
 
Example #10
Source File: Stub.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final WSEndpointReference getWSEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")
                );
    }

    if (endpointReference != null) {
        return endpointReference;
    }

    String eprAddress = requestContext.getEndpointAddress().toString();
    QName portTypeName = null;
    String wsdlAddress = null;
    List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<WSEndpointReference.EPRExtension>();
    if (wsdlPort != null) {
        portTypeName = wsdlPort.getBinding().getPortTypeName();
        wsdlAddress = eprAddress + "?wsdl";

        //gather EPRExtensions specified in WSDL.
        try {
            WSEndpointReference wsdlEpr = wsdlPort.getEPR();
            if (wsdlEpr != null) {
                for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                    wsdlEPRExtensions.add(new WSEPRExtension(
                            XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
                }
            }

        } catch (XMLStreamException ex) {
            throw new WebServiceException(ex);
        }
    }
    AddressingVersion av = AddressingVersion.W3C;
    this.endpointReference = new WSEndpointReference(
            av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);

    return this.endpointReference;
}
 
Example #11
Source File: Stub.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final W3CEndpointReference getEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding"));
    }
    return getEndpointReference(W3CEndpointReference.class);
}
 
Example #12
Source File: DispatchImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidSOAPMessageDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<SOAPMessage> is only valid for soap binding and in Service.Mode.MESSAGE
    if (DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_BINDING(HTTPBinding.HTTP_BINDING, SOAPBinding.SOAP11HTTP_BINDING + " or " + SOAPBinding.SOAP12HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}
 
Example #13
Source File: Stub.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final W3CEndpointReference getEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding"));
    }
    return getEndpointReference(W3CEndpointReference.class);
}
 
Example #14
Source File: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * JSR-109 defines short-form tokens for standard binding Ids. These are
 * used only in DD. So stand alone deployment descirptor should also honor
 * these tokens. This method converts the tokens to API's standard
 * binding ids
 *
 * @param lexical binding attribute value from DD. Always not null
 * @return returns corresponding API's binding ID or the same lexical
 */
public static @NotNull String getBindingIdForToken(@NotNull String lexical) {
    if (lexical.equals("##SOAP11_HTTP")) {
        return SOAPBinding.SOAP11HTTP_BINDING;
    } else if (lexical.equals("##SOAP11_HTTP_MTOM")) {
        return SOAPBinding.SOAP11HTTP_MTOM_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP")) {
        return SOAPBinding.SOAP12HTTP_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP_MTOM")) {
        return SOAPBinding.SOAP12HTTP_MTOM_BINDING;
    } else if (lexical.equals("##XML_HTTP")) {
        return HTTPBinding.HTTP_BINDING;
    }
    return lexical;
}
 
Example #15
Source File: Stub.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final WSEndpointReference getWSEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")
                );
    }

    if (endpointReference != null) {
        return endpointReference;
    }

    String eprAddress = requestContext.getEndpointAddress().toString();
    QName portTypeName = null;
    String wsdlAddress = null;
    List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<WSEndpointReference.EPRExtension>();
    if (wsdlPort != null) {
        portTypeName = wsdlPort.getBinding().getPortTypeName();
        wsdlAddress = eprAddress + "?wsdl";

        //gather EPRExtensions specified in WSDL.
        try {
            WSEndpointReference wsdlEpr = wsdlPort.getEPR();
            if (wsdlEpr != null) {
                for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                    wsdlEPRExtensions.add(new WSEPRExtension(
                            XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
                }
            }

        } catch (XMLStreamException ex) {
            throw new WebServiceException(ex);
        }
    }
    AddressingVersion av = AddressingVersion.W3C;
    this.endpointReference = new WSEndpointReference(
            av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);

    return this.endpointReference;
}
 
Example #16
Source File: Stub.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final W3CEndpointReference getEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding"));
    }
    return getEndpointReference(W3CEndpointReference.class);
}
 
Example #17
Source File: DispatchImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidSOAPMessageDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<SOAPMessage> is only valid for soap binding and in Service.Mode.MESSAGE
    if (DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_BINDING(HTTPBinding.HTTP_BINDING, SOAPBinding.SOAP11HTTP_BINDING + " or " + SOAPBinding.SOAP12HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}
 
Example #18
Source File: DispatchImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidDataSourceDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<DataSource> is only valid with xml/http binding and in Service.Mode.MESSAGE
    if (!DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_BINDING("SOAP/HTTP", HTTPBinding.HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}
 
Example #19
Source File: DeploymentDescriptorParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * JSR-109 defines short-form tokens for standard binding Ids. These are
 * used only in DD. So stand alone deployment descirptor should also honor
 * these tokens. This method converts the tokens to API's standard
 * binding ids
 *
 * @param lexical binding attribute value from DD. Always not null
 * @return returns corresponding API's binding ID or the same lexical
 */
public static @NotNull String getBindingIdForToken(@NotNull String lexical) {
    if (lexical.equals("##SOAP11_HTTP")) {
        return SOAPBinding.SOAP11HTTP_BINDING;
    } else if (lexical.equals("##SOAP11_HTTP_MTOM")) {
        return SOAPBinding.SOAP11HTTP_MTOM_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP")) {
        return SOAPBinding.SOAP12HTTP_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP_MTOM")) {
        return SOAPBinding.SOAP12HTTP_MTOM_BINDING;
    } else if (lexical.equals("##XML_HTTP")) {
        return HTTPBinding.HTTP_BINDING;
    }
    return lexical;
}
 
Example #20
Source File: WSSecurityClientTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static Dispatch<Source> createUsernameTokenDispatcher(boolean decoupled, String port) {
    final Service service = Service.create(
        GREETER_SERVICE_QNAME
    );
    service.addPort(
        USERNAME_TOKEN_PORT_QNAME,
        decoupled ? SOAPBinding.SOAP11HTTP_BINDING : HTTPBinding.HTTP_BINDING,
        "http://localhost:" + port + "/GreeterService/UsernameTokenPort"
    );
    final Dispatch<Source> dispatcher = service.createDispatch(
        USERNAME_TOKEN_PORT_QNAME,
        Source.class,
        Service.Mode.MESSAGE,
        new AddressingFeature(decoupled, decoupled)
    );
    final java.util.Map<String, Object> requestContext =
        dispatcher.getRequestContext();
    requestContext.put(
        MessageContext.HTTP_REQUEST_METHOD,
        "POST"
    );
    if (decoupled) {
        HTTPConduit cond = (HTTPConduit)((DispatchImpl<?>)dispatcher).getClient().getConduit();
        cond.getClient().setDecoupledEndpoint("http://localhost:" + DEC_PORT + "/decoupled");
    }
    return dispatcher;
}
 
Example #21
Source File: EndpointImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public EndpointReference getEndpointReference(Element... referenceParameters) {
    if (!isPublished()) {
        throw new WebServiceException(new org.apache.cxf.common.i18n.Message("ENDPOINT_NOT_PUBLISHED",
                                                                             LOG).toString());
    }

    if (getBinding() instanceof HTTPBinding) {
        throw new UnsupportedOperationException(new org.apache.cxf.common.i18n.Message(
                                                    "GET_ENDPOINTREFERENCE_UNSUPPORTED_BINDING",
                                                    LOG).toString());
    }

    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder.address(address);
    builder.serviceName(serviceName);
    builder.endpointName(endpointName);
    if (referenceParameters != null) {
        for (Element referenceParameter : referenceParameters) {
            builder.referenceParameter(referenceParameter);
        }
    }
    builder.wsdlDocumentLocation(wsdlLocation);

    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    try {
        Thread.currentThread().setContextClassLoader(EndpointReferenceBuilder.class.getClassLoader());
        return builder.build();
    } finally {
        Thread.currentThread().setContextClassLoader(cl);
    }
}
 
Example #22
Source File: DispatchTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testHTTPBinding() throws Exception {
    ServiceImpl service = new ServiceImpl(getBus(), null, SERVICE_NAME, null);
    service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING, "local://foobar");
    Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
    assertTrue(disp.getBinding() instanceof HTTPBinding);
}
 
Example #23
Source File: Stub.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final W3CEndpointReference getEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding"));
    }
    return getEndpointReference(W3CEndpointReference.class);
}
 
Example #24
Source File: Stub.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final WSEndpointReference getWSEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")
                );
    }

    if (endpointReference != null) {
        return endpointReference;
    }

    String eprAddress = requestContext.getEndpointAddress().toString();
    QName portTypeName = null;
    String wsdlAddress = null;
    List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<WSEndpointReference.EPRExtension>();
    if (wsdlPort != null) {
        portTypeName = wsdlPort.getBinding().getPortTypeName();
        wsdlAddress = eprAddress + "?wsdl";

        //gather EPRExtensions specified in WSDL.
        try {
            WSEndpointReference wsdlEpr = wsdlPort.getEPR();
            if (wsdlEpr != null) {
                for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                    wsdlEPRExtensions.add(new WSEPRExtension(
                            XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
                }
            }

        } catch (XMLStreamException ex) {
            throw new WebServiceException(ex);
        }
    }
    AddressingVersion av = AddressingVersion.W3C;
    this.endpointReference = new WSEndpointReference(
            av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);

    return this.endpointReference;
}
 
Example #25
Source File: DispatchImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidSOAPMessageDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<SOAPMessage> is only valid for soap binding and in Service.Mode.MESSAGE
    if (DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_BINDING(HTTPBinding.HTTP_BINDING, SOAPBinding.SOAP11HTTP_BINDING + " or " + SOAPBinding.SOAP12HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}
 
Example #26
Source File: DispatchImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidDataSourceDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<DataSource> is only valid with xml/http binding and in Service.Mode.MESSAGE
    if (!DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_BINDING("SOAP/HTTP", HTTPBinding.HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_DATASOURCE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}
 
Example #27
Source File: DeploymentDescriptorParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * JSR-109 defines short-form tokens for standard binding Ids. These are
 * used only in DD. So stand alone deployment descirptor should also honor
 * these tokens. This method converts the tokens to API's standard
 * binding ids
 *
 * @param lexical binding attribute value from DD. Always not null
 * @return returns corresponding API's binding ID or the same lexical
 */
public static @NotNull String getBindingIdForToken(@NotNull String lexical) {
    if (lexical.equals("##SOAP11_HTTP")) {
        return SOAPBinding.SOAP11HTTP_BINDING;
    } else if (lexical.equals("##SOAP11_HTTP_MTOM")) {
        return SOAPBinding.SOAP11HTTP_MTOM_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP")) {
        return SOAPBinding.SOAP12HTTP_BINDING;
    } else if (lexical.equals("##SOAP12_HTTP_MTOM")) {
        return SOAPBinding.SOAP12HTTP_MTOM_BINDING;
    } else if (lexical.equals("##XML_HTTP")) {
        return HTTPBinding.HTTP_BINDING;
    }
    return lexical;
}
 
Example #28
Source File: Stub.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final WSEndpointReference getWSEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")
                );
    }

    if (endpointReference != null) {
        return endpointReference;
    }

    String eprAddress = requestContext.getEndpointAddress().toString();
    QName portTypeName = null;
    String wsdlAddress = null;
    List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<WSEndpointReference.EPRExtension>();
    if (wsdlPort != null) {
        portTypeName = wsdlPort.getBinding().getPortTypeName();
        wsdlAddress = eprAddress + "?wsdl";

        //gather EPRExtensions specified in WSDL.
        try {
            WSEndpointReference wsdlEpr = wsdlPort.getEPR();
            if (wsdlEpr != null) {
                for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                    wsdlEPRExtensions.add(new WSEPRExtension(
                            XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
                }
            }

        } catch (XMLStreamException ex) {
            throw new WebServiceException(ex);
        }
    }
    AddressingVersion av = AddressingVersion.W3C;
    this.endpointReference = new WSEndpointReference(
            av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);

    return this.endpointReference;
}
 
Example #29
Source File: Stub.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final W3CEndpointReference getEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding"));
    }
    return getEndpointReference(W3CEndpointReference.class);
}
 
Example #30
Source File: DispatchImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void checkValidSOAPMessageDispatch(WSBinding binding, Service.Mode mode) {
    // Dispatch<SOAPMessage> is only valid for soap binding and in Service.Mode.MESSAGE
    if (DispatchImpl.isXMLHttp(binding))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_BINDING(HTTPBinding.HTTP_BINDING, SOAPBinding.SOAP11HTTP_BINDING + " or " + SOAPBinding.SOAP12HTTP_BINDING));
    if (DispatchImpl.isPAYLOADMode(mode))
        throw new WebServiceException(DispatchMessages.INVALID_SOAPMESSAGE_DISPATCH_MSGMODE(mode.name(), Service.Mode.MESSAGE.toString()));
}