javax.wsdl.BindingOperation Java Examples

The following examples show how to use javax.wsdl.BindingOperation. 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: MIMEBindingValidator.java    From cxf with Apache License 2.0 6 votes vote down vote up
public boolean isValid() {
    Collection<Binding> bindings = CastUtils.cast(def.getBindings().values());
    for (Binding binding : bindings) {
        Collection<BindingOperation> bindingOps = CastUtils.cast(binding.getBindingOperations());
        for (BindingOperation bindingOperation : bindingOps) {
            if (bindingOperation.getBindingInput() == null) {
                continue;
            }
            Collection<ExtensibilityElement> exts = CastUtils.cast(bindingOperation
                                                                       .getBindingInput()
                                                                       .getExtensibilityElements());
            for (ExtensibilityElement extElement : exts) {
                if (extElement instanceof MIMEMultipartRelated
                    && !doValidate((MIMEMultipartRelated)extElement,
                                   bindingOperation.getName())) {
                    return false;
                }
            }
        }
    }
    return true;
}
 
Example #2
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 #3
Source File: XTeeSoapProvider.java    From j-road with Apache License 2.0 6 votes vote down vote up
@Override
protected void populateBindingOperation(Definition definition, BindingOperation bindingOperation)
    throws WSDLException {
  super.populateBindingOperation(definition, bindingOperation);
  XTeeElement element = (XTeeElement) definition.getExtensionRegistry().createExtension(BindingOperation.class,
                                                                                        XTeeElement.VERSION_TYPE);
  String version = "v1";
  String name = bindingOperation.getName().toLowerCase();
  for (String method : xRoadEndpointMapping.getMethods()) {
    method = method.substring(method.indexOf('.') + 1).toLowerCase();
    if (method.startsWith(name + ".")) {
      version = method.substring(method.indexOf('.') + 1);
      break;
    }
  }
  element.setValue(version);
  bindingOperation.addExtensibilityElement(element);
}
 
Example #4
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 #5
Source File: WSDL11SOAPOperationExtractor.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the target namespace given the soap binding operation
 *
 * @param bindingOperation soap operation
 * @return target name space
 */
private String getTargetNamespace(BindingOperation bindingOperation) {

    Operation operation = bindingOperation.getOperation();
    if (operation != null) {
        Input input = operation.getInput();

        if (input != null) {
            Message message = input.getMessage();
            if (message != null) {
                Map partMap = message.getParts();

                for (Object obj : partMap.entrySet()) {
                    Map.Entry entry = (Map.Entry) obj;
                    Part part = (Part) entry.getValue();
                    if (part != null) {
                        if (part.getElementName() != null) {
                            return part.getElementName().getNamespaceURI();
                        }
                    }
                }
            }
        }
    }
    return targetNamespace;
}
 
Example #6
Source File: WSDL11SOAPOperationExtractor.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * Retrieves all the operations defined in the provided Binding.
 *
 * @param binding WSDL binding
 * @return a set of {@link WSDLOperation} defined in the provided Binding
 */
private Set<WSDLSOAPOperation> getSOAPBindingOperations(Binding binding) throws APIMgtWSDLException {
    Set<WSDLSOAPOperation> allBindingOperations = new HashSet<>();
    if (binding.getExtensibilityElements() != null && binding.getExtensibilityElements().size() > 0) {
        List extensibilityElements = binding.getExtensibilityElements();
        for (Object extensibilityElement : extensibilityElements) {
            if (extensibilityElement instanceof SOAPBinding || extensibilityElement instanceof SOAP12Binding) {
                for (Object opObj : binding.getBindingOperations()) {
                    BindingOperation bindingOperation = (BindingOperation) opObj;
                    WSDLSOAPOperation wsdlSoapOperation = getSOAPOperation(bindingOperation);
                    if (wsdlSoapOperation != null) {
                        allBindingOperations.add(wsdlSoapOperation);
                    } else {
                        log.warn("Unable to get soap operation details from binding operation: " + bindingOperation
                                .getName());
                    }
                }
            }
        }
    } else {
        throw new APIMgtWSDLException("Cannot further process to get soap binding operations");
    }
    return allBindingOperations;
}
 
Example #7
Source File: WSDLToSoapProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void setSoapOperationExtElement(BindingOperation bo) throws ToolException {
    if (extReg == null) {
        extReg = wsdlFactory.newPopulatedExtensionRegistry();
    }
    SoapOperation soapOperation = null;

    try {
        soapOperation = SOAPBindingUtil.createSoapOperation(extReg, isSOAP12());
    } catch (WSDLException wse) {
        Message msg = new Message("FAIL_TO_CREATE_SOAPBINDING", LOG);
        throw new ToolException(msg, wse);
    }
    soapOperation.setStyle((String)env.get(ToolConstants.CFG_STYLE));
    soapOperation.setSoapActionURI("");
    bo.addExtensibilityElement(soapOperation);
}
 
Example #8
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 #9
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 #10
Source File: WSDLToXMLProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private void addBindingOperation() throws ToolException {
    List<Operation> ops = portType.getOperations();
    for (Operation op : ops) {
        BindingOperation bindingOperation = wsdlDefinition.createBindingOperation();
        bindingOperation.setName(op.getName());
        if (op.getInput() != null) {
            bindingOperation.setBindingInput(getBindingInput(op.getInput(), op.getName()));
        }
        if (op.getOutput() != null) {
            bindingOperation.setBindingOutput(getBindingOutput(op.getOutput(), op.getName()));
        }
        if (op.getFaults() != null && op.getFaults().size() > 0) {
            addXMLFaults(op, bindingOperation);
        }
        bindingOperation.setOperation(op);
        binding.addBindingOperation(bindingOperation);
    }
}
 
Example #11
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 #12
Source File: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void checkFixedTypeFour(BindingOperation bindingOperation,
                                Map<String, CorbaType>  mapType) {
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOperation)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType)extElement;
            assertEquals(corbaOpType.getName(), "extended_op_m");
            assertEquals(3, corbaOpType.getParam().size());
            assertEquals("EXTENDED.X.PARAM.H", corbaOpType.getParam().get(0).getIdltype().getLocalPart());
            assertEquals("EXTENDED.X.PARAM.H", corbaOpType.getReturn().getIdltype().getLocalPart());
            Fixed fixed = (Fixed)mapType.get(corbaOpType.getReturn().getIdltype().getLocalPart());
            assertNotNull("Could not find the decimal type", fixed.getType());
            assertEquals("Fixed digits is incorrect for the return corba parameter", 8, fixed
                .getDigits());
            assertEquals("Fixed scale is incorrect for the return corba parameter", 2, fixed.getScale());

        }
    }
}
 
Example #13
Source File: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void checkFixedTypeThree(BindingOperation bindingOperation,
                                 Map<String, CorbaType>  mapType) {
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOperation)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType)extElement;
            assertEquals(corbaOpType.getName(), "op_n");
            assertEquals(3, corbaOpType.getParam().size());
            assertEquals("fixed_1", corbaOpType.getParam().get(0).getIdltype().getLocalPart());
            assertEquals("Z.H", corbaOpType.getReturn().getIdltype().getLocalPart());
            Fixed fixed = (Fixed)mapType.get(corbaOpType.getReturn().getIdltype().getLocalPart());
            assertNotNull("Could not find the decimal type", fixed.getType());
            assertEquals("Fixed digits is incorrect for the return corba parameter", 8, fixed
                .getDigits());
            assertEquals("Fixed scale is incorrect for the return corba parameter", 6, fixed.getScale());

        }
    }
}
 
Example #14
Source File: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void checkFixedTypeTwo(BindingOperation bindingOperation,
                               Map<String, CorbaType>  mapType) {
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOperation)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType)extElement;
            assertEquals(corbaOpType.getName(), "op_m");
            assertEquals(3, corbaOpType.getParam().size());
            assertEquals("X.PARAM.H", corbaOpType.getParam().get(0).getIdltype().getLocalPart());
            assertEquals("X.H", corbaOpType.getReturn().getIdltype().getLocalPart());
            Fixed fixed = (Fixed)mapType.get(corbaOpType.getReturn().getIdltype().getLocalPart());
            assertNotNull("Could not find the decimal type", fixed.getType());
            assertEquals("Fixed digits is incorrect for the return corba parameter", 10, fixed
                .getDigits());
            assertEquals("Fixed scale is incorrect for the return corba parameter", 2, fixed.getScale());

        }
    }
}
 
Example #15
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static List<SOAPFault> getBindingOperationSoapFaults(BindingOperation bop) {
    List<SOAPFault> faults = new ArrayList<>();
    for (Object obj : bop.getBindingFaults().values()) {
        if (!(obj instanceof BindingFault)) {
            continue;
        }
        BindingFault faultElement = (BindingFault) obj;
        for (Object flt : faultElement.getExtensibilityElements()) {
            SOAPFault fault = getSoapFault(flt);
            if (fault != null) {
                faults.add(fault);
            }
        }
    }
    return faults;
}
 
Example #16
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static List<SoapFault> getBindingOperationSoapFaults(BindingOperation bop) {
    List<SoapFault> faults = new ArrayList<>();
    for (Object obj : bop.getBindingFaults().values()) {
        if (!(obj instanceof BindingFault)) {
            continue;
        }
        BindingFault faultElement = (BindingFault) obj;
        for (Object flt : faultElement.getExtensibilityElements()) {
            SoapFault fault = getSoapFault(flt);
            if (fault != null) {
                faults.add(fault);
            }
        }
    }
    return faults;
}
 
Example #17
Source File: AttributeVisitor.java    From cxf with Apache License 2.0 6 votes vote down vote up
/** Generates a corba:operation in the corba:binding container within a wsdl:binding.
 *
 * Only one (or none) corba parameter and only one (or none) corba return parameter are supported.
 *
 * @param op is the wsdl operation to bind.
 * @param param is the corba parameter, none if null.
 * @param arg is the corba return parameter, none if null.
 * @return the generated corba:operation.
 */
private OperationType generateCorbaOperation(Operation op, ParamType param, ArgType arg) {
    OperationType operation = null;
    try {
        operation = (OperationType)extReg.createExtension(BindingOperation.class,
                                                          CorbaConstants.NE_CORBA_OPERATION);
    } catch (WSDLException ex) {
        throw new RuntimeException(ex);
    }
    operation.setName(op.getName());

    if (param != null) {
        operation.getParam().add(param);
    }

    if (arg != null) {
        operation.setReturn(arg);
    }

    return operation;
}
 
Example #18
Source File: AttributeVisitor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private BindingOperation generateCorbaBindingOperation(Binding wsdlBinding,
                                                       Operation op,
                                                       OperationType corbaOp) {
    BindingInput bindingInput = definition.createBindingInput();
    bindingInput.setName(op.getInput().getName());

    BindingOutput bindingOutput = definition.createBindingOutput();
    bindingOutput.setName(op.getOutput().getName());

    BindingOperation bindingOperation = definition.createBindingOperation();
    bindingOperation.addExtensibilityElement((ExtensibilityElement)corbaOp);
    bindingOperation.setOperation(op);
    bindingOperation.setName(op.getName());

    bindingOperation.setBindingInput(bindingInput);
    bindingOperation.setBindingOutput(bindingOutput);

    binding.addBindingOperation(bindingOperation);

    return bindingOperation;
}
 
Example #19
Source File: OperationVisitor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private BindingOperation generateBindingOperation(Binding wsdlBinding, Operation op,
                                                  String corbaOpName) {
    BindingOperation bindingOperation = definition.createBindingOperation();
    //OperationType operationType = null;
    try {
        corbaOperation = (OperationType)extReg.createExtension(BindingOperation.class,
                                                               CorbaConstants.NE_CORBA_OPERATION);
    } catch (WSDLException ex) {
        throw new RuntimeException(ex);
    }
    corbaOperation.setName(corbaOpName);
    bindingOperation.addExtensibilityElement((ExtensibilityElement)corbaOperation);
    bindingOperation.setOperation(op);
    bindingOperation.setName(op.getName());
    binding.addBindingOperation(bindingOperation);
    return bindingOperation;
}
 
Example #20
Source File: SoapProtocol.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void setOutputEncodingStyle( SOAPEnvelope soapEnvelope, String operationName )
	throws IOException, SOAPException {
	Port port = getWSDLPort();
	if( port != null ) {
		BindingOperation bindingOperation = port.getBinding().getBindingOperation( operationName, null, null );
		if( bindingOperation == null ) {
			return;
		}
		BindingOutput output = bindingOperation.getBindingOutput();
		if( output == null ) {
			return;
		}
		for( ExtensibilityElement element : (List< ExtensibilityElement >) output.getExtensibilityElements() ) {
			if( element instanceof javax.wsdl.extensions.soap.SOAPBody ) {
				List< String > list = ((javax.wsdl.extensions.soap.SOAPBody) element).getEncodingStyles();
				if( list != null && list.isEmpty() == false ) {
					soapEnvelope.setEncodingStyle( list.get( 0 ) );
					soapEnvelope.addNamespaceDeclaration( "enc", list.get( 0 ) );
				}
			}
		}
	}
}
 
Example #21
Source File: WSDLToCorbaBindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void checkSequenceType(BindingOperation bindingOperation,
                               Map<String, CorbaType> mapType) {
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOperation)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType)extElement;
            assertEquals(corbaOpType.getName(), "op_h");
            assertEquals(3, corbaOpType.getParam().size());
            assertEquals("Y.H", corbaOpType.getParam().get(0).getIdltype().getLocalPart());
            assertEquals("Y.H", corbaOpType.getReturn().getIdltype().getLocalPart());
            Sequence seq = (Sequence)mapType.get(corbaOpType.getReturn().getIdltype().getLocalPart());
            assertEquals("ElementType is incorrect for Sequence Type", "fixed_1", seq.getElemtype()
                .getLocalPart());
        }

    }
}
 
Example #22
Source File: WSDLToIDLAction.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void addOperation(BindingOperation bindingOperation,
                          boolean isOneway) throws Exception {

    String name = null;
    Iterator<?> i = bindingOperation.getExtensibilityElements().iterator();
    while (i.hasNext()) {
        org.apache.cxf.binding.corba.wsdl.OperationType opType =
            (org.apache.cxf.binding.corba.wsdl.OperationType)i
            .next();
        name = opType.getName();

        if (name.startsWith("_get_") || name.startsWith("_set_")) {
            createIdlAttribute(opType, name);
        } else {
            createIdlOperation(opType, name, isOneway);
        }
        root.flush();
    }
}
 
Example #23
Source File: PartialWSDLProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
private static void addBindingOperation(Definition wsdlDefinition, PortType portType, Binding binding,
                                        ExtensionRegistry extReg) throws Exception {
    List<Operation> ops = portType.getOperations();
    for (Operation op : ops) {
        BindingOperation bindingOperation = wsdlDefinition.createBindingOperation();
        setSoapOperationExtElement(bindingOperation, extReg);
        bindingOperation.setName(op.getName());
        if (op.getInput() != null) {
            bindingOperation.setBindingInput(getBindingInput(op.getInput(), wsdlDefinition, extReg));
        }
        if (op.getOutput() != null) {
            bindingOperation.setBindingOutput(getBindingOutput(op.getOutput(), wsdlDefinition, extReg));
        }
        if (op.getFaults() != null && op.getFaults().size() > 0) {
            addSoapFaults(op, bindingOperation, wsdlDefinition, extReg);
        }
        bindingOperation.setOperation(op);
        binding.addBindingOperation(bindingOperation);
    }
}
 
Example #24
Source File: WSDLImporter.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
/**
 * Imports services and operations from the WSDL definition
 */
protected void importServicesAndOperations(Definition definition) {
  for (Object serviceObject : definition.getServices().values()) {
    Service service = (Service) serviceObject;
    WSService wsService = this.importService(service);
    this.wsServices.put(this.namespace + wsService.getName(), wsService);

    Port port = (Port) service.getPorts().values().iterator().next();
    for (Object bindOperationObject : port.getBinding().getBindingOperations()) {
      BindingOperation bindOperation = (BindingOperation) bindOperationObject;
      WSOperation operation = this.processOperation(bindOperation.getOperation(), wsService);
      wsService.addOperation(operation);

      this.wsOperations.put(this.namespace + operation.getName(), operation);
    }
  }
}
 
Example #25
Source File: JaxRpcServiceInfoBuilder.java    From tomee with Apache License 2.0 5 votes vote down vote up
private BindingStyle getStyle(Binding binding) throws OpenEJBException {
    SOAPBinding soapBinding = getExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements());
    String styleString = soapBinding.getStyle();

    BindingInput bindingInput = ((BindingOperation) binding.getBindingOperations().get(0)).getBindingInput();
    SOAPBody soapBody = getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements());
    String useString = soapBody.getUse();

    BindingStyle bindingStyle = BindingStyle.getBindingStyle(styleString, useString);
    return bindingStyle;
}
 
Example #26
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SoapOperation createSoapOperation(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(BindingOperation.class,
                                                             new QName(WSDLConstants.NS_SOAP12,
                                                                       "operation"));
    } else {
        extElement = extReg.createExtension(BindingOperation.class,
                                                           new QName(WSDLConstants.NS_SOAP11,
                                                                     "operation"));
    }
    return getSoapOperation(extElement);
}
 
Example #27
Source File: WSDLToCorbaBinding.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addCorbaOperationExtElement(BindingOperation bo, Operation op)
    throws Exception {

    OperationType operationType = null;
    try {
        operationType = (OperationType)extReg.createExtension(BindingOperation.class,
                                                              CorbaConstants.NE_CORBA_OPERATION);
    } catch (WSDLException wse) {
        LOG.log(Level.SEVERE, "Failed to create a Binding Operation extension", wse);
        throw new Exception(LOG.toString(), wse);
    }

    operationType.setName(op.getName());
    List<ParamType> params = new ArrayList<>();
    List<ArgType> returns = new ArrayList<>();

    wsdlParameter.processParameters(this, op, def, xmlSchemaList, params, returns, true);

    for (ParamType paramtype : params) {
        operationType.getParam().add(paramtype);
    }
    for (ArgType retType : returns) {
        operationType.setReturn(retType);
    }

    Collection<Fault> faults = CastUtils.cast(op.getFaults().values());
    for (Fault fault : faults) {
        RaisesType raisestype = new RaisesType();
        CorbaType extype = convertFaultToCorbaType(xmlSchemaType, fault);
        if (extype != null) {
            raisestype.setException(helper.createQNameCorbaNamespace(extype.getName()));
            operationType.getRaises().add(raisestype);
        }
    }

    bo.addExtensibilityElement((ExtensibilityElement)operationType);
}
 
Example #28
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 #29
Source File: WSDLToIDLAction.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void collectIdlDefns(Binding binding) throws Exception {
    boolean isOneway = false;
    Iterator<?> iterator = binding.getBindingOperations().iterator();
    while (iterator.hasNext()) {
        BindingOperation bindingOperation = (BindingOperation)iterator.next();
        if (bindingOperation.getBindingOutput() == null) {
            isOneway = true;
        }

        addOperation(bindingOperation, isOneway);
    }
}
 
Example #30
Source File: OperationVisitor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Message generateInputMessage(Operation operation, BindingOperation bindingOperation) {
    Message msg = definition.createMessage();
    QName msgName;
    if (!mapper.isDefaultMapping()) {
        //mangle the message name
        //REVISIT, do we put in the entire scope for mangling
        msgName = new QName(definition.getTargetNamespace(),
                            getScope().tail() + "." + operation.getName());
    } else {
        msgName = new QName(definition.getTargetNamespace(), operation.getName());
    }
    msg.setQName(msgName);
    msg.setUndefined(false);

    String inputName = operation.getName() + REQUEST_SUFFIX;
    Input input = definition.createInput();
    input.setName(inputName);
    input.setMessage(msg);

    BindingInput bindingInput = definition.createBindingInput();
    bindingInput.setName(inputName);

    bindingOperation.setBindingInput(bindingInput);
    operation.setInput(input);

    definition.addMessage(msg);

    return msg;
}