javax.wsdl.extensions.soap.SOAPBody Java Examples

The following examples show how to use javax.wsdl.extensions.soap.SOAPBody. 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 5 votes vote down vote up
@Override
protected void populateSoapBody(SOAPBody soapBody) throws WSDLException {
  if (use.equalsIgnoreCase(LITERAL)) {
    soapBody.setUse(LITERAL);
  } else {
    soapBody.setUse(ENCODED);
    List<String> encStyles = new ArrayList<String>(1);
    encStyles.add(ENCODING);
    soapBody.setEncodingStyles(encStyles);
  }
}
 
Example #2
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPBody getBindingInputSOAPBody(BindingOperation bop) {
    BindingInput bindingInput = bop.getBindingInput();
    if (bindingInput != null) {
        for (Object obj : bindingInput.getExtensibilityElements()) {
            if (isSOAPBody(obj)) {
                return getSoapBody(obj);
            }
        }
    }

    return null;
}
 
Example #3
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPBody getBindingOutputSOAPBody(BindingOperation bop) {
    BindingOutput bindingOutput = bop.getBindingOutput();
    if (bindingOutput != null) {
        for (Object obj : bindingOutput.getExtensibilityElements()) {
            if (isSOAPBody(obj)) {
                return getSoapBody(obj);
            }
        }
    }

    return null;
}
 
Example #4
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPBody getSoapBody(List<ExtensibilityElement> exts) {
    if (exts != null) {
        for (ExtensibilityElement ext : exts) {
            if (isSOAPBody(ext)) {
                return getSoapBody(ext);
            }
        }
    }
    return null;
}
 
Example #5
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPBody createSoapBody(ExtensionRegistry extReg, Class<?> clz, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(clz, new QName(WSDLConstants.NS_SOAP12,
                                                                       "body"));
    } else {
        extElement = extReg.createExtension(clz, new QName(WSDLConstants.NS_SOAP11,
                                                                     "body"));
    }
    return getSoapBody(extElement);
}
 
Example #6
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 #7
Source File: LightWeightMappingValidator.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
protected void visit(BindingInput bindingInput) {
    SOAPBody body = getSOAPBody(bindingInput.getExtensibilityElements());
    String encoding = body.getUse();
    if (encoding == null || !encoding.equals("encoded")) {
        context.addFailure(new ValidationFailure("The use attribute of the binding input operation must be 'encoded': " + bindingInput.getName()));
    }
}
 
Example #8
Source File: LightWeightMappingValidator.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
protected void visit(BindingOutput bindingOutput) {
    SOAPBody body = getSOAPBody(bindingOutput.getExtensibilityElements());
    String encoding = body.getUse();
    if (encoding == null || !encoding.equals("encoded")) {
        context.addFailure(new ValidationFailure("The use attribute of the binding output operation must be 'encoded': " + bindingOutput.getName()));
    }
}
 
Example #9
Source File: LightWeightMappingValidator.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
protected void visit(BindingFault bindingFault) {
    SOAPBody body = getSOAPBody(bindingFault.getExtensibilityElements());
    String encoding = body.getUse();
    if (encoding == null || !encoding.equals("encoded")) {
        context.addFailure(new ValidationFailure("The use attribute of the binding fault operation must be 'encoded': " + bindingFault.getName()));
    }
}
 
Example #10
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 #11
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isSOAPBody(Object obj) {
    return obj instanceof SOAPBody || obj instanceof SOAP12Body;
}
 
Example #12
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static SOAPBody getSoapBody(Object obj) {
    if (isSOAPBody(obj)) {
        return getProxy(SOAPBody.class, obj);
    }
    return null;
}
 
Example #13
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isSOAPBody(Object obj) {
    return obj instanceof SOAPBody || obj instanceof SOAP12Body;
}
 
Example #14
Source File: PartialWSDLProcessor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private static SOAPBody getSoapBody(Class<?> parent, ExtensionRegistry extReg) throws Exception {
    SOAPBody soapBody = SOAPBindingUtil.createSoapBody(extReg, parent, false);
    soapBody.setUse(useLiteral);
    return soapBody;
}
 
Example #15
Source File: HeavyweightOperationInfoBuilder.java    From tomee with Apache License 2.0 4 votes vote down vote up
public HeavyweightOperationInfoBuilder(BindingOperation bindingOperation, ServiceEndpointMethodMapping methodMapping, JavaWsdlMapping mapping, XmlSchemaInfo schemaInfo) throws OpenEJBException {
    Operation operation = bindingOperation.getOperation();
    this.operationName = operation.getName();
    this.operationStyle = JaxRpcOperationInfo.OperationStyle.valueOf(operation.getStyle().toString());
    this.outputMessage = operation.getOutput() == null ? null : operation.getOutput().getMessage();
    this.inputMessage = operation.getInput().getMessage();

    // faults
    for (Object o : operation.getFaults().values()) {
        faults.add((Fault) o);
    }

    this.mapping = mapping;
    this.methodMapping = methodMapping;
    this.schemaInfo = schemaInfo;

    // index types - used to process build exception class constructor args
    for (JavaXmlTypeMapping javaXmlTypeMapping : mapping.getJavaXmlTypeMapping()) {
        String javaClassName = javaXmlTypeMapping.getJavaType();
        if (javaXmlTypeMapping.getAnonymousTypeQname() != null) {
            String anonymousTypeQName = javaXmlTypeMapping.getAnonymousTypeQname();
            anonymousTypes.put(anonymousTypeQName, javaClassName);
        } else if (javaXmlTypeMapping.getRootTypeQname() != null) {
            QName qname = javaXmlTypeMapping.getRootTypeQname();
            publicTypes.put(qname, javaClassName);
        }
    }

    // BindingStyle
    if (methodMapping.getWrappedElement() != null) {
        bindingStyle = BindingStyle.DOCUMENT_LITERAL_WRAPPED;
    } else {
        BindingInput bindingInput = bindingOperation.getBindingInput();

        SOAPOperation soapOperation = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPOperation.class, bindingOperation.getExtensibilityElements());
        String styleString = soapOperation.getStyle();
        if (styleString == null) {
            SOAPBinding soapBinding = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPBinding.class, bindingInput.getExtensibilityElements());
            styleString = soapBinding.getStyle();
        }

        SOAPBody soapBody = JaxRpcServiceInfoBuilder.getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements());
        String useString = soapBody.getUse();

        bindingStyle = BindingStyle.getBindingStyle(styleString, useString);
    }
}