Java Code Examples for javax.wsdl.Binding#getBindingOperation()

The following examples show how to use javax.wsdl.Binding#getBindingOperation() . 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: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void getStringAttributeTest(Binding binding) {
    BindingOperation bindingOp =
        binding.getBindingOperation("_get_string_attribute", "_get_string_attribute",
                                    "_get_string_attributeResponse");
    assertEquals("_get_string_attribute", bindingOp.getName());
    assertEquals(1, bindingOp.getExtensibilityElements().size());
    assertEquals(bindingOp.getBindingInput().getName(), "_get_string_attribute");
    assertEquals(bindingOp.getBindingOutput().getName(), "_get_string_attributeResponse");
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType)extElement;
            assertEquals(corbaOpType.getName(), "_get_string_attribute");
            assertEquals(corbaOpType.getReturn().getName(), "return");
            assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_STRING);
        }
    }
}
 
Example 2
Source File: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void getTestIdTest(Binding binding) {
    BindingOperation bindingOp = binding.getBindingOperation("_get_test_id",
                                            "_get_test_id", "_get_test_idResponse");
    assertEquals("_get_test_id", bindingOp.getName());
    assertEquals(1, bindingOp.getExtensibilityElements().size());
    assertEquals(bindingOp.getBindingInput().getName(), "_get_test_id");
    assertEquals(bindingOp.getBindingOutput().getName(), "_get_test_idResponse");
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType)extElement;
            assertEquals(corbaOpType.getName(), "_get_test_id");
            assertEquals(corbaOpType.getReturn().getName(), "return");
            assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_FLOAT);
        }
    }
}
 
Example 3
Source File: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void setTestIdTest(Binding binding) {
    BindingOperation bindingOp = binding.getBindingOperation("_set_test_id",
                                            "_set_test_id", "_set_test_idResponse");
    assertEquals("_set_test_id", bindingOp.getName());
    assertEquals(1, bindingOp.getExtensibilityElements().size());
    assertEquals(bindingOp.getBindingInput().getName(), "_set_test_id");
    assertEquals(bindingOp.getBindingOutput().getName(), "_set_test_idResponse");
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType)extElement;
            assertEquals(corbaOpType.getName(), "_set_test_id");
            assertEquals(1, corbaOpType.getParam().size());
            assertEquals(corbaOpType.getParam().get(0).getName(), "_arg");
            assertEquals(corbaOpType.getParam().get(0).getMode().value(), "in");
            assertEquals(corbaOpType.getParam().get(0).getIdltype(), CorbaConstants.NT_CORBA_FLOAT);
        }
    }
}
 
Example 4
Source File: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void testPrimitiveTypeTest(Binding binding, String name, QName corbaType) {
    BindingOperation bindingOp = binding.getBindingOperation(name,
                                            name, name + "Response");
    assertEquals(name, bindingOp.getName());
    assertEquals(1, bindingOp.getExtensibilityElements().size());
    assertEquals(bindingOp.getBindingInput().getName(), name);
    assertEquals(bindingOp.getBindingOutput().getName(), name + "Response");
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType)extElement;
            assertEquals(corbaOpType.getName(), name);
            assertEquals(3, corbaOpType.getParam().size());
            assertEquals(corbaOpType.getParam().get(0).getName(), "x");
            assertEquals(corbaOpType.getParam().get(0).getMode().value(), "in");
            assertEquals(corbaOpType.getParam().get(0).getIdltype(),
                         corbaType);
            assertEquals(corbaOpType.getReturn().getName(), "return");
            assertEquals(corbaOpType.getReturn().getIdltype(), corbaType);

        }
    }
}
 
Example 5
Source File: WsdlUtils.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Build a HashSet of SOAP header names for the specified operation and binding.
 *
 * @param binding       WSDL Binding instance.
 * @param operationName Name of the operation.
 * @return HashSet of soap header names, empty set if no headers present.
 */
protected static HashSet<String> getSOAPHeaders( Binding binding, String operationName ) {

  List<ExtensibilityElement> headers = new ArrayList<ExtensibilityElement>();
  BindingOperation bindingOperation = binding.getBindingOperation( operationName, null, null );
  if ( bindingOperation == null ) {
    throw new IllegalArgumentException( "Can not find operation: " + operationName );
  }

  BindingInput bindingInput = bindingOperation.getBindingInput();
  if ( bindingInput != null ) {
    headers.addAll( WsdlUtils.findExtensibilityElements( (ElementExtensible) bindingInput, SOAP_HEADER_ELEMENT_NAME ) );
  }

  BindingOutput bindingOutput = bindingOperation.getBindingOutput();
  if ( bindingOutput != null ) {
    headers.addAll( WsdlUtils.findExtensibilityElements( (ElementExtensible) bindingOutput, SOAP_HEADER_ELEMENT_NAME ) );
  }

  HashSet<String> headerSet = new HashSet<String>( headers.size() );
  for ( ExtensibilityElement element : headers ) {
    if ( element instanceof SOAP12Header ) {
      headerSet.add( ( (SOAP12Header) element ).getPart() );
    } else {
      headerSet.add( ( (SOAPHeader) element ).getPart() );
    }
  }

  return headerSet;
}
 
Example 6
Source File: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void testVoidTest(Binding binding) {
    BindingOperation bindingOp = binding.getBindingOperation("test_void",
                                            "test_void", "test_voidResponse");
    assertEquals("test_void", bindingOp.getName());
    assertEquals(1, bindingOp.getExtensibilityElements().size());
    assertEquals(bindingOp.getBindingInput().getName(), "test_void");
    assertEquals(bindingOp.getBindingOutput().getName(), "test_voidResponse");
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType)extElement;
            assertEquals(corbaOpType.getName(), "test_void");
            assertEquals(0, corbaOpType.getParam().size());
        }
    }
}
 
Example 7
Source File: WsdlUtils.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Build a HashSet of SOAP header names for the specified operation and binding.
 *
 * @param binding
 *          WSDL Binding instance.
 * @param operationName
 *          Name of the operation.
 * @return HashSet of soap header names, empty set if no headers present.
 */
protected static HashSet<String> getSOAPHeaders( Binding binding, String operationName ) {

  List<ExtensibilityElement> headers = new ArrayList<ExtensibilityElement>();
  BindingOperation bindingOperation = binding.getBindingOperation( operationName, null, null );
  if ( bindingOperation == null ) {
    throw new IllegalArgumentException( "Can not find operation: " + operationName );
  }

  BindingInput bindingInput = bindingOperation.getBindingInput();
  if ( bindingInput != null ) {
    headers.addAll( WsdlUtils.findExtensibilityElements( bindingInput, SOAP_HEADER_ELEMENT_NAME ) );
  }

  BindingOutput bindingOutput = bindingOperation.getBindingOutput();
  if ( bindingOutput != null ) {
    headers.addAll( WsdlUtils.findExtensibilityElements( bindingOutput, SOAP_HEADER_ELEMENT_NAME ) );
  }

  HashSet<String> headerSet = new HashSet<String>( headers.size() );
  for ( ExtensibilityElement element : headers ) {
    if ( element instanceof SOAP12Header ) {
      headerSet.add( ( (SOAP12Header) element ).getPart() );
    } else {
      headerSet.add( ( (SOAPHeader) element ).getPart() );
    }
  }

  return headerSet;
}
 
Example 8
Source File: JAXWSDefinitionBuilderTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testBuildDefinitionWithXMLBinding() {
    String qname = "http://apache.org/hello_world_xml_http/bare";
    String wsdlUrl = getClass().getResource("resources/hello_world_xml_bare.wsdl").toString();

    JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
    builder.setBus(BusFactory.getDefaultBus());
    builder.setContext(env);
    Definition def = builder.build(wsdlUrl);
    assertNotNull(def);

    Map<?, ?> services = def.getServices();
    assertNotNull(services);
    assertEquals(1, services.size());
    Service service = (Service)services.get(new QName(qname, "XMLService"));
    assertNotNull(service);

    Map<?, ?> ports = service.getPorts();
    assertNotNull(ports);
    assertEquals(1, ports.size());
    Port port = service.getPort("XMLPort");
    assertNotNull(port);

    assertEquals(1, port.getExtensibilityElements().size());
    Object obj = port.getExtensibilityElements().get(0);
    if (obj instanceof JAXBExtensibilityElement) {
        obj = ((JAXBExtensibilityElement)obj).getValue();
    }
    assertTrue(obj.getClass().getName() + " is not an AddressType",
               obj instanceof AddressType);

    Binding binding = port.getBinding();
    assertNotNull(binding);
    assertEquals(new QName(qname, "Greeter_XMLBinding"), binding.getQName());

    BindingOperation operation = binding.getBindingOperation("sayHi", null, null);
    assertNotNull(operation);

    BindingInput input = operation.getBindingInput();
    assertNotNull(input);
    assertEquals(1, input.getExtensibilityElements().size());
    obj = input.getExtensibilityElements().get(0);
    if (obj instanceof JAXBExtensibilityElement) {
        obj = ((JAXBExtensibilityElement)obj).getValue();
    }
    assertTrue(obj.getClass().getName() + " is not an XMLBindingMessageFormat",
               obj instanceof XMLBindingMessageFormat);
}