use of javax.wsdl.Service in project cxf by apache.
the class CorbaObjectReferenceHelper method populateEprInfo.
public static void populateEprInfo(EprMetaData info) {
if (!info.isValid()) {
return;
}
Binding match = info.getBinding();
Definition wsdlDef = info.getCandidateWsdlDef();
Collection<Service> services = CastUtils.cast(wsdlDef.getServices().values());
for (Service serv : services) {
Collection<Port> ports = CastUtils.cast(serv.getPorts().values());
for (Port pt : ports) {
if (pt.getBinding().equals(match)) {
info.setPortName(pt.getName());
info.setServiceQName(serv.getQName());
break;
}
}
}
if (info.getServiceQName() == null) {
Iterator<?> importLists = wsdlDef.getImports().values().iterator();
while (info.getServiceQName() == null && importLists.hasNext()) {
List<?> imports = (List<?>) importLists.next();
for (java.lang.Object imp : imports) {
if (imp instanceof Import) {
Definition importDef = ((Import) imp).getDefinition();
LOG.log(Level.FINE, "following wsdl import " + importDef.getDocumentBaseURI());
info.setCandidateWsdlDef(importDef);
populateEprInfo(info);
if (info.getServiceQName() != null) {
break;
}
}
}
}
}
}
use of javax.wsdl.Service in project cxf by apache.
the class JaxWsServiceConfigurationTest method getMockedServiceModel.
private ServiceInfo getMockedServiceModel(String wsdlUrl) throws Exception {
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
Definition def = wsdlReader.readWSDL(new CatalogWSDLLocator(wsdlUrl));
IMocksControl control = EasyMock.createNiceControl();
Bus bus = control.createMock(Bus.class);
BindingFactoryManager bindingFactoryManager = control.createMock(BindingFactoryManager.class);
DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
WSDLServiceBuilder wsdlServiceBuilder = new WSDLServiceBuilder(bus);
Service service = null;
for (Iterator<?> it = def.getServices().values().iterator(); it.hasNext(); ) {
Object obj = it.next();
if (obj instanceof Service) {
service = (Service) obj;
break;
}
}
EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager);
EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
control.replay();
ServiceInfo serviceInfo = wsdlServiceBuilder.buildServices(def, service).get(0);
serviceInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION, null);
serviceInfo.setProperty(WSDLServiceBuilder.WSDL_SERVICE, null);
return serviceInfo;
}
use of javax.wsdl.Service in project cxf by apache.
the class WSDLRefValidator method collectValidationPointsForBindings.
private void collectValidationPointsForBindings() throws Exception {
Map<QName, XNode> vBindingNodes = new HashMap<>();
for (Service service : services.values()) {
vBindingNodes.putAll(getBindings(service));
}
for (Map.Entry<QName, XNode> entry : vBindingNodes.entrySet()) {
QName bName = entry.getKey();
Binding binding = this.definition.getBinding(bName);
if (binding == null) {
LOG.log(Level.SEVERE, bName.toString() + " is not correct, please check that the correct namespace is being used");
throw new Exception(bName.toString() + " is not correct, please check that the correct namespace is being used");
}
XNode vBindingNode = getXNode(binding);
vBindingNode.setFailurePoint(entry.getValue());
vNodes.add(vBindingNode);
if (binding.getPortType() == null) {
continue;
}
portTypeRefNames.add(binding.getPortType().getQName());
XNode vPortTypeNode = getXNode(binding.getPortType());
vPortTypeNode.setFailurePoint(vBindingNode);
vNodes.add(vPortTypeNode);
Collection<BindingOperation> bops = CastUtils.cast(binding.getBindingOperations());
for (BindingOperation bop : bops) {
XNode vOpNode = getOperationXNode(vPortTypeNode, bop.getName());
XNode vBopNode = getOperationXNode(vBindingNode, bop.getName());
vOpNode.setFailurePoint(vBopNode);
vNodes.add(vOpNode);
if (bop.getBindingInput() != null) {
String inName = bop.getBindingInput().getName();
if (!StringUtils.isEmpty(inName)) {
XNode vInputNode = getInputXNode(vOpNode, inName);
vInputNode.setFailurePoint(getInputXNode(vBopNode, inName));
vNodes.add(vInputNode);
}
}
if (bop.getBindingOutput() != null) {
String outName = bop.getBindingOutput().getName();
if (!StringUtils.isEmpty(outName)) {
XNode vOutputNode = getOutputXNode(vOpNode, outName);
vOutputNode.setFailurePoint(getOutputXNode(vBopNode, outName));
vNodes.add(vOutputNode);
}
}
for (Iterator<?> iter1 = bop.getBindingFaults().keySet().iterator(); iter1.hasNext(); ) {
String faultName = (String) iter1.next();
XNode vFaultNode = getFaultXNode(vOpNode, faultName);
vFaultNode.setFailurePoint(getFaultXNode(vBopNode, faultName));
vNodes.add(vFaultNode);
}
}
}
}
use of javax.wsdl.Service in project cxf by apache.
the class WSDLToCorbaBindingTypeTest method testSetCorbaAddressFile.
@Test
public void testSetCorbaAddressFile() throws Exception {
try {
URI fileName = getClass().getResource("/wsdl/datetime.wsdl").toURI();
generator.setWsdlFile(new File(fileName).getAbsolutePath());
generator.addInterfaceName("BasePortType");
Definition model = generator.generateCORBABinding();
QName name = new QName("http://schemas.apache.org/idl/datetime.idl", "BaseCORBAService", "tns");
Service service = model.getService(name);
Port port = service.getPort("BaseCORBAPort");
AddressType addressType = (AddressType) port.getExtensibilityElements().get(0);
String address = addressType.getLocation();
assertEquals("file:./Base.ref", address);
URL idl = getClass().getResource("/wsdl/addressfile.txt");
String filename = new File(idl.toURI()).getAbsolutePath();
generator.setAddressFile(filename);
model = generator.generateCORBABinding();
service = model.getService(name);
port = service.getPort("BaseCORBAPort");
addressType = (AddressType) port.getExtensibilityElements().get(0);
address = addressType.getLocation();
assertEquals("corbaloc::localhost:60000/hw", address);
} finally {
new File("datetime-corba.wsdl").deleteOnExit();
}
}
use of javax.wsdl.Service in project cxf by apache.
the class EmbeddedJMSBrokerLauncher method updateWsdlExtensors.
public static void updateWsdlExtensors(Bus bus, String wsdlLocation, String url, String encodedUrl) {
try {
if (encodedUrl == null) {
encodedUrl = url;
}
if (bus == null) {
bus = BusFactory.getThreadDefaultBus();
}
Definition def = bus.getExtension(WSDLManager.class).getDefinition(wsdlLocation);
Map<?, ?> map = def.getAllServices();
for (Object o : map.values()) {
Service service = (Service) o;
Map<?, ?> ports = service.getPorts();
adjustExtensibilityElements(service.getExtensibilityElements(), url, encodedUrl);
for (Object p : ports.values()) {
Port port = (Port) p;
adjustExtensibilityElements(port.getExtensibilityElements(), url, encodedUrl);
adjustExtensibilityElements(port.getBinding().getExtensibilityElements(), url, encodedUrl);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations