javax.wsdl.extensions.soap.SOAPBinding Java Examples

The following examples show how to use javax.wsdl.extensions.soap.SOAPBinding. 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: WsdlUtils.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Get the SOAPBinding style for the specified WSDL Port.
 *
 * @param binding
 *          A WSDL Binding instance.
 * @return String either 'document' or 'rpc', if not found in WSDL defaults to 'document'.
 */
protected static String getSOAPBindingStyle( Binding binding ) throws KettleException {
  String style = SOAP_BINDING_DEFAULT;
  ExtensibilityElement soapBindingElem = findExtensibilityElement( binding, SOAP_BINDING_ELEMENT_NAME );

  if ( soapBindingElem != null ) {
    if ( soapBindingElem instanceof SOAP12Binding ) {
      style = ( (SOAP12Binding) soapBindingElem ).getStyle();
    } else if ( soapBindingElem instanceof SOAPBinding ) {
      style = ( (SOAPBinding) soapBindingElem ).getStyle();
    } else {
      throw new KettleException( "Binding type "
        + soapBindingElem + " encountered. The Web Service Lookup step only supports SOAP Bindings!" );
    }
  }
  return style;
}
 
Example #2
Source File: WSDLDocCreator.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
private Binding createBindingSOAP( Definition def, PortType pt, String bindingName ) {
	Binding bind = def.getBinding( new QName( bindingName ) );
	if( bind == null ) {
		bind = def.createBinding();
		bind.setQName( new QName( tns, bindingName ) );
	}
	bind.setPortType( pt );
	bind.setUndefined( false );
	try {
		SOAPBinding soapBinding = (SOAPBinding) extensionRegistry.createExtension( Binding.class,
			new QName( NameSpacesEnum.SOAP.getNameSpaceURI(), "binding" ) );
		soapBinding.setTransportURI( NameSpacesEnum.SOAP_OVER_HTTP.getNameSpaceURI() );
		soapBinding.setStyle( "document" );
		bind.addExtensibilityElement( soapBinding );
	} catch( WSDLException ex ) {
		System.err.println( ex.getMessage() );
	}
	def.addBinding( bind );

	return bind;

}
 
Example #3
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 #4
Source File: WSDL11SOAPOperationExtractor.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * Returns if the provided WSDL definition contains SOAP binding operations
 *
 * @return whether the provided WSDL definition contains SOAP binding operations
 */
private boolean hasSoapBindingOperations() {
    if (wsdlDefinition == null) {
        return false;
    }
    for (Object bindingObj : wsdlDefinition.getAllBindings().values()) {
        if (bindingObj instanceof Binding) {
            Binding binding = (Binding) bindingObj;
            for (Object ex : binding.getExtensibilityElements()) {
                if (ex instanceof SOAPBinding) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #5
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static SoapBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(Binding.class,
                                                           new QName(WSDLConstants.NS_SOAP12,
                                                                     "binding"));
        ((SOAP12Binding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    } else {
        extElement = extReg.createExtension(Binding.class,
                                                         new QName(WSDLConstants.NS_SOAP11,
                                                                   "binding"));
        ((SOAPBinding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    return getSoapBinding(extElement);
}
 
Example #6
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static SOAPBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(Binding.class,
                                                           new QName(WSDLConstants.NS_SOAP12,
                                                                     "binding"));
        ((SOAP12Binding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    } else {
        extElement = extReg.createExtension(Binding.class,
                                                         new QName(WSDLConstants.NS_SOAP11,
                                                                   "binding"));
        ((SOAPBinding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    return getSoapBinding(extElement);
}
 
Example #7
Source File: WsdlUtils.java    From hop with Apache License 2.0 6 votes vote down vote up
/**
 * Get the SOAPBinding style for the specified WSDL Port.
 *
 * @param binding A WSDL Binding instance.
 * @return String either 'document' or 'rpc', if not found in WSDL defaults to 'document'.
 */
protected static String getSOAPBindingStyle( Binding binding ) throws HopException {
  String style = SOAP_BINDING_DEFAULT;
  ExtensibilityElement soapBindingElem = findExtensibilityElement( (ElementExtensible) binding, SOAP_BINDING_ELEMENT_NAME );

  if ( soapBindingElem != null ) {
    if ( soapBindingElem instanceof SOAP12Binding ) {
      style = ( (SOAP12Binding) soapBindingElem ).getStyle();
    } else if ( soapBindingElem instanceof SOAPBinding ) {
      style = ( (SOAPBinding) soapBindingElem ).getStyle();
    } else {
      throw new HopException( "Binding type "
        + soapBindingElem + " encountered. The Web Service Lookup transform only supports SOAP Bindings!" );
    }
  }
  return style;
}
 
Example #8
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static SOAPBinding getSoapBinding(List<ExtensibilityElement> exts) {
    for (ExtensibilityElement ext : exts) {
        if (isSOAPBinding(ext)) {
            return getSoapBinding(ext);
        }
    }
    return null;
}
 
Example #9
Source File: LightWeightMappingValidator.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
protected void visit(Binding binding) {
    SOAPBinding soapBinding = getSOAPBinding(binding);
    if (soapBinding == null || soapBinding.getStyle() == null || !soapBinding.getStyle().equals("rpc")) {
        context.addFailure(new ValidationFailure("The messaging style of the binding must be rpc: " + binding.getQName()));
    }
}
 
Example #10
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 #11
Source File: PartialWSDLProcessor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static void setSoapBindingExtElement(Definition wsdlDefinition, Binding binding,
                                             ExtensionRegistry extReg) throws Exception {
    SOAPBindingUtil.addSOAPNamespace(wsdlDefinition, false);
    SOAPBinding
        soapBinding = SOAPBindingUtil.createSoapBinding(extReg, false);
    soapBinding.setStyle(style);
    binding.addExtensibilityElement(soapBinding);
}
 
Example #12
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static javax.jws.soap.SOAPBinding.Use getSoapUse(String soapUse) {
    if ("".equals(soapUse)) {
        return null;
    } else if ("ENCODED".equalsIgnoreCase(soapUse)) {
        return javax.jws.soap.SOAPBinding.Use.ENCODED;
    } else {
        return javax.jws.soap.SOAPBinding.Use.LITERAL;
    }
}
 
Example #13
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static javax.jws.soap.SOAPBinding.Style getSoapStyle(String soapStyle) {
    if ("".equals(soapStyle)) {
        return null;
    } else if ("RPC".equalsIgnoreCase(soapStyle)) {
        return javax.jws.soap.SOAPBinding.Style.RPC;
    } else {
        return javax.jws.soap.SOAPBinding.Style.DOCUMENT;
    }
}
 
Example #14
Source File: WSDLConverter.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void convertPortType( PortType portType, Binding binding )
	throws IOException {
	String comment = "";
	if( portType.getDocumentationElement() != null ) {
		comment = portType.getDocumentationElement().getNodeValue();
	}

	Style style = Style.DOCUMENT;
	for( ExtensibilityElement element : (List< ExtensibilityElement >) binding.getExtensibilityElements() ) {
		if( element instanceof SOAPBinding ) {
			if( "rpc".equals( ((SOAPBinding) element).getStyle() ) ) {
				style = Style.RPC;
			}
		} else if( element instanceof HTTPBinding ) {
			style = Style.HTTP;
		}
	}
	Interface iface = new Interface( portType.getQName().getLocalPart(), comment );
	List< Operation > operations = portType.getOperations();
	for( Operation operation : operations ) {
		if( operation.getOutput() == null ) {
			iface.addOneWayOperation( convertOperation( operation, style ) );
		} else {
			iface.addRequestResponseOperation( convertOperation( operation, style ) );
		}
	}
	interfaces.put( iface.name(), iface );
}
 
Example #15
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static SOAPBinding getSoapBinding(Object obj) {
    if (isSOAPBinding(obj)) {
        return getProxy(SOAPBinding.class, obj);
    }
    return null;
}
 
Example #16
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isSOAPBinding(Object obj) {
    return obj instanceof SOAPBinding || obj instanceof SOAP12Binding;
}
 
Example #17
Source File: WSDLBasedServiceConfiguration.java    From cxf with Apache License 2.0 4 votes vote down vote up
public String getStyle() {
    SOAPBinding sb = bi.getExtensor(SOAPBinding.class);
    return (sb == null) ? null : sb.getStyle();
}
 
Example #18
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);
    }
}
 
Example #19
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isSOAPBinding(Object obj) {
    return obj instanceof SOAPBinding || obj instanceof SOAP12Binding;
}
 
Example #20
Source File: XTeeSoapProvider.java    From j-road with Apache License 2.0 4 votes vote down vote up
@Override
protected void populateSoapBinding(SOAPBinding soapBinding, Binding binding) throws WSDLException {
  soapBinding.setStyle("document");
  soapBinding.setTransportURI(getTransportUri());
}