use of javax.wsdl.Binding in project cxf by apache.
the class SOAPBindingUtil method createSoapBinding.
public static SOAPBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12) throws WSDLException {
final ExtensibilityElement extElement;
if (isSOAP12) {
extElement = extReg.createExtension(Binding.class, new QName(WSDLConstants.NS_SOAP12, "binding"));
((SOAP12Binding) extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
} else {
extElement = extReg.createExtension(Binding.class, new QName(WSDLConstants.NS_SOAP11, "binding"));
((SOAPBinding) extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
}
return getSoapBinding(extElement);
}
use of javax.wsdl.Binding in project cxf by apache.
the class PartialWSDLProcessor method doAppendBinding.
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;
}
use of javax.wsdl.Binding in project cxf by apache.
the class PartialWSDLProcessor method isBindingExisted.
public static boolean isBindingExisted(Definition wsdlDefinition, QName name) {
Map<QName, Binding> bindings = CastUtils.cast(wsdlDefinition.getAllBindings());
Binding binding = null;
if (bindings == null || bindings.isEmpty()) {
return false;
}
try {
for (Entry<QName, Binding> entry : bindings.entrySet()) {
if (entry.getKey().getLocalPart().contains(name.getLocalPart())) {
binding = entry.getValue();
break;
}
}
} catch (Exception e) {
binding = null;
}
return binding != null;
}
use of javax.wsdl.Binding in project cxf by apache.
the class WSDLServiceBuilder method buildMockServices.
public List<ServiceInfo> buildMockServices(Definition d) {
List<ServiceInfo> serviceList = new ArrayList<>();
List<Definition> defList = new ArrayList<>();
defList.add(d);
parseImports(d, defList);
for (Definition def : defList) {
for (Iterator<?> ite = def.getPortTypes().entrySet().iterator(); ite.hasNext(); ) {
Entry<?, ?> entry = (Entry<?, ?>) ite.next();
PortType portType = def.getPortType((QName) entry.getKey());
ServiceInfo serviceInfo = this.buildMockService(def, portType);
serviceList.add(serviceInfo);
for (Iterator<?> it2 = d.getAllBindings().values().iterator(); it2.hasNext(); ) {
Binding b = (Binding) it2.next();
if (b.getPortType() == portType) {
this.buildBinding(serviceInfo, b);
break;
}
}
}
if (def.getPortTypes().isEmpty()) {
DescriptionInfo description = new DescriptionInfo();
if (recordOriginal) {
description.setProperty(WSDL_DEFINITION, def);
}
description.setName(def.getQName());
description.setBaseURI(def.getDocumentBaseURI());
copyExtensors(description, def.getExtensibilityElements());
copyExtensionAttributes(description, def);
ServiceInfo service = new ServiceInfo();
service.setDescription(description);
if (recordOriginal) {
service.setProperty(WSDL_DEFINITION, def);
}
getSchemas(def, service);
service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);
serviceList.add(service);
}
}
return serviceList;
}
use of javax.wsdl.Binding in project cxf by apache.
the class WSDLServiceBuilder method buildServices.
private List<ServiceInfo> buildServices(Definition def, Service serv, QName endpointName, DescriptionInfo d) {
Map<QName, ServiceInfo> services = new LinkedHashMap<>();
DescriptionInfo description = d;
if (null == description) {
description = new DescriptionInfo();
if (recordOriginal) {
description.setProperty(WSDL_DEFINITION, def);
}
description.setName(def.getQName());
description.setBaseURI(def.getDocumentBaseURI());
copyExtensors(description, def.getExtensibilityElements());
copyExtensionAttributes(description, def);
Set<Definition> done = new HashSet<>();
done.add(def);
Collection<List<Import>> values = CastUtils.cast(def.getImports().values());
for (List<Import> imports : values) {
for (Import imp : imports) {
if (!done.contains(imp.getDefinition())) {
done.add(imp.getDefinition());
copyExtensors(description, imp.getExtensibilityElements());
copyExtensionAttributes(description, imp);
copyExtensors(description, imp.getDefinition().getExtensibilityElements());
copyExtensionAttributes(description, imp.getDefinition());
}
}
}
}
for (Port port : cast(serv.getPorts().values(), Port.class)) {
if (endpointName != null && !endpointName.getLocalPart().equals(port.getName())) {
continue;
}
Binding binding = port.getBinding();
PortType bindingPt = binding.getPortType();
if (bindingPt == null) {
org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("BINDING_MISSING_TYPE", LOG, binding.getQName());
throw new WSDLRuntimeException(msg);
}
// TODO: wsdl4j's bug. if there is recursive import,
// wsdl4j can not get operation input message
PortType pt = def.getPortType(bindingPt.getQName());
if (pt == null) {
pt = bindingPt;
}
ServiceInfo service = services.get(pt.getQName());
if (service == null) {
service = new ServiceInfo();
service.setDescription(description);
description.getDescribed().add(service);
if (recordOriginal) {
service.setProperty(WSDL_DEFINITION, def);
service.setProperty(WSDL_SERVICE, serv);
}
getSchemas(def, service);
copyDocumentation(service, serv);
service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);
service.setTargetNamespace(def.getTargetNamespace());
service.setName(serv.getQName());
copyExtensors(service, serv.getExtensibilityElements());
copyExtensionAttributes(service, serv);
buildInterface(service, pt);
services.put(pt.getQName(), service);
}
BindingInfo bi = service.getBinding(binding.getQName());
if (bi == null) {
bi = buildBinding(service, binding);
}
buildEndpoint(service, bi, port);
}
return new ArrayList<>(services.values());
}
Aggregations