use of javax.wsdl.Binding in project cxf by apache.
the class WSDLDefinitionBuilderTest method testBuildImportedWSDL.
@Test
public void testBuildImportedWSDL() throws Exception {
String wsdlUrl = getClass().getResource("hello_world_services.wsdl").toString();
WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(BusFactory.getDefaultBus());
Definition def = builder.build(wsdlUrl);
assertNotNull(def);
Map<?, ?> services = def.getServices();
assertNotNull(services);
assertEquals(1, services.size());
String serviceQName = "http://apache.org/hello_world/services";
Service service = (Service) services.get(new QName(serviceQName, "SOAPService"));
assertNotNull(service);
Map<?, ?> ports = service.getPorts();
assertNotNull(ports);
assertEquals(1, ports.size());
Port port = service.getPort("SoapPort");
assertNotNull(port);
Binding binding = port.getBinding();
assertNotNull(binding);
QName bindingQName = new QName("http://apache.org/hello_world/bindings", "SOAPBinding");
assertEquals(bindingQName, binding.getQName());
PortType portType = binding.getPortType();
assertNotNull(portType);
QName portTypeQName = new QName("http://apache.org/hello_world", "Greeter");
assertEquals(portTypeQName, portType.getQName());
Operation op1 = portType.getOperation("sayHi", "sayHiRequest", "sayHiResponse");
assertNotNull(op1);
QName messageQName = new QName("http://apache.org/hello_world/messages", "sayHiRequest");
assertEquals(messageQName, op1.getInput().getMessage().getQName());
Part part = op1.getInput().getMessage().getPart("in");
assertNotNull(part);
assertEquals(new QName("http://apache.org/hello_world/types", "sayHi"), part.getElementName());
}
use of javax.wsdl.Binding in project tesb-studio-se by Talend.
the class ComponentBuilder method populateComponent.
private static ServiceInfo populateComponent(Service service) {
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setServiceName(service.getQName());
Collection<Port> ports = service.getPorts().values();
for (Port port : ports) {
String soapLocation = null;
SOAPAddress soapAddress = findExtensibilityElement(port.getExtensibilityElements(), SOAPAddress.class);
if (null != soapAddress) {
soapLocation = soapAddress.getLocationURI();
} else {
SOAP12Address soap12Address = findExtensibilityElement(port.getExtensibilityElements(), SOAP12Address.class);
if (null != soap12Address) {
soapLocation = soap12Address.getLocationURI();
}
}
Binding binding = port.getBinding();
for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) {
SOAPOperation soapOperation = findExtensibilityElement(operation.getExtensibilityElements(), SOAPOperation.class);
OperationInfo operationInfo = new OperationInfo(operation.getOperation());
operationInfo.setPortName(port.getName());
operationInfo.setNamespaceURI(binding.getPortType().getQName().getNamespaceURI());
if (soapOperation != null) {
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
} else {
SOAP12Operation soap12Operation = findExtensibilityElement(operation.getExtensibilityElements(), SOAP12Operation.class);
if (soap12Operation != null) {
operationInfo.setSoapActionURI(soap12Operation.getSoapActionURI());
}
}
operationInfo.setTargetURL(soapLocation);
serviceInfo.addOperation(operationInfo);
}
}
return serviceInfo;
}
use of javax.wsdl.Binding in project tesb-studio-se by Talend.
the class PublishMetadataRunnable method getAllPaths.
@SuppressWarnings("unchecked")
private Collection<String> getAllPaths() throws URISyntaxException {
final Set<String> paths = new HashSet<String>();
final Set<QName> portTypes = new HashSet<QName>();
final Set<QName> alreadyCreated = new HashSet<QName>();
for (Binding binding : (Collection<Binding>) wsdlDefinition.getAllBindings().values()) {
final QName portType = binding.getPortType().getQName();
if (portTypes.add(portType)) {
for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) {
Operation oper = operation.getOperation();
Input inDef = oper.getInput();
if (inDef != null) {
Message inMsg = inDef.getMessage();
addParamsToPath(portType, oper, inMsg, paths, alreadyCreated);
}
Output outDef = oper.getOutput();
if (outDef != null) {
Message outMsg = outDef.getMessage();
addParamsToPath(portType, oper, outMsg, paths, alreadyCreated);
}
for (Fault fault : (Collection<Fault>) oper.getFaults().values()) {
Message faultMsg = fault.getMessage();
addParamsToPath(portType, oper, faultMsg, paths, alreadyCreated);
}
}
}
}
return paths;
}
use of javax.wsdl.Binding in project pentaho-kettle by pentaho.
the class Wsdl method getOperation.
/**
* Find the specified operation in the WSDL definition.
*
* @param operationName
* Name of operation to find.
* @return A WsdlOperation instance, null if operation can not be found in WSDL.
*/
public WsdlOperation getOperation(String operationName) throws KettleStepException {
// is the operation in the cache?
if (_operationCache.containsKey(operationName)) {
return _operationCache.get(operationName);
}
Binding b = _port.getBinding();
PortType pt = b.getPortType();
Operation op = pt.getOperation(operationName, null, null);
if (op != null) {
try {
WsdlOperation wop = new WsdlOperation(b, op, _wsdlTypes);
// cache the operation
_operationCache.put(operationName, wop);
return wop;
} catch (KettleException kse) {
LogChannel.GENERAL.logError("Could not retrieve WSDL Operator for operation name: " + operationName);
throw new KettleStepException("Could not retrieve WSDL Operator for operation name: " + operationName, kse);
}
}
return null;
}
Aggregations