本文整理了Java中javax.wsdl.Binding.setPortType()
方法的一些代码示例,展示了Binding.setPortType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding.setPortType()
方法的具体详情如下:
包路径:javax.wsdl.Binding
类名称:Binding
方法名:setPortType
[英]Set the port type this is a binding for.
[中]设置此绑定的端口类型。
代码示例来源:origin: wsdl4j/wsdl4j
binding.setPortType(portType);
代码示例来源:origin: apache/cxf
public static Binding doAppendBinding(Definition wsdlDefinition, String name, PortType portType,
ExtensionRegistry extReg) throws Exception {
Binding binding = wsdlDefinition.createBinding();
binding.setQName(new QName(wsdlDefinition.getTargetNamespace(), name + bindingName));
binding.setUndefined(false);
binding.setPortType(portType);
setSoapBindingExtElement(wsdlDefinition, binding, extReg);
addBindingOperation(wsdlDefinition, portType, binding, extReg);
return binding;
}
代码示例来源:origin: org.apache.cxf/cxf-rt-core
public static Binding doAppendBinding(Definition wsdlDefinition, String name, PortType portType,
ExtensionRegistry extReg) throws Exception {
Binding binding = wsdlDefinition.createBinding();
binding.setQName(new QName(wsdlDefinition.getTargetNamespace(), name + bindingName));
binding.setUndefined(false);
binding.setPortType(portType);
setSoapBindingExtElement(wsdlDefinition, binding, extReg);
addBindingOperation(wsdlDefinition, portType, binding, extReg);
return binding;
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
public static Binding doAppendBinding(Definition wsdlDefinition, String name, PortType portType,
ExtensionRegistry extReg) throws Exception {
Binding binding = wsdlDefinition.createBinding();
binding.setQName(new QName(wsdlDefinition.getTargetNamespace(), name + bindingName));
binding.setUndefined(false);
binding.setPortType(portType);
setSoapBindingExtElement(wsdlDefinition, binding, extReg);
addBindingOperation(wsdlDefinition, portType, binding, extReg);
return binding;
}
代码示例来源:origin: org.apache.airavata/gfac-schema-utils
private Binding addBinding(Definition def, String nameSpaceURI, PortTypeImpl portType,
UnknownExtensibilityElement wsPolicyRef, DOMImplementation dImpl) {
String portName = portType.getQName().getLocalPart();
Binding binding = def.createBinding();
binding.setQName(new QName(nameSpaceURI, portName + WSDL_SOAP_BINDING_SUFFIX));
binding.setUndefined(false);
binding.setPortType(portType);
SOAPBindingImpl soapBindingImpl = new SOAPBindingImpl();
soapBindingImpl.setStyle(DOCUMENT);
soapBindingImpl.setTransportURI(SOAP_HTTP_NAMESPACE);
binding.addExtensibilityElement(soapBindingImpl);
if (wsPolicyRef != null) {
log.info("policy info is not null");
binding.addExtensibilityElement(wsPolicyRef);
}
Document doc = dImpl.createDocument(WSP_NAMESPACE, "Misc", null);
UnknownExtensibilityElement exEle = new UnknownExtensibilityElement();
exEle.setElement(doc.createElementNS("http://www.w3.org/2006/05/addressing/wsdl", "wsaw:UsingAddressing"));
exEle.setElementType(new QName("http://www.w3.org/2006/05/addressing/wsdl", "wsaw:UsingAddressing"));
binding.addExtensibilityElement(exEle);
return binding;
}
代码示例来源:origin: org.apache.airavata/airavata-gfac-schema-utils
private Binding addBinding(Definition def, String nameSpaceURI, PortTypeImpl portType,
UnknownExtensibilityElement wsPolicyRef, DOMImplementation dImpl) {
String portName = portType.getQName().getLocalPart();
Binding binding = def.createBinding();
binding.setQName(new QName(nameSpaceURI, portName + WSDL_SOAP_BINDING_SUFFIX));
binding.setUndefined(false);
binding.setPortType(portType);
SOAPBindingImpl soapBindingImpl = new SOAPBindingImpl();
soapBindingImpl.setStyle(DOCUMENT);
soapBindingImpl.setTransportURI(SOAP_HTTP_NAMESPACE);
binding.addExtensibilityElement(soapBindingImpl);
if (wsPolicyRef != null) {
log.debug("policy info is not null");
binding.addExtensibilityElement(wsPolicyRef);
}
Document doc = dImpl.createDocument(WSP_NAMESPACE, "Misc", null);
UnknownExtensibilityElement exEle = new UnknownExtensibilityElement();
exEle.setElement(doc.createElementNS("http://www.w3.org/2006/05/addressing/wsdl", "wsaw:UsingAddressing"));
exEle.setElementType(new QName("http://www.w3.org/2006/05/addressing/wsdl", "wsaw:UsingAddressing"));
binding.addExtensibilityElement(exEle);
return binding;
}
代码示例来源:origin: apache/cxf
public Binding createBinding(String scopedPortTypeName) {
StringBuilder bname = new StringBuilder(scopedPortTypeName + "CORBABinding");
QName bqname = new QName(rootDefinition.getTargetNamespace(),
bname.toString());
int count = 0;
while (queryBinding(bqname)) {
bname.append(count);
bqname = new QName(rootDefinition.getTargetNamespace(), bname.toString());
}
Binding binding = rootDefinition.createBinding();
binding.setPortType(portType);
binding.setQName(bqname);
try {
BindingType bindingType = (BindingType)
extReg.createExtension(Binding.class, CorbaConstants.NE_CORBA_BINDING);
String pragmaPrefix = (this.getWsdlVisitor().getPragmaPrefix() != null
&& this.getWsdlVisitor().getPragmaPrefix().length() > 0)
? this.getWsdlVisitor().getPragmaPrefix() + "/" : "";
bindingType.setRepositoryID(CorbaConstants.REPO_STRING
+ pragmaPrefix
+ scopedPortTypeName.replace('.', '/')
+ CorbaConstants.IDL_VERSION);
binding.addExtensibilityElement((ExtensibilityElement)bindingType);
} catch (WSDLException ex) {
throw new RuntimeException(ex);
}
binding.setUndefined(false);
rootDefinition.addBinding(binding);
return binding;
}
代码示例来源:origin: apache/cxf
private void doAppendBinding() throws ToolException {
if (binding == null) {
binding = wsdlDefinition.createBinding();
binding.setQName(new QName(wsdlDefinition.getTargetNamespace(), (String)env
.get(ToolConstants.CFG_BINDING)));
binding.setUndefined(false);
binding.setPortType(portType);
}
setXMLBindingExtElement();
addBindingOperation();
wsdlDefinition.addBinding(binding);
}
代码示例来源:origin: org.objectweb.celtix/celtix-tools
private void doAppendBinding() throws ToolException {
if (binding == null) {
binding = wsdlDefinition.createBinding();
binding.setQName(new QName(wsdlDefinition.getTargetNamespace(), (String)env
.get(ToolConstants.CFG_BINDING)));
binding.setUndefined(false);
binding.setPortType(portType);
}
setXMLBindingExtElement();
addBindingOperation();
wsdlDefinition.addBinding(binding);
}
代码示例来源:origin: org.apache.cxf/cxf-tools-misctools
private void doAppendBinding() throws ToolException {
if (binding == null) {
binding = wsdlDefinition.createBinding();
binding.setQName(new QName(wsdlDefinition.getTargetNamespace(), (String)env
.get(ToolConstants.CFG_BINDING)));
binding.setUndefined(false);
binding.setPortType(portType);
}
setXMLBindingExtElement();
addBindingOperation();
wsdlDefinition.addBinding(binding);
}
代码示例来源:origin: org.objectweb.celtix/celtix-tools
public void generate() {
Binding binding = definition.createBinding();
binding.setQName(new QName(WSDLConstants.NS_WSDL, wmodel.getPortTypeName() + "Binding"));
binding.setPortType(definition.getPortType(new QName(wmodel.getTargetNameSpace(), wmodel
.getPortTypeName())));
// genearte the soap binding
javax.wsdl.extensions.soap.SOAPBinding soapBinding;
try {
soapBinding = (javax.wsdl.extensions.soap.SOAPBinding)extensionRegistry
.createExtension(Binding.class, new QName(WSDLConstants.SOAP11_NAMESPACE, "binding"));
soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
soapBinding.setStyle(wmodel.getStyle().toString().toLowerCase());
binding.addExtensibilityElement(soapBinding);
} catch (WSDLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
generateBindingOperation(binding);
binding.setUndefined(false);
definition.addBinding(binding);
}
代码示例来源:origin: org.apache.cxf/cxf-rt-core
protected void buildBinding(Definition definition,
Collection<BindingInfo> bindingInfos,
Collection<PortType> portTypes) {
Binding binding = null;
for (BindingInfo bindingInfo : bindingInfos) {
binding = definition.createBinding();
addDocumentation(binding, bindingInfo.getDocumentation());
binding.setUndefined(false);
for (PortType portType : portTypes) {
if (portType.getQName().equals(bindingInfo.getInterface().getName())) {
binding.setPortType(portType);
break;
}
}
binding.setQName(bindingInfo.getName());
if (!bindingInfo.getName().getNamespaceURI().equals(definition.getTargetNamespace())) {
addNamespace(bindingInfo.getName().getNamespaceURI(), definition);
}
buildBindingOperation(definition, binding, bindingInfo.getOperations());
addExtensibilityElements(definition, binding, getWSDL11Extensors(bindingInfo));
definition.addBinding(binding);
}
}
代码示例来源:origin: apache/cxf
protected void buildBinding(Definition definition,
Collection<BindingInfo> bindingInfos,
Collection<PortType> portTypes) {
Binding binding = null;
for (BindingInfo bindingInfo : bindingInfos) {
binding = definition.createBinding();
addDocumentation(binding, bindingInfo.getDocumentation());
binding.setUndefined(false);
for (PortType portType : portTypes) {
if (portType.getQName().equals(bindingInfo.getInterface().getName())) {
binding.setPortType(portType);
break;
}
}
binding.setQName(bindingInfo.getName());
if (!bindingInfo.getName().getNamespaceURI().equals(definition.getTargetNamespace())) {
addNamespace(bindingInfo.getName().getNamespaceURI(), definition);
}
buildBindingOperation(definition, binding, bindingInfo.getOperations());
addExtensibilityElements(definition, binding, getWSDL11Extensors(bindingInfo));
definition.addBinding(binding);
}
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
protected void buildBinding(Definition definition,
Collection<BindingInfo> bindingInfos,
Collection<PortType> portTypes) {
Binding binding = null;
for (BindingInfo bindingInfo : bindingInfos) {
binding = definition.createBinding();
addDocumentation(binding, bindingInfo.getDocumentation());
binding.setUndefined(false);
for (PortType portType : portTypes) {
if (portType.getQName().equals(bindingInfo.getInterface().getName())) {
binding.setPortType(portType);
break;
}
}
binding.setQName(bindingInfo.getName());
if (!bindingInfo.getName().getNamespaceURI().equals(definition.getTargetNamespace())) {
addNamespace(bindingInfo.getName().getNamespaceURI(), definition);
}
buildBindingOperation(definition, binding, bindingInfo.getOperations());
addExtensibilityElements(definition, binding, getWSDL11Extensors(bindingInfo));
definition.addBinding(binding);
}
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public javax.wsdl.Binding createBinding(WSDLBuilder builder, PortType portType)
{
Transport t = builder.getTransportManager().getTransport(getBindingId());
if (!(t instanceof WSDL11Transport)) return null;
Definition def = builder.getDefinition();
javax.wsdl.Binding wbinding = def.createBinding();
wbinding.setQName( getName() );
wbinding.setPortType( portType );
wbinding.setUndefined(false);
// add in soap:Body, et al
wbinding.addExtensibilityElement(createSoapBinding());
for (Iterator oitr = getService().getServiceInfo().getOperations().iterator(); oitr.hasNext();)
{
OperationInfo op = (OperationInfo) oitr.next();
javax.wsdl.Operation wsdlOp =
(javax.wsdl.Operation) portType.getOperation(op.getName(), null, null);
javax.wsdl.BindingOperation bop = createBindingOperation(builder, wsdlOp, op);
createHeaders(builder, op, bop);
wbinding.addBindingOperation(bop);
}
def.addBinding(wbinding);
return wbinding;
}
代码示例来源:origin: org.objectweb.celtix/celtix-tools
private void doAppendBinding() throws ToolException {
if (binding == null) {
binding = wsdlDefinition.createBinding();
binding.setQName(new QName(wsdlDefinition.getTargetNamespace(), (String)env
.get(ToolConstants.CFG_BINDING)));
binding.setUndefined(false);
binding.setPortType(portType);
}
setSoapBindingExtElement();
addBindingOperation();
wsdlDefinition.addBinding(binding);
WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER);
try {
wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG);
throw new ToolException(msg);
}
try {
outputWriter.close();
} catch (IOException ioe) {
Message msg = new Message("PORTTYPE_NOT_EXIST", LOG);
throw new ToolException(msg);
}
}
代码示例来源:origin: apache/cxf
private void doAppendBinding() throws ToolException {
if (binding == null) {
binding = wsdlDefinition.createBinding();
binding.setQName(new QName(wsdlDefinition.getTargetNamespace(),
(String)env.get(ToolConstants.CFG_BINDING)));
binding.setUndefined(false);
binding.setPortType(portType);
}
setSoapBindingExtElement();
addBindingOperation();
wsdlDefinition.addBinding(binding);
WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER);
try {
wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG, wse.getMessage());
throw new ToolException(msg);
}
try {
outputWriter.close();
} catch (IOException ioe) {
Message msg = new Message("PORTTYPE_NOT_EXIST", LOG);
throw new ToolException(msg);
}
}
代码示例来源:origin: org.apache.cxf/cxf-tools-misctools
private void doAppendBinding() throws ToolException {
if (binding == null) {
binding = wsdlDefinition.createBinding();
binding.setQName(new QName(wsdlDefinition.getTargetNamespace(),
(String)env.get(ToolConstants.CFG_BINDING)));
binding.setUndefined(false);
binding.setPortType(portType);
}
setSoapBindingExtElement();
addBindingOperation();
wsdlDefinition.addBinding(binding);
WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER);
try {
wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
} catch (WSDLException wse) {
Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG, wse.getMessage());
throw new ToolException(msg);
}
try {
outputWriter.close();
} catch (IOException ioe) {
Message msg = new Message("PORTTYPE_NOT_EXIST", LOG);
throw new ToolException(msg);
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-wsdlgen
public Binding createBinding(Definition definition, PortType portType) {
try {
Binding binding = definition.createBinding();
binding.setPortType(portType);
configureBinding(definition, binding, portType);
ExtensibilityElement bindingExtension =
definition.getExtensionRegistry().createExtension(Binding.class, soapBinding);
if (requiresSOAP12) {
((SOAP12Binding)bindingExtension).setStyle("document");
((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http");
} else {
((SOAPBinding)bindingExtension).setStyle("document");
((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http");
}
binding.addExtensibilityElement(bindingExtension);
return binding;
} catch (WSDLException e) {
throw new WSDLGenerationException(e);
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public Binding createBinding(Definition definition, PortType portType) {
try {
Binding binding = definition.createBinding();
binding.setPortType(portType);
configureBinding(definition, binding, portType);
ExtensibilityElement bindingExtension =
definition.getExtensionRegistry().createExtension(Binding.class, soapBinding);
if (requiresSOAP12) {
((SOAP12Binding)bindingExtension).setStyle("document");
((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http");
} else {
((SOAPBinding)bindingExtension).setStyle("document");
((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http");
}
binding.addExtensibilityElement(bindingExtension);
return binding;
} catch (WSDLException e) {
throw new WSDLGenerationException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!