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

The following examples show how to use javax.wsdl.Definition#getPortType() . These examples are extracted from open source projects. 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
private PortType createPortType( Definition def, String portTypeName ) {
	PortType pt = def.getPortType( new QName( portTypeName ) );
	if( pt == null ) {
		pt = new PortTypeImpl();
	}

	pt.setUndefined( false );
	QName pt_QN = new QName( tns, portTypeName );

	pt.setQName( pt_QN );
	def.addPortType( pt );

	return pt;
}
 
Example 2
Source Project: cxf   File: WSDLRefValidator.java    License: Apache License 2.0 5 votes vote down vote up
private PortType getPortType(QName ptName) {
    PortType portType = this.definition.getPortType(ptName);
    if (portType == null) {
        for (Definition d : importedDefinitions) {
            portType = d.getPortType(ptName);
            if (portType != null) {
                break;
            }
        }
    }
    return portType;
}
 
Example 3
Source Project: cxf   File: PortTypeVisitor.java    License: Apache License 2.0 5 votes vote down vote up
private PortType findPortType(Scope intfScope) {
    String tns = mapper.map(intfScope.getParent());
    String intfName = intfScope.toString();
    Definition defn = definition;
    if (tns != null) {
        defn = manager.getWSDLDefinition(tns);
        intfName = intfScope.tail();
    }
    if (defn != null) {
        tns = defn.getTargetNamespace();
        QName name = new QName(tns, intfName);
        return defn.getPortType(name);
    }
    return null;
}
 
Example 4
Source Project: cxf   File: CodeFirstWSDLTest.java    License: 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 5
Source Project: cxf   File: CodeFirstWSDLTest.java    License: 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 6
Source Project: cxf   File: WSDLServiceBuilder.java    License: Apache License 2.0 4 votes vote down vote up
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;
}