Java Code Examples for javax.wsdl.BindingOperation#addExtensibilityElement()

The following examples show how to use javax.wsdl.BindingOperation#addExtensibilityElement() . 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: 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 2
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 3
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 4
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 5
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 6
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();
	}

}
 
Example 7
Source File: PartialWSDLProcessor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private static void setSoapOperationExtElement(BindingOperation bo, ExtensionRegistry extReg) throws Exception {
    SOAPOperation soapOperation = SOAPBindingUtil.createSoapOperation(extReg, false);
    soapOperation.setStyle(style);
    soapOperation.setSoapActionURI("");
    bo.addExtensibilityElement(soapOperation);
}