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

The following examples show how to use javax.wsdl.Definition#getBinding() . 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: WSDLDocCreator.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
private Binding createBindingSOAP( Definition def, PortType pt, String bindingName ) {
	Binding bind = def.getBinding( new QName( bindingName ) );
	if( bind == null ) {
		bind = def.createBinding();
		bind.setQName( new QName( tns, bindingName ) );
	}
	bind.setPortType( pt );
	bind.setUndefined( false );
	try {
		SOAPBinding soapBinding = (SOAPBinding) extensionRegistry.createExtension( Binding.class,
			new QName( NameSpacesEnum.SOAP.getNameSpaceURI(), "binding" ) );
		soapBinding.setTransportURI( NameSpacesEnum.SOAP_OVER_HTTP.getNameSpaceURI() );
		soapBinding.setStyle( "document" );
		bind.addExtensibilityElement( soapBinding );
	} catch( WSDLException ex ) {
		System.err.println( ex.getMessage() );
	}
	def.addBinding( bind );

	return bind;

}
 
Example 2
Source File: ManagementBusInvocationPluginSoapHttp.java    From container with Apache License 2.0 6 votes vote down vote up
private String getPortName(Definition wsdl, BindingOperation operation) {
    Binding binding = null;
    final Map<QName, ?> bindings = wsdl.getBindings();
    for (Map.Entry<QName, ?> entry : bindings.entrySet()) {
        Binding examined = wsdl.getBinding((QName) entry.getKey());
        if (examined.getBindingOperations().contains(operation)) {
            binding = examined;
            break;
        }
    }
    Map<QName, Service> services = wsdl.getServices();
    for (Service service : services.values()) {
        Map<QName, Port> ports = service.getPorts();
        for (Port port : ports.values()) {
            if (port.getBinding().equals(binding)) {
                return port.getName();
            }
        }
    }
    return "";
}
 
Example 3
Source File: ManagementBusInvocationPluginSoapHttp.java    From container with Apache License 2.0 6 votes vote down vote up
private BindingOperation findOperation(final Definition wsdl, final String operationName) {
    if (wsdl == null) {
        return null;
    }
    Map<QName, ?> bindings = wsdl.getBindings();
    for (Map.Entry<QName, ?> entry : bindings.entrySet()) {
        Binding binding = wsdl.getBinding((QName) entry.getKey());
        List<BindingOperation> definedOperations = binding.getBindingOperations();
        for (BindingOperation operation : definedOperations) {
            if (operation.getName().equalsIgnoreCase(operationName)) {
                return operation;
            }
        }
    }
    return null;
}
 
Example 4
Source File: CorbaObjectReferenceEventProducer.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected EprMetaData getObjectReferenceBinding(Definition wsdlDef, QName bindingName) {
    EprMetaData info = new EprMetaData();
    Binding wsdlBinding = wsdlDef.getBinding(bindingName);

    // If the binding name does not have a namespace associated with it, then we'll need to
    // get the list of all bindings and compare their local parts against our name.
    if (wsdlBinding == null && bindingName.getNamespaceURI().isEmpty()
        && !bindingName.getLocalPart().isEmpty()) {
        Collection<Binding> bindingsCollection = CastUtils.cast(wsdlDef.getBindings().values());
        for (Binding b : bindingsCollection) {
            if (b.getQName().getLocalPart().equals(bindingName.getLocalPart())) {
                wsdlBinding = b;
                break;
            }
        }
    }

    if (wsdlBinding != null) {
        info.setBinding(wsdlBinding);
        info.setCandidateWsdlDef(wsdlDef);
    }

    return info;
}
 
Example 5
Source File: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testMultipartCORBABindingGeneration() throws Exception {
    String fileName = getClass().getResource("/wsdl/multipart.wsdl").toString();
    generator.setWsdlFile(fileName);
    generator.addInterfaceName("Test.MultiPart");

    Definition model = generator.generateCORBABinding();

    QName bName = new QName("http://schemas.apache.org/tests", "Test.MultiPartCORBABinding", "tns");
    Binding binding = model.getBinding(bName);
    assertNotNull(binding);
    assertEquals("Test.MultiPartCORBABinding", binding.getQName().getLocalPart());
    assertEquals("Test.MultiPart",
                 binding.getPortType().getQName().getLocalPart());
    assertEquals(1, binding.getExtensibilityElements().size());
    assertEquals(32, binding.getBindingOperations().size());

    List<ExtensibilityElement> extElements = getExtensibilityElements(binding);
    ExtensibilityElement extElement = extElements.get(0);
    if ("binding".equals(extElement.getElementType().getLocalPart())) {
        BindingType bindingType = (BindingType)extElement;
        assertEquals(bindingType.getRepositoryID(), "IDL:Test/MultiPart:1.0");
    }

    getStringAttributeTest(binding);
    getTestIdTest(binding);
    setTestIdTest(binding);
    testVoidTest(binding);
    testPrimitiveTypeTest(binding, "test_short", CorbaConstants.NT_CORBA_SHORT);
    testPrimitiveTypeTest(binding, "test_long", CorbaConstants.NT_CORBA_LONG);
    testPrimitiveTypeTest(binding, "test_longlong", CorbaConstants.NT_CORBA_LONGLONG);
    testPrimitiveTypeTest(binding, "test_ushort", CorbaConstants.NT_CORBA_USHORT);
    testPrimitiveTypeTest(binding, "test_ulong", CorbaConstants.NT_CORBA_ULONG);
    testPrimitiveTypeTest(binding, "test_ulonglong", CorbaConstants.NT_CORBA_ULONGLONG);
    testPrimitiveTypeTest(binding, "test_float", CorbaConstants.NT_CORBA_FLOAT);
    testPrimitiveTypeTest(binding, "test_double", CorbaConstants.NT_CORBA_DOUBLE);
    testPrimitiveTypeTest(binding, "test_octet", CorbaConstants.NT_CORBA_OCTET);
    testPrimitiveTypeTest(binding, "test_boolean", CorbaConstants.NT_CORBA_BOOLEAN);
    testPrimitiveTypeTest(binding, "test_char", CorbaConstants.NT_CORBA_CHAR);
    testPrimitiveTypeTest(binding, "test_integer", CorbaConstants.NT_CORBA_LONGLONG);
    testPrimitiveTypeTest(binding, "test_nonNegativeInteger", CorbaConstants.NT_CORBA_ULONGLONG);
    testPrimitiveTypeTest(binding, "test_positiveInteger", CorbaConstants.NT_CORBA_ULONGLONG);
    testPrimitiveTypeTest(binding, "test_negativeInteger", CorbaConstants.NT_CORBA_LONGLONG);
    testPrimitiveTypeTest(binding, "test_normalizedString", CorbaConstants.NT_CORBA_STRING);
    testPrimitiveTypeTest(binding, "test_token", CorbaConstants.NT_CORBA_STRING);
    testPrimitiveTypeTest(binding, "test_language", CorbaConstants.NT_CORBA_STRING);
    testPrimitiveTypeTest(binding, "test_Name", CorbaConstants.NT_CORBA_STRING);
    testPrimitiveTypeTest(binding, "test_NCName", CorbaConstants.NT_CORBA_STRING);
    testPrimitiveTypeTest(binding, "test_ID", CorbaConstants.NT_CORBA_STRING);
    testPrimitiveTypeTest(binding, "test_anyURI", CorbaConstants.NT_CORBA_STRING);
    testPrimitiveTypeTest(binding, "test_nick_name", CorbaConstants.NT_CORBA_STRING);
}