javax.wsdl.Binding Java Examples

The following examples show how to use javax.wsdl.Binding. 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: 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 #2
Source File: ServiceWSDLBuilder.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void buildBindingOperation(Definition def, Binding binding,
                                   Collection<BindingOperationInfo> bindingOperationInfos) {
    BindingOperation bindingOperation = null;
    for (BindingOperationInfo bindingOperationInfo : bindingOperationInfos) {
        bindingOperation = def.createBindingOperation();
        addDocumentation(bindingOperation, bindingOperationInfo.getDocumentation());
        bindingOperation.setName(bindingOperationInfo.getName().getLocalPart());
        for (Operation operation
                : CastUtils.cast(binding.getPortType().getOperations(), Operation.class)) {
            if (operation.getName().equals(bindingOperation.getName())) {
                bindingOperation.setOperation(operation);
                break;
            }
        }
        buildBindingInput(def, bindingOperation, bindingOperationInfo.getInput());
        buildBindingOutput(def, bindingOperation, bindingOperationInfo.getOutput());
        buildBindingFault(def, bindingOperation, bindingOperationInfo.getFaults());
        addExtensibilityAttributes(def, bindingOperation, bindingOperationInfo.getExtensionAttributes());
        addExtensibilityElements(def, bindingOperation, getWSDL11Extensors(bindingOperationInfo));
        binding.addBindingOperation(bindingOperation);
    }
}
 
Example #3
Source File: Wsdl.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Find the specified operation in the WSDL definition.
 *
 * @param operationName
 *          Name of operation to find.
 * @return A WsdlOperation instance, null if operation can not be found in WSDL.
 */
public WsdlOperation getOperation( String operationName ) throws KettleStepException {

  // is the operation in the cache?
  if ( _operationCache.containsKey( operationName ) ) {
    return _operationCache.get( operationName );
  }

  Binding b = _port.getBinding();
  PortType pt = b.getPortType();
  Operation op = pt.getOperation( operationName, null, null );
  if ( op != null ) {
    try {
      WsdlOperation wop = new WsdlOperation( b, op, _wsdlTypes );
      // cache the operation
      _operationCache.put( operationName, wop );
      return wop;
    } catch ( KettleException kse ) {
      LogChannel.GENERAL.logError( "Could not retrieve WSDL Operator for operation name: " + operationName );
      throw new KettleStepException(
        "Could not retrieve WSDL Operator for operation name: " + operationName, kse );
    }
  }
  return null;
}
 
Example #4
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 #5
Source File: CorbaObjectReferenceHelper.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static Binding getDefaultBinding(Object obj, Definition wsdlDef) {
    LOG.log(Level.FINEST, "Getting binding for a default object reference");
    Collection<Binding> bindings = CastUtils.cast(wsdlDef.getBindings().values());
    for (Binding b : bindings) {
        List<?> extElements = b.getExtensibilityElements();
        // Get the list of all extensibility elements
        for (Iterator<?> extIter = extElements.iterator(); extIter.hasNext();) {
            java.lang.Object element = extIter.next();

            // Find a binding type so we can check against its repository ID
            if (element instanceof BindingType) {
                BindingType type = (BindingType)element;
                if (obj._is_a(type.getRepositoryID())) {
                    return b;
                }
            }
        }
    }
    return null;
}
 
Example #6
Source File: WSDLDocCreator.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
public Service createService( Definition localdef, String serviceName, Binding bind, String mySOAPAddress ) {
	Port p = localDef.createPort();
	p.setName( serviceName + "Port" );
	try {

		SOAPAddress soapAddress = (SOAPAddress) extensionRegistry.createExtension( Port.class,
			new QName( NameSpacesEnum.SOAP.getNameSpaceURI(), "address" ) );
		soapAddress.setLocationURI( mySOAPAddress );
		p.addExtensibilityElement( soapAddress );
	} catch( WSDLException ex ) {
		ex.printStackTrace();
	}
	p.setBinding( bind );
	Service s = new ServiceImpl();
	QName serviceQName = new QName( serviceName );
	s.setQName( serviceQName );
	s.addPort( p );
	localDef.addService( s );
	return s;
}
 
Example #7
Source File: PartialWSDLProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static boolean isBindingExisted(Definition wsdlDefinition, QName name) {
    Map<QName, Binding> bindings = CastUtils.cast(wsdlDefinition.getAllBindings());
    Binding binding = null;
    if (bindings == null || bindings.isEmpty()) {
        return false;
    }
    try {
        for (Entry<QName, Binding> entry : bindings.entrySet()) {
            if (entry.getKey().getLocalPart().contains(name.getLocalPart())) {
                binding = entry.getValue();
                break;
            }
        }
    } catch (Exception e) {
        binding = null;
    }
    return binding != null;
}
 
Example #8
Source File: BPEL2UDDITest.java    From juddi with Apache License 2.0 6 votes vote down vote up
@Test
public void testHelloWorld_UDDIBindingModel() throws WSDLException, JAXBException, Exception {

	// Reading the WSDL
	Definition wsdlDefinition = rw.readWSDL("bpel/HelloWorld.wsdl");
    @SuppressWarnings("unchecked")
	Map<QName,Binding> bindings = (Map<QName,Binding>) wsdlDefinition.getAllBindings();
    Set<TModel> bindingTModels = bpel2UDDI.createWSDLBindingTModels(wsdlDefinition.getDocumentBaseURI(), bindings);
    
	for (TModel tModel : bindingTModels) {
		System.out.println("***** UDDI Binding TModel: " + tModel.getName().getValue());
                       if (serialize)
		System.out.println(pTModel.print(tModel));
	}
	Assert.assertEquals(1,bindingTModels.size());
}
 
Example #9
Source File: ServiceWSDLBuilder.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void buildBinding(Definition definition,
                            Collection<BindingInfo> bindingInfos,
                            Collection<PortType> portTypes) {
    Binding binding = null;
    for (BindingInfo bindingInfo : bindingInfos) {
        binding = definition.createBinding();
        addDocumentation(binding, bindingInfo.getDocumentation());
        binding.setUndefined(false);
        for (PortType portType : portTypes) {
            if (portType.getQName().equals(bindingInfo.getInterface().getName())) {
                binding.setPortType(portType);
                break;
            }
        }
        binding.setQName(bindingInfo.getName());
        if (!bindingInfo.getName().getNamespaceURI().equals(definition.getTargetNamespace())) {
            addNamespace(bindingInfo.getName().getNamespaceURI(), definition);
        }
        buildBindingOperation(definition, binding, bindingInfo.getOperations());
        addExtensibilityElements(definition, binding, getWSDL11Extensors(bindingInfo));
        definition.addBinding(binding);
    }
}
 
Example #10
Source File: ManagementBusInvocationPluginSoapHttp.java    From container with Apache License 2.0 6 votes vote down vote up
private String getPortName(Definition wsdl, BindingOperation operation) {
    Binding binding = null;
    final Map<QName, ?> bindings = wsdl.getBindings();
    for (Map.Entry<QName, ?> entry : bindings.entrySet()) {
        Binding examined = wsdl.getBinding((QName) entry.getKey());
        if (examined.getBindingOperations().contains(operation)) {
            binding = examined;
            break;
        }
    }
    Map<QName, Service> services = wsdl.getServices();
    for (Service service : services.values()) {
        Map<QName, Port> ports = service.getPorts();
        for (Port port : ports.values()) {
            if (port.getBinding().equals(binding)) {
                return port.getName();
            }
        }
    }
    return "";
}
 
Example #11
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 #12
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 #13
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 #14
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 #15
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 #16
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 #17
Source File: WSDLServiceUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static BindingFactory getBindingFactory(Binding binding, Bus bus, StringBuilder sb) {
    BindingFactory factory = null;
    for (Object obj : binding.getExtensibilityElements()) {
        if (obj instanceof ExtensibilityElement) {
            ExtensibilityElement ext = (ExtensibilityElement) obj;
            sb.delete(0, sb.length());
            sb.append(ext.getElementType().getNamespaceURI());
            try {
                BindingFactoryManager manager = bus.getExtension(BindingFactoryManager.class);
                if (manager != null) {
                    factory = manager.getBindingFactory(sb.toString());
                }
            } catch (BusException e) {
                // ignore, we'll use a generic BindingInfo
            }

            if (factory != null) {
                break;
            }
        }

    }

    return factory;
}
 
Example #18
Source File: WSDLASTVisitor.java    From cxf with Apache License 2.0 6 votes vote down vote up
public Binding[] getCorbaBindings() {
    List<Binding> result = new ArrayList<>();
    Map<QName, Binding> bindings = CastUtils.cast(definition.getBindings());
    for (Binding binding : bindings.values()) {
        List<ExtensibilityElement> extElements
            = CastUtils.cast(binding.getExtensibilityElements());
        for (int i = 0; i < extElements.size(); i++) {
            ExtensibilityElement el = extElements.get(i);
            if (el.getElementType().equals(CorbaConstants.NE_CORBA_BINDING)) {
                result.add(binding);
                break;
            }
        }
    }
    return result.toArray(new Binding[0]);
}
 
Example #19
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 #20
Source File: WSDLHelper.java    From cxf with Apache License 2.0 6 votes vote down vote up
public BindingOperation getBindingOperation(Definition def, String operationName) {
    if (operationName == null) {
        return null;
    }
    Iterator<Binding> ite = CastUtils.cast(def.getBindings().values().iterator());
    while (ite.hasNext()) {
        Binding binding = ite.next();
        Iterator<BindingOperation> ite1
            = CastUtils.cast(binding.getBindingOperations().iterator());
        while (ite1.hasNext()) {
            BindingOperation bop = ite1.next();
            if (bop.getName().equals(operationName)) {
                return bop;
            }
        }
    }
    return null;
}
 
Example #21
Source File: WSDLRefValidator.java    From cxf with Apache License 2.0 6 votes vote down vote up
private Map<QName, XNode> getBindings(Service service) {
    Map<QName, XNode> bindings = new HashMap<>();

    if (service.getPorts().values().isEmpty()) {
        throw new ToolException("Service " + service.getQName() + " does not contain any usable ports");
    }
    Collection<Port> ports = CastUtils.cast(service.getPorts().values());
    for (Port port : ports) {
        Binding binding = port.getBinding();
        bindings.put(binding.getQName(), getXNode(service, port));
        if (WSDLConstants.NS_WSDL11.equals(binding.getQName().getNamespaceURI())) {
            throw new ToolException("Binding "
                                    + binding.getQName().getLocalPart()
                                    + " namespace set improperly.");
        }
    }

    return bindings;
}
 
Example #22
Source File: WSDLToIDLAction.java    From cxf with Apache License 2.0 6 votes vote down vote up
private Binding findBinding(Definition definition) {
    Binding binding = null;
    Collection<Binding> bindings = CastUtils.cast(definition.getBindings().values());
    if (bindingName != null) {
        for (Binding b : bindings) {
            binding = b;
            if (binding.getQName().getLocalPart().equals(bindingName)) {
                return binding;
            }
        }
    } else {
        if (!bindings.isEmpty()) {
            binding = bindings.iterator().next();
        }
    }
    return binding;
}
 
Example #23
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 1.2 binding operations
 *
 * @return whether the provided WSDL definition contains SOAP 1.2 binding operations
 */
private boolean hasSoap12BindingOperations() {
    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 SOAP12Binding) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #24
Source File: WsdlUtils.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Build a HashSet of SOAP header names for the specified operation and binding.
 *
 * @param binding       WSDL Binding instance.
 * @param operationName Name of the operation.
 * @return HashSet of soap header names, empty set if no headers present.
 */
protected static HashSet<String> getSOAPHeaders( Binding binding, String operationName ) {

  List<ExtensibilityElement> headers = new ArrayList<ExtensibilityElement>();
  BindingOperation bindingOperation = binding.getBindingOperation( operationName, null, null );
  if ( bindingOperation == null ) {
    throw new IllegalArgumentException( "Can not find operation: " + operationName );
  }

  BindingInput bindingInput = bindingOperation.getBindingInput();
  if ( bindingInput != null ) {
    headers.addAll( WsdlUtils.findExtensibilityElements( (ElementExtensible) bindingInput, SOAP_HEADER_ELEMENT_NAME ) );
  }

  BindingOutput bindingOutput = bindingOperation.getBindingOutput();
  if ( bindingOutput != null ) {
    headers.addAll( WsdlUtils.findExtensibilityElements( (ElementExtensible) bindingOutput, SOAP_HEADER_ELEMENT_NAME ) );
  }

  HashSet<String> headerSet = new HashSet<String>( headers.size() );
  for ( ExtensibilityElement element : headers ) {
    if ( element instanceof SOAP12Header ) {
      headerSet.add( ( (SOAP12Header) element ).getPart() );
    } else {
      headerSet.add( ( (SOAPHeader) element ).getPart() );
    }
  }

  return headerSet;
}
 
Example #25
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 #26
Source File: OperationVisitor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public OperationVisitor(Scope scope,
                        Definition defn,
                        XmlSchema schemaRef,
                        WSDLASTVisitor wsdlVisitor,
                        PortType wsdlPortType,
                        Binding wsdlBinding) {
    super(scope, defn, schemaRef, wsdlVisitor);
    extReg = definition.getExtensionRegistry();
    portType = wsdlPortType;
    binding = wsdlBinding;
}
 
Example #27
Source File: JAXWSDefinitionBuilder.java    From cxf with Apache License 2.0 5 votes vote down vote up
private boolean isRPCEncoded(Definition def) {
    Iterator<?> ite1 = def.getBindings().values().iterator();
    while (ite1.hasNext()) {
        Binding binding = (Binding)ite1.next();
        String bindingStyle = SOAPBindingUtil.getBindingStyle(binding);

        Iterator<?> ite2 = binding.getBindingOperations().iterator();
        while (ite2.hasNext()) {
            BindingOperation bop = (BindingOperation)ite2.next();
            String bopStyle = SOAPBindingUtil.getSOAPOperationStyle(bop);

            String outputUse = "";
            if (SOAPBindingUtil.getBindingOutputSOAPBody(bop) != null) {
                outputUse = SOAPBindingUtil.getBindingOutputSOAPBody(bop).getUse();
            }
            String inputUse = "";
            if (SOAPBindingUtil.getBindingInputSOAPBody(bop) != null) {
                inputUse = SOAPBindingUtil.getBindingInputSOAPBody(bop).getUse();
            }
            if ((SOAPBinding.Style.RPC.name().equalsIgnoreCase(bindingStyle) || SOAPBinding.Style.RPC
                .name().equalsIgnoreCase(bopStyle))
                && (SOAPBinding.Use.ENCODED.name().equalsIgnoreCase(inputUse) || SOAPBinding.Use.ENCODED
                    .name().equalsIgnoreCase(outputUse))) {
                return true;
            }
        }
    }
    return false;
}
 
Example #28
Source File: WSDLHelper.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Binding getBinding(BindingOperation bop, Definition def) {
    Collection<Binding> ite = CastUtils.cast(def.getBindings().values());
    for (Binding binding : ite) {
        List<BindingOperation> bos = CastUtils.cast(binding.getBindingOperations());
        for (BindingOperation bindingOperation : bos) {
            if (bindingOperation.getName().equals(bop.getName())) {
                return binding;
            }
        }
    }
    return null;
}
 
Example #29
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 #30
Source File: WSDLToCorbaHelper.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected static boolean queryBinding(Definition definition, QName bqname) {
    Collection<Binding> bindings = CastUtils.cast(definition.getBindings().values());
    for (Binding binding : bindings) {
        if (binding.getQName().getLocalPart().equals(bqname.getLocalPart())) {
            return true;
        }
    }
    return false;
}