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

The following examples show how to use javax.wsdl.Definition#createBindingOutput() . 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: WSDLToCorbaBinding.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addBindingOperations(Definition definition, PortType portType, Binding binding)
    throws Exception {

    List<Operation> ops = CastUtils.cast(portType.getOperations());
    for (Operation op : ops) {
        try {
            BindingOperation bindingOperation = definition.createBindingOperation();
            addCorbaOperationExtElement(bindingOperation, op);
            bindingOperation.setName(op.getName());
            if (op.getInput() != null) {
                BindingInput bindingInput = definition.createBindingInput();
                bindingInput.setName(op.getInput().getName());
                bindingOperation.setBindingInput(bindingInput);
            }
            if (op.getOutput() != null) {
                BindingOutput bindingOutput = definition.createBindingOutput();
                bindingOutput.setName(op.getOutput().getName());
                bindingOperation.setBindingOutput(bindingOutput);
            }
            // add Faults
            if (op.getFaults() != null && op.getFaults().size() > 0) {
                Collection<Fault> faults = CastUtils.cast(op.getFaults().values());
                for (Fault fault : faults) {
                    BindingFault bindingFault = definition.createBindingFault();
                    bindingFault.setName(fault.getName());
                    bindingOperation.addBindingFault(bindingFault);
                }
            }
            bindingOperation.setOperation(op);
            binding.addBindingOperation(bindingOperation);
        } catch (Exception ex) {
            LOG.warning("Operation " + op.getName() + " not mapped to CORBA binding.");
        }
    }
}
 
Example 2
Source File: ServiceWSDLBuilder.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void buildBindingOutput(Definition def, BindingOperation bindingOperation,
                               BindingMessageInfo bindingMessageInfo) {
    BindingOutput bindingOutput = null;
    if (bindingMessageInfo != null) {
        bindingOutput = def.createBindingOutput();
        addDocumentation(bindingOutput, bindingMessageInfo.getDocumentation());
        bindingOutput.setName(bindingMessageInfo.getMessageInfo().getName().getLocalPart());
        bindingOperation.setBindingOutput(bindingOutput);
        addExtensibilityAttributes(def, bindingOutput, bindingMessageInfo.getExtensionAttributes());
        addExtensibilityElements(def, bindingOutput, getWSDL11Extensors(bindingMessageInfo));
    }
}
 
Example 3
Source File: PartialWSDLProcessor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static BindingOutput getBindingOutput(Output output, Definition wsdlDefinition,
                                              ExtensionRegistry extReg) throws Exception {
    BindingOutput bo = wsdlDefinition.createBindingOutput();
    bo.setName(output.getName());
    bo.addExtensibilityElement(getSoapBody(BindingOutput.class, extReg));
    return bo;
}
 
Example 4
Source File: WSDLDocCreator.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void addOperationSOAPBinding( Definition localDef, Operation wsdlOp, Binding bind ) {
	try {
		// creating operation binding
		BindingOperation bindOp = localDef.createBindingOperation();
		bindOp.setName( wsdlOp.getName() );

		// adding soap extensibility elements
		SOAPOperation soapOperation = (SOAPOperation) extensionRegistry.createExtension( BindingOperation.class,
			new QName( NameSpacesEnum.SOAP.getNameSpaceURI(), "operation" ) );
		soapOperation.setStyle( "document" );
		// NOTA-BENE: Come settare SOAPACTION? jolie usa SOAP1.1 o 1.2? COme usa la SoapAction?
		soapOperation.setSoapActionURI( wsdlOp.getName() );
		bindOp.addExtensibilityElement( soapOperation );
		bindOp.setOperation( wsdlOp );

		// adding input
		BindingInput bindingInput = localDef.createBindingInput();
		SOAPBody body = (SOAPBody) extensionRegistry.createExtension( BindingInput.class,
			new QName( NameSpacesEnum.SOAP.getNameSpaceURI(), "body" ) );
		body.setUse( "literal" );
		bindingInput.addExtensibilityElement( body );
		bindOp.setBindingInput( bindingInput );

		// adding output
		BindingOutput bindingOutput = localDef.createBindingOutput();
		bindingOutput.addExtensibilityElement( body );
		bindOp.setBindingOutput( bindingOutput );

		// adding fault
		if( !wsdlOp.getFaults().isEmpty() ) {
			for( Object o : wsdlOp.getFaults().entrySet() ) {
				BindingFault bindingFault = localDef.createBindingFault();
				SOAPFault soapFault = (SOAPFault) extensionRegistry.createExtension( BindingFault.class,
					new QName( NameSpacesEnum.SOAP.getNameSpaceURI(), "fault" ) );
				soapFault.setUse( "literal" );
				String faultName = ((Entry) o).getKey().toString();
				bindingFault.setName( faultName );
				soapFault.setName( faultName );
				bindingFault.addExtensibilityElement( soapFault );
				bindOp.addBindingFault( bindingFault );
			}
		}

		bind.addBindingOperation( bindOp );

	} catch( WSDLException ex ) {
		ex.printStackTrace();
	}

}