Java Code Examples for javax.wsdl.Definition#getService()

The following examples show how to use javax.wsdl.Definition#getService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WSDL2UDDI.java    From juddi with Apache License 2.0 6 votes vote down vote up
public BusinessServices registerBusinessServices(Definition wsdlDefinition) throws RemoteException, ConfigurationException, TransportException, WSDLException, MalformedURLException {

                BusinessServices businessServices = new BusinessServices();

                for (Object serviceName : wsdlDefinition.getAllServices().keySet()) {
                        QName serviceQName = (QName) serviceName;
                        Service service = wsdlDefinition.getService(serviceQName);
                        BusinessService businessService = null;
                        //add service
                        URL serviceUrl = null;
                        if (service.getPorts() != null && service.getPorts().size() > 0) {
                                for (Object portName : service.getPorts().keySet()) {
                                        businessService = registerBusinessService(serviceQName, (String) portName, serviceUrl, wsdlDefinition).getBusinessService();
                                }
                        }
                        if (businessService != null) {
                                businessServices.getBusinessService().add(businessService);
                        }
                }

                return businessServices;

        }
 
Example 2
Source File: WSDL2UDDI.java    From juddi with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a business service based off of a WSDL definition<Br>No
 * changes are made to the UDDI endpoints using this method
 * <br>
 * Example Code:
 * <pre>
 * URL url = new URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl");
 * String domain = url.getHost();
 * ReadWSDL rw = new ReadWSDL();
 * Definition wsdlDefinition = rw.readWSDL(url);
 * properties.put("keyDomain", domain);
 * properties.put("businessName", domain);
 * properties.put("serverName", url.getHost());
 * properties.put("serverPort", url.getPort());
 * wsdlURL = wsdlDefinition.getDocumentBaseURI();
 * WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
 * BusinessServices businessServices = wsdl2UDDI.createBusinessServices(wsdlDefinition);
 * </pre>
 *
 * @param wsdlDefinition must not be null
 * @return a business service
 * @throws MalformedURLException
 * @throws IllegalArgumentException if the wsdlDefinition is null
 */
public BusinessServices createBusinessServices(Definition wsdlDefinition) throws MalformedURLException {
        if (wsdlDefinition == null) {
                throw new IllegalArgumentException();
        }
        BusinessServices businessServices = new BusinessServices();
        for (Object serviceName : wsdlDefinition.getAllServices().keySet()) {
                QName serviceQName = (QName) serviceName;
                Service service = wsdlDefinition.getService(serviceQName);
                BusinessService businessService = createBusinessService(serviceQName, wsdlDefinition);
    //service.getExtensibilityElements().
                //add the bindingTemplates
                URL serviceUrl = null;
                if (service.getPorts() != null && service.getPorts().size() > 0) {
                        businessService.setBindingTemplates(new BindingTemplates());
                        for (Object portName : service.getPorts().keySet()) {
                                BindingTemplate bindingTemplate = createWSDLBinding(serviceQName, (String) portName, serviceUrl, wsdlDefinition);
                                businessService.getBindingTemplates().getBindingTemplate().add(bindingTemplate);
                        }
                }
                businessServices.getBusinessService().add(businessService);
        }

        return businessServices;
}
 
Example 3
Source File: JavaToProcessorTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testSimpleClass() throws Exception {
    env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/doc_wrapped_bare.wsdl");
    env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.simple.Hello");
    processor.setEnvironment(env);
    processor.process();

    File wsdlFile = new File(output, "doc_wrapped_bare.wsdl");
    assertTrue("Fail to generate wsdl file: " + wsdlFile.toString(), wsdlFile.exists());

    String tns = "http://simple.fortest.tools.cxf.apache.org/";

    Definition def = getDefinition(wsdlFile.getPath());
    assertNotNull(def);
    Service wsdlService = def.getService(new QName(tns, "Hello"));
    assertNotNull("Generate WSDL Service Error", wsdlService);
}
 
Example 4
Source File: SoapApiModelParser.java    From syndesis with Apache License 2.0 5 votes vote down vote up
private static Service getService(Definition definition, QName serviceName) throws ParserException {
    final Service service = definition.getService(serviceName);
    if (service == null) {
        throw new ParserException("Missing Service " + serviceName, "serviceName");
    }
    return service;
}
 
Example 5
Source File: BPEL2UDDI.java    From juddi with Apache License 2.0 5 votes vote down vote up
/**
 * Registers the Service into UDDI.
 * 
 * @param serviceName
 * @param wsdlDefinition
 * @return a business service
 */
public BusinessService createBusinessService(QName serviceName, Definition wsdlDefinition) {
	
	log.debug("Constructing Service UDDI Information for " + serviceName);
	BusinessService service = new BusinessService();
	// BusinessKey
	service.setBusinessKey(businessKey);
	// ServiceKey
	service.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart()));
	// Description
	String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION);
	if (wsdlDefinition.getService(serviceName) !=null) {
		// Override with the service description from the WSDL if present
		Element docElement = wsdlDefinition.getService(serviceName).getDocumentationElement();
		if (docElement!=null && docElement.getTextContent()!=null) {
			serviceDescription = docElement.getTextContent();
		}
	}
	
	service.getDescription().addAll(Common2UDDI.mapDescription(serviceDescription, lang));
	// Service name
	Name sName = new Name();
	sName.setLang(lang);
	sName.setValue(serviceName.getLocalPart());
	service.getName().add(sName);
	
	//customization to add KeyedReferences into the categoryBag of the service
	if (properties.containsKey(Property.SERVICE_CATEGORY_BAG)) {
		String serviceCategoryBag = properties.getProperty(Property.SERVICE_CATEGORY_BAG);
		log.debug("Adding KeyedReferences '" +  serviceCategoryBag + "' to service " + serviceName.getLocalPart());
		CategoryBag categoryBag = parseCategoryBag(serviceCategoryBag);
        service.setCategoryBag(categoryBag);
	}
	
	return service;
}
 
Example 6
Source File: WSDLToCorbaBindingTypeTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetCorbaAddress() throws Exception {

    try {
        String fileName = getClass().getResource("/wsdl/datetime.wsdl").toString();
        generator.setWsdlFile(fileName);
        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);

        generator.setAddress("corbaloc::localhost:40000/hw");
        model = generator.generateCORBABinding();
        service = model.getService(name);
        port = service.getPort("BaseCORBAPort");
        addressType = (AddressType)port.getExtensibilityElements().get(0);
        address = addressType.getLocation();
        assertEquals("corbaloc::localhost:40000/hw", address);
    } finally {
        new File("datetime-corba.wsdl").deleteOnExit();
    }
}
 
Example 7
Source File: WSDLToCorbaBindingTypeTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@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();
    }
}
 
Example 8
Source File: WSDLServiceBuilder.java    From cxf with Apache License 2.0 5 votes vote down vote up
private List<ServiceInfo> buildServices(Definition d,
                                        QName name,
                                        QName endpointName,
                                        DescriptionInfo description) {
    Service service = d.getService(name);
    if (service == null) {
        org.apache.cxf.common.i18n.Message msg =
            new org.apache.cxf.common.i18n.Message("MISSING_SERVICE",
                                                   LOG,
                                                   name);
        throw new WSDLRuntimeException(msg);
    }
    return buildServices(d, service, endpointName, description);
}
 
Example 9
Source File: SoapApiConnectorGenerator.java    From syndesis with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private Connector createConnector(ConnectorTemplate connectorTemplate, ConnectorSettings connectorSettings,
                                  SoapApiModelInfo modelInfo) {

    final Definition definition = modelInfo.getModel().
            orElseThrow(() -> new IllegalArgumentException("Unable to parse WSDL, or missing SOAP Service and Port in specification"));

    // get service and port
    final Map<String, String> configuredProperties = connectorSettings.getConfiguredProperties();
    final QName serviceName = getService(modelInfo, configuredProperties)
            .orElseThrow(() -> new IllegalArgumentException("Missing property " + SERVICE_NAME_PROPERTY));
    final String portName = getPortName(modelInfo, configuredProperties)
            .orElseThrow(() -> new IllegalArgumentException("Missing property " + PORT_NAME_PROPERTY));

    // get SOAP Version from Service and Port
    final Service service = definition.getService(serviceName);
    final Port port = service.getPort(portName);
    final Binding binding = port.getBinding();
    double soapVersion = 1.1;
    for (Object element : binding.getExtensibilityElements()) {
        if (element instanceof SOAP12Binding) {
            soapVersion = 1.2;
            break;
        }
    }

    // add actions
    try {

        final Connector configuredConnector = configuredConnector(connectorTemplate, connectorSettings);

        final List<ConnectorAction> actions = SoapApiModelParser.parseActions(definition,
                serviceName, new QName(serviceName.getNamespaceURI(), portName),
                configuredConnector.getId().get());
        final ActionsSummary actionsSummary = SoapApiModelParser.parseActionsSummary(definition, serviceName, portName);

        final Connector.Builder builder = new Connector.Builder()
                .createFrom(configuredConnector)
                .putConfiguredProperty(SOAP_VERSION_PROPERTY, String.valueOf(soapVersion))
                .addAllActions(actions)
                .actionsSummary(actionsSummary);

        return builder.build();

    } catch (ParserException e) {
        throw new IllegalArgumentException("Error getting actions from WSDL: " + e.getMessage(), e);
    }
}
 
Example 10
Source File: WSDL2UDDI.java    From juddi with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a UDDI Business Service.
 *
 * @param serviceQName
 * @param wsdlDefinition
 * @return a business service
 */
protected BusinessService createBusinessService(QName serviceQName, Definition wsdlDefinition) {

        log.debug("Constructing Service UDDI Information for " + serviceQName);
        BusinessService service = new BusinessService();
        // BusinessKey
        service.setBusinessKey(businessKey);
        // ServiceKey
        service.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));
        // Description
        String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION);
        // Override with the service description from the WSDL if present
        if (wsdlDefinition.getService(serviceQName) != null) {
                Element docElement = wsdlDefinition.getService(serviceQName).getDocumentationElement();
                if (docElement != null && docElement.getTextContent() != null) {
                        serviceDescription = docElement.getTextContent();
                }
        }

        service.getDescription().addAll(Common2UDDI.mapDescription(serviceDescription, lang));

        // Service name
        Name sName = new Name();
        sName.setLang(lang);
        sName.setValue(serviceQName.getLocalPart());
        service.getName().add(sName);

        CategoryBag categoryBag = new CategoryBag();

        String namespace = serviceQName.getNamespaceURI();
        if (namespace != null && namespace.length() != 0) {
                KeyedReference namespaceReference = newKeyedReference(
                        "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace);
                categoryBag.getKeyedReference().add(namespaceReference);
        }

        KeyedReference serviceReference = newKeyedReference(
                "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "service");
        categoryBag.getKeyedReference().add(serviceReference);

        KeyedReference localNameReference = newKeyedReference(
                "uddi:uddi.org:xml:localname", "uddi-org:xml:localName", serviceQName.getLocalPart());
        categoryBag.getKeyedReference().add(localNameReference);

        service.setCategoryBag(categoryBag);

        return service;
}
 
Example 11
Source File: BPEL2UDDI.java    From juddi with Apache License 2.0 4 votes vote down vote up
public BindingTemplate createBPELBinding(QName serviceName, String portName, URL serviceUrl, Definition wsdlDefinition) {
	
   	BindingTemplate bindingTemplate = new BindingTemplate();
	// Set BusinessService Key
	bindingTemplate.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart()));
	// Set Binding Key
	String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceName, portName, serviceUrl);
	bindingTemplate.setBindingKey(bindingKey);
	// Set AccessPoint
	AccessPoint accessPoint = new AccessPoint();
	accessPoint.setUseType(AccessPointType.END_POINT.toString());
	accessPoint.setValue(urlLocalizer.rewrite(serviceUrl));
	bindingTemplate.setAccessPoint(accessPoint);
	
	Service service =  wsdlDefinition.getService(serviceName);
	
	if (service!=null) {
		TModelInstanceDetails tModelInstanceDetails = new TModelInstanceDetails();
		
		Port port = service.getPort(portName);
		if (port!=null) {
			Binding binding = port.getBinding();
			// Set the Binding Description
			String bindingDescription = properties.getProperty(Property.BINDING_DESCRIPTION, Property.DEFAULT_BINDING_DESCRIPTION);
			// Override with the service description from the WSDL if present
			Element docElement = binding.getDocumentationElement();
			if (docElement!=null && docElement.getTextContent()!=null) {
				bindingDescription = docElement.getTextContent();
			}
			
			bindingTemplate.getDescription().addAll(Common2UDDI.mapDescription(bindingDescription, lang));
			
			// reference wsdl:binding tModel
			TModelInstanceInfo tModelInstanceInfoBinding = new TModelInstanceInfo();
			tModelInstanceInfoBinding.setTModelKey(keyDomainURI + binding.getQName().getLocalPart());
			InstanceDetails instanceDetails = new InstanceDetails();
			instanceDetails.setInstanceParms(portName);  
			tModelInstanceInfoBinding.setInstanceDetails(instanceDetails);
			
			tModelInstanceInfoBinding.getDescription().addAll(Common2UDDI.mapDescription("The wsdl:binding that this wsdl:port implements. " + bindingDescription +
					" The instanceParms specifies the port local name.", lang));
			tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoBinding);
			
			// reference wsdl:portType tModel
			PortType portType = binding.getPortType();
			TModelInstanceInfo tModelInstanceInfoPortType = new TModelInstanceInfo();
			tModelInstanceInfoPortType.setTModelKey(keyDomainURI + portType.getQName().getLocalPart());
			String portTypeDescription = "";
			docElement = portType.getDocumentationElement();
			if (docElement!=null && docElement.getTextContent()!=null) {
				portTypeDescription = docElement.getTextContent();
			}
			
			tModelInstanceInfoPortType.getDescription().addAll(Common2UDDI.mapDescription("The wsdl:portType that this wsdl:port implements." + portTypeDescription, lang));
			tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoPortType);
			
			//reference bpel:process tModel
			TModelInstanceInfo tModelInstanceInfoBPEL = new TModelInstanceInfo();
			tModelInstanceInfoBPEL.setTModelKey(keyDomainURI + service.getQName().getLocalPart() + "Process");
			
			// Description
			String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION);
			// Override with the service description from the WSDL if present
			docElement = wsdlDefinition.getService(serviceName).getDocumentationElement();
			if (docElement!=null && docElement.getTextContent()!=null) {
				serviceDescription = docElement.getTextContent();
			}
			
			tModelInstanceInfoBPEL.getDescription().addAll(Common2UDDI.mapDescription("The bpel:process this wsdl:port supports." + serviceDescription, lang));
			tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfoBPEL);
			
			bindingTemplate.setTModelInstanceDetails(tModelInstanceDetails);
		} else {
			log.error("Could not find Port with portName: " + portName);
		}
	} else {
		log.error("Could not find Service with serviceName: " + serviceName.getLocalPart());
	}
	
	if (log.isDebugEnabled()) {
   		log.debug(new PrintUDDI<BindingTemplate>().print(bindingTemplate));
   	}
	
	return bindingTemplate;
}
 
Example 12
Source File: IDLToWSDLProcessor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void generateCORBAService(Definition def,
                                 Binding[] bindings,
                                 boolean isDefaultMapping)
    throws Exception {
    Map<String, Service> serviceMap = new HashMap<>();
    Map<String, String> serviceNames = getServiceNames(bindings, isDefaultMapping);
    for (int i = 0; i < bindings.length; i++) {
        QName portTypeName = bindings[i].getPortType().getQName();
        Service service;
        if (isDefaultMapping) {
            service = def.createService();
            service.setQName(new QName(def.getTargetNamespace(),
                                       portTypeName.getLocalPart() + "CORBAService"));
            def.addService(service);
        } else {
            String ns = portTypeName.getNamespaceURI();
            String serviceName = serviceNames.get(ns);
            service = serviceMap.get(ns);
            if (service == null) {
                service = def.createService();
                serviceMap.put(ns, service);
                String[] serviceTokens = serviceName.split("\\.");
                String serviceToken = serviceTokens[serviceTokens.length - 1];
                QName serviceQName = new QName(def.getTargetNamespace(), serviceToken);
                Service existingService = def.getService(serviceQName);
                if (existingService != null) {
                    String existingServiceNS =
                        ((Port) existingService.getPorts().values().iterator().next())
                        .getBinding().getPortType().getQName().getNamespaceURI();
                    existingService.setQName(new QName(def.getTargetNamespace(),
                                                       serviceNames.get(existingServiceNS)));
                    serviceMap.put(existingServiceNS, existingService);
                    service.setQName(new QName(def.getTargetNamespace(),
                                               serviceName));
                } else {
                    service.setQName(serviceQName);
                }
                def.addService(service);
            }
        }
        Port port = def.createPort();
        port.setName(portTypeName.getLocalPart() + "CORBAPort");
        AddressType address =
            (AddressType) def.getExtensionRegistry().createExtension(Port.class,
                                                                     CorbaConstants.NE_CORBA_ADDRESS);

        String addr = null;
        String addrFileName = (String) env.get(ToolCorbaConstants.CFG_ADDRESSFILE);
        if (addrFileName != null) {
            File addrFile = new File(addrFileName);
            try {
                FileReader fileReader = new FileReader(addrFile);
                try (BufferedReader bufferedReader = new BufferedReader(fileReader)) {
                    addr = bufferedReader.readLine();
                }
            } catch (Exception ex) {
                throw new ToolException(ex.getMessage(), ex);
            }
        } else {
            addr = (String) env.get(ToolCorbaConstants.CFG_ADDRESS);
        }
        if (addr == null) {
            addr = "IOR:";
        }
        address.setLocation(addr);
        port.addExtensibilityElement((ExtensibilityElement)address);
        service.addPort(port);
        port.setBinding(bindings[i]);
    }
}
 
Example 13
Source File: JavaToProcessorTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testDocLitUseClassPathFlag() throws Exception {
    File classFile = new java.io.File(output.getCanonicalPath() + "/classes");
    classFile.mkdir();

    if (JavaUtils.isJava9Compatible()) {
        System.setProperty("org.apache.cxf.common.util.Compiler-fork", "true");
        String java9PlusFolder = output.getParent() + java.io.File.separator + "java9";
        System.setProperty("java.class.path", System.getProperty("java.class.path")
                           + java.io.File.pathSeparator + java9PlusFolder + java.io.File.separator + "*");
    }

    env.put(ToolConstants.CFG_COMPILE, ToolConstants.CFG_COMPILE);
    env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
    env.put(FrontEndProfile.class, PluginLoader.getInstance().getFrontEndProfile("jaxws"));
    env.put(DataBindingProfile.class, PluginLoader.getInstance().getDataBindingProfile("jaxb"));
    env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
    env.put(ToolConstants.CFG_PACKAGENAME, "org.apache.cxf.classpath");
    env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
    env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/hello_world_doc_lit.wsdl"));
    JAXWSContainer w2jProcessor = new JAXWSContainer(null);
    w2jProcessor.setContext(env);
    w2jProcessor.execute();


    String tns = "http://apache.org/sepecifiedTns";
    String serviceName = "cxfService";
    String portName = "cxfPort";

    System.setProperty("java.class.path", "");

    //      test flag
    String[] args = new String[] {"-o",
                                  "java2wsdl.wsdl",
                                  "-cp",
                                  classFile.getCanonicalPath(),
                                  "-t",
                                  tns,
                                  "-servicename",
                                  serviceName,
                                  "-portname",
                                  portName,
                                  "-soap12",
                                  "-d",
                                  output.getPath(),
                                  "-wsdl",
                                  "org.apache.cxf.classpath.Greeter"};
    JavaToWS.main(args);
    File wsdlFile = new File(output, "java2wsdl.wsdl");
    assertTrue("Generate Wsdl Fail", wsdlFile.exists());
    Definition def = getDefinition(wsdlFile.getPath());
    Service wsdlService = def.getService(new QName(tns, serviceName));
    assertNotNull("Generate WSDL Service Error", wsdlService);

    Port wsdlPort = wsdlService.getPort(portName);
    assertNotNull("Generate service port error ", wsdlPort);

}
 
Example 14
Source File: CodeFirstWSDLTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testWSDL1() throws Exception {
    Definition d = createService(Hello2.class);

    QName serviceName = new QName("http://service.jaxws.cxf.apache.org/", "Hello2Service");

    javax.wsdl.Service service = d.getService(serviceName);

    assertNotNull(service);

    QName portName = new QName("http://service.jaxws.cxf.apache.org/", "Hello2Port");

    javax.wsdl.Port port = service.getPort(portName.getLocalPart());

    assertNotNull(port);

    QName portTypeName = new QName("http://service.jaxws.cxf.apache.org/", "HelloInterface");

    javax.wsdl.PortType portType = d.getPortType(portTypeName);

    assertNotNull(portType);
    assertEquals(5, portType.getOperations().size());
}
 
Example 15
Source File: CodeFirstWSDLTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testWSDL2() throws Exception {
    Definition d = createService(Hello3.class);

    QName serviceName = new QName("http://mynamespace.com/", "MyService");

    javax.wsdl.Service service = d.getService(serviceName);

    assertNotNull(service);

    QName portName = new QName("http://mynamespace.com/", "MyPort");

    javax.wsdl.Port port = service.getPort(portName.getLocalPart());

    assertNotNull(port);

    QName portTypeName = new QName("http://service.jaxws.cxf.apache.org/", "HelloInterface");

    javax.wsdl.PortType portType = d.getPortType(portTypeName);

    assertNotNull(portType);
    assertEquals(5, portType.getOperations().size());
}
 
Example 16
Source File: PartialWSDLProcessor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isServiceExisted(Definition wsdlDefinition, QName name) {
    return wsdlDefinition.getService(name) != null;
}