本文整理汇总了Java中javax.xml.ws.http.HTTPBinding类的典型用法代码示例。如果您正苦于以下问题:Java HTTPBinding类的具体用法?Java HTTPBinding怎么用?Java HTTPBinding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTTPBinding类属于javax.xml.ws.http包,在下文中一共展示了HTTPBinding类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testProviderDispatch
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
@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());
}
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:19,代码来源:JBWS1807TestCase.java
示例2: bindingTypesMatch
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
/**
* 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;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:30,代码来源:Utils.java
示例3: bindingHumanReadableDescription
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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";
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:EndpointDescriptionValidator.java
示例4: getWSEndpointReference
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
@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;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:Stub.java
示例5: getEndpointReference
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
@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);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:Stub.java
示例6: checkValidSOAPMessageDispatch
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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()));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:DispatchImpl.java
示例7: checkValidDataSourceDispatch
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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()));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:DispatchImpl.java
示例8: getBindingIdForToken
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
/**
* 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;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:DeploymentDescriptorParser.java
示例9: createDispatchSource
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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);
}
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:9,代码来源:JAXWS2976TestCase.java
示例10: createDispatch
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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;
}
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:15,代码来源:ProviderJAXBTestCase.java
示例11: createDispatch
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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;
}
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:15,代码来源:HttpJAXBTestCase.java
示例12: createDispatch
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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;
}
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:14,代码来源:HttpPayloadTestCase.java
示例13: isValidInvocationParam
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:33,代码来源:BaseDispatch.java
示例14: getDispatch
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:8,代码来源:DispatchXPayloadJAXBTests.java
示例15: getWSEndpointReference
import javax.xml.ws.http.HTTPBinding; //导入依赖的package包/类
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;
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:37,代码来源:Stub.java
注:本文中的javax.xml.ws.http.HTTPBinding类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论