Java 类javax.xml.ws.http.HTTPBinding 实例源码

项目:jbossws-cxf    文件:JBWS1807TestCase.java   
@Test
@RunAsClient
public void testProviderDispatch() throws Exception
{
   String targetNS = "http://ws.com/";
   QName serviceName = new QName(targetNS, "Provider");
   QName portName = new QName(targetNS, "ProviderPort");

   Service service = Service.create(serviceName);
   service.addPort(portName, HTTPBinding.HTTP_BINDING, baseURL.toString());

   Dispatch<Source> dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
   Source resPayload = dispatch.invoke(new DOMSource(DOMUtils.parse("<ns2:input xmlns:ns2='http://ws.com/'><arg0>hello</arg0></ns2:input>")));

   Element docElement = DOMUtils.sourceToElement(resPayload);
   Element response = ((Element)DOMUtils.getChildElements(docElement, "return").next());
   assertEquals("hello", response.getTextContent());
}
项目:wso2-axis2    文件:Utils.java   
/**
 * Compares the version of the message in the MessageContext to what's expected
 * given the ServiceDescription.  The behavior is described in the SOAP 1.2
 * specification under Appendix 'A'.
 * 
 * @param mc
 * @param serviceDesc
 * @return
 */
public static boolean bindingTypesMatch(MessageContext mc, EndpointDescription ed) {

    Protocol protocol = mc.getMessage().getProtocol();
    String bindingType = ed.getBindingType();

    if (log.isDebugEnabled()) {
        log.debug("Checking for matching binding types.");
        log.debug("    message protocol: " + protocol);
        log.debug("        binding type: " + bindingType);
    }

    if (protocol.equals(Protocol.soap11)) { 
            return (BindingUtils.isSOAP11Binding(bindingType));
    } else if (protocol.equals(Protocol.soap12)) {
            return (BindingUtils.isSOAP12Binding(bindingType));                     
    } else if (protocol.equals(Protocol.rest)) {
        return HTTPBinding.HTTP_BINDING.equalsIgnoreCase(bindingType);
    }               
    return true;
}
项目:wso2-axis2    文件:EndpointDescriptionValidator.java   
private static String bindingHumanReadableDescription(String ns) {
    if (SOAPBinding.SOAP11HTTP_BINDING.equals(ns)) {
        return "SOAP 1.1 HTTP Binding";
    } else if (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(ns)) {
        return "SOAP 1.1 MTOM HTTP Binding";
    } else if (SOAPBinding.SOAP12HTTP_BINDING.equals(ns)) {
        return "SOAP 1.2 HTTP Binding";
    } else if (SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(ns)) {
        return "SOAP 1.2 MTOM HTTP Binding";
    } else if (MDQConstants.SOAP11JMS_BINDING.equals(ns)) {
        return "SOAP 1.1 JMS Binding";
    } else if (MDQConstants.SOAP11JMS_MTOM_BINDING.equals(ns)) {
        return "SOAP 1.1 MTOM JMS Binding";
    } else if (MDQConstants.SOAP12JMS_BINDING.equals(ns)) {
        return "SOAP 1.2 JMS Binding";
    } else if (MDQConstants.SOAP12JMS_MTOM_BINDING.equals(ns)) {
        return "SOAP 1.2 MTOM JMS Binding";
    } else if (HTTPBinding.HTTP_BINDING.equals(ns)) {
        return "XML HTTP Binding";
    } else {
        return "Unknown Binding";
    }
}
项目:OpenJSharp    文件:Stub.java   
@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;
}
项目:OpenJSharp    文件:Stub.java   
@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);
}
项目:OpenJSharp    文件:DispatchImpl.java   
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()));
}
项目:OpenJSharp    文件:DispatchImpl.java   
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()));
}
项目:OpenJSharp    文件:DeploymentDescriptorParser.java   
/**
 * 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;
}
项目:openjdk-jdk10    文件:Stub.java   
@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;
}
项目:openjdk-jdk10    文件:Stub.java   
@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);
}
项目:openjdk-jdk10    文件:DispatchImpl.java   
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()));
}
项目:openjdk-jdk10    文件:DispatchImpl.java   
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()));
}
项目:openjdk-jdk10    文件:DeploymentDescriptorParser.java   
/**
 * 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;
}
项目:openjdk9    文件:Stub.java   
@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;
}
项目:openjdk9    文件:Stub.java   
@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);
}
项目:openjdk9    文件:DispatchImpl.java   
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()));
}
项目:openjdk9    文件:DispatchImpl.java   
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()));
}
项目:openjdk9    文件:DeploymentDescriptorParser.java   
/**
 * 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;
}
项目:lookaside_java-1.8.0-openjdk    文件:Stub.java   
@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;
}
项目:lookaside_java-1.8.0-openjdk    文件:Stub.java   
@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);
}
项目:lookaside_java-1.8.0-openjdk    文件:DispatchImpl.java   
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()));
}
项目:lookaside_java-1.8.0-openjdk    文件:DispatchImpl.java   
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()));
}
项目:lookaside_java-1.8.0-openjdk    文件:DeploymentDescriptorParser.java   
/**
 * 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;
}
项目:jbossws-cxf    文件:JAXWS2976TestCase.java   
private Dispatch<Source> createDispatchSource() throws Exception
{
   javax.xml.ws.Service service = javax.xml.ws.Service.create(new QName("http://ws.jboss.org", "HelloService"));
   service.addPort(new QName("http://ws.jboss.org", "HelloPort"), HTTPBinding.HTTP_BINDING,
         "http://ws.jboss.org/endpointAddress");
   return service.createDispatch(new QName("http://ws.jboss.org", "HelloPort"), Source.class,
         javax.xml.ws.Service.Mode.PAYLOAD);
}
项目:jbossws-cxf    文件:ProviderJAXBTestCase.java   
private Dispatch<Object> createDispatch(String target) throws MalformedURLException, JAXBException
{
   String targetNS = "http://org.jboss.ws/provider";
   QName serviceName = new QName(targetNS, "ProviderService");
   QName portName = new QName(targetNS, "ProviderPort");
   URL endpointAddress = new URL(baseURL + "/" + target);

   Service service = Service.create(serviceName);
   service.addPort(portName, HTTPBinding.HTTP_BINDING, endpointAddress.toExternalForm());

   JAXBContext jbc = JAXBContext.newInstance(new Class[] { UserType.class });
   Dispatch<Object> dispatch = service.createDispatch(portName, jbc, Mode.PAYLOAD);
   return dispatch;
}
项目:jbossws-cxf    文件:HttpJAXBTestCase.java   
private Dispatch<Object> createDispatch(String target) throws MalformedURLException, JAXBException
{
   String targetNS = "http://org.jboss.ws/httpbinding";
   QName serviceName = new QName(targetNS, "ProviderService");
   QName portName = new QName(targetNS, "ProviderPort");
   URL endpointAddress = new URL(baseURL + "/" + target);

   Service service = Service.create(serviceName);
   service.addPort(portName, HTTPBinding.HTTP_BINDING, endpointAddress.toExternalForm());

   JAXBContext jbc = JAXBContext.newInstance(new Class[] { UserType.class });
   Dispatch<Object> dispatch = service.createDispatch(portName, jbc, Mode.PAYLOAD);
   return dispatch;
}
项目:jbossws-cxf    文件:HttpPayloadTestCase.java   
private Dispatch<Source> createDispatch(String target) throws MalformedURLException, JAXBException
{
   String targetNS = "http://org.jboss.ws/httpbinding";
   QName serviceName = new QName(targetNS, "ProviderService");
   QName portName = new QName(targetNS, "ProviderPort");
   URL endpointAddress = new URL(baseURL + "/" + target);

   Service service = Service.create(serviceName);
   service.addPort(portName, HTTPBinding.HTTP_BINDING, endpointAddress.toExternalForm());

   Dispatch<Source> dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
   return dispatch;
}
项目:infobip-open-jdk-8    文件:Stub.java   
@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;
}
项目:infobip-open-jdk-8    文件:Stub.java   
@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);
}
项目:infobip-open-jdk-8    文件:DispatchImpl.java   
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()));
}
项目:infobip-open-jdk-8    文件:DispatchImpl.java   
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()));
}
项目:infobip-open-jdk-8    文件:DeploymentDescriptorParser.java   
/**
 * 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;
}
项目:OLD-OpenJDK8    文件:Stub.java   
@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;
}
项目:OLD-OpenJDK8    文件:Stub.java   
@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);
}
项目:OLD-OpenJDK8    文件:DispatchImpl.java   
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()));
}
项目:OLD-OpenJDK8    文件:DispatchImpl.java   
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()));
}
项目:OLD-OpenJDK8    文件:DeploymentDescriptorParser.java   
/**
 * 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;
}
项目:wso2-axis2    文件:BaseDispatch.java   
private boolean isValidInvocationParam(Object object) {
    String bindingId = endpointDesc.getClientBindingID();

    // If no bindingId was found, use the default.
    if (bindingId == null) {
        bindingId = SOAPBinding.SOAP11HTTP_BINDING;
    }

    // If it's not an HTTP_BINDING, then we can allow for null params,  
    // but only in PAYLOAD mode per JAX-WS Section 4.3.2.
    if (!bindingId.equals(HTTPBinding.HTTP_BINDING)) {
        if (mode.equals(Mode.MESSAGE) && object == null) {
            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("dispatchNullParamMessageMode"));
        }
    } else {
        // In all cases (PAYLOAD and MESSAGE) we must throw a WebServiceException
        // if the parameter is null and request method is POST or PUT.
        if (object == null && isPOSTorPUTRequest()) {
            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("dispatchNullParamHttpBinding"));
        }
    }

    if (object instanceof DOMSource) {
        DOMSource ds = (DOMSource)object;
        if (ds.getNode() == null && ds.getSystemId() == null) {
            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("dispatchBadDOMSource"));
        }
    }

    // If we've gotten this far, then all is good.
    return true;
}
项目:wso2-axis2    文件:DispatchXPayloadJAXBTests.java   
public Dispatch<Object> getDispatch() throws JAXBException {
   Service service = Service.create(SERVICE_NAME);
   service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
   JAXBContext jbc = JAXBContext.newInstance("test");
   Dispatch<Object> dispatch = service.createDispatch(PORT_NAME, jbc, Service.Mode.PAYLOAD);
   return dispatch;
}
项目:openjdk-icedtea7    文件:Stub.java   
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 = ((WSDLPortImpl) 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;
}