Java Code Examples for javax.wsdl.BindingOperation#getBindingInput()
The following examples show how to use
javax.wsdl.BindingOperation#getBindingInput() .
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: MIMEBindingValidator.java From cxf with Apache License 2.0 | 6 votes |
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 2
Source File: WsdlUtils.java From hop with Apache License 2.0 | 5 votes |
/** * 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 3
Source File: WSIBPValidator.java From cxf with Apache License 2.0 | 5 votes |
private boolean checkR2209(final Operation operation, final BindingOperation bop) { if ((bop.getBindingInput() == null && operation.getInput() != null) || (bop.getBindingOutput() == null && operation.getOutput() != null)) { addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2209") + "Unbound PortType elements in Operation '" + operation.getName() + "'"); return false; } return true; }
Example 4
Source File: UniqueBodyPartsValidator.java From cxf with Apache License 2.0 | 5 votes |
public boolean isValid() { Collection<Binding> bindings = CastUtils.cast(def.getAllBindings().values()); for (Binding binding : bindings) { uniqueBodyPartsMap = new HashMap<>(); List<BindingOperation> ops = CastUtils.cast(binding.getBindingOperations()); for (BindingOperation op : ops) { Operation operation = op.getOperation(); if (operation != null && operation.getInput() != null) { Message inMessage = operation.getInput().getMessage(); BindingInput bin = op.getBindingInput(); Set<String> headers = new HashSet<>(); if (bin != null) { List<ExtensibilityElement> lst = CastUtils.cast(bin.getExtensibilityElements()); for (ExtensibilityElement ext : lst) { if (!(ext instanceof SOAPHeader)) { continue; } SOAPHeader header = (SOAPHeader)ext; if (!header.getMessage().equals(inMessage.getQName())) { continue; } headers.add(header.getPart()); } } //find the headers as they don't contribute to the body if (inMessage != null && !isUniqueBodyPart(operation.getName(), inMessage, headers, binding.getQName())) { return false; } } } } return true; }
Example 5
Source File: SOAPBindingUtil.java From cxf with Apache License 2.0 | 5 votes |
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 6
Source File: SOAPBindingUtil.java From cxf with Apache License 2.0 | 5 votes |
public static SoapHeader getBindingInputSOAPHeader(BindingOperation bop) { BindingInput bindingInput = bop.getBindingInput(); if (bindingInput != null) { for (Object obj : bindingInput.getExtensibilityElements()) { if (isSOAPHeader(obj)) { return getProxy(SoapHeader.class, obj); } } } return null; }
Example 7
Source File: SOAPBindingUtil.java From cxf with Apache License 2.0 | 5 votes |
public static List<SoapHeader> getBindingInputSOAPHeaders(BindingOperation bop) { List<SoapHeader> headers = new ArrayList<>(); BindingInput bindingInput = bop.getBindingInput(); if (bindingInput != null) { for (Object obj : bindingInput.getExtensibilityElements()) { if (isSOAPHeader(obj)) { headers.add(getProxy(SoapHeader.class, obj)); } } } return headers; }
Example 8
Source File: SOAPBindingUtil.java From cxf with Apache License 2.0 | 5 votes |
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 9
Source File: SOAPBindingUtil.java From cxf with Apache License 2.0 | 5 votes |
public static SOAPHeader getBindingInputSOAPHeader(BindingOperation bop) { BindingInput bindingInput = bop.getBindingInput(); if (bindingInput != null) { for (Object obj : bindingInput.getExtensibilityElements()) { if (isSOAPHeader(obj)) { return getProxy(SOAPHeader.class, obj); } } } return null; }
Example 10
Source File: WsdlUtils.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * 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( bindingInput, SOAP_HEADER_ELEMENT_NAME ) ); } BindingOutput bindingOutput = bindingOperation.getBindingOutput(); if ( bindingOutput != null ) { headers.addAll( WsdlUtils.findExtensibilityElements( 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 11
Source File: WSDLRefValidator.java From cxf with Apache License 2.0 | 4 votes |
private void collectValidationPointsForBindings() throws Exception { Map<QName, XNode> vBindingNodes = new HashMap<>(); for (Service service : services.values()) { vBindingNodes.putAll(getBindings(service)); } for (Map.Entry<QName, XNode> entry : vBindingNodes.entrySet()) { QName bName = entry.getKey(); Binding binding = this.definition.getBinding(bName); if (binding == null) { LOG.log(Level.SEVERE, bName.toString() + " is not correct, please check that the correct namespace is being used"); throw new Exception(bName.toString() + " is not correct, please check that the correct namespace is being used"); } XNode vBindingNode = getXNode(binding); vBindingNode.setFailurePoint(entry.getValue()); vNodes.add(vBindingNode); if (binding.getPortType() == null) { continue; } portTypeRefNames.add(binding.getPortType().getQName()); XNode vPortTypeNode = getXNode(binding.getPortType()); vPortTypeNode.setFailurePoint(vBindingNode); vNodes.add(vPortTypeNode); Collection<BindingOperation> bops = CastUtils.cast(binding.getBindingOperations()); for (BindingOperation bop : bops) { XNode vOpNode = getOperationXNode(vPortTypeNode, bop.getName()); XNode vBopNode = getOperationXNode(vBindingNode, bop.getName()); vOpNode.setFailurePoint(vBopNode); vNodes.add(vOpNode); if (bop.getBindingInput() != null) { String inName = bop.getBindingInput().getName(); if (!StringUtils.isEmpty(inName)) { XNode vInputNode = getInputXNode(vOpNode, inName); vInputNode.setFailurePoint(getInputXNode(vBopNode, inName)); vNodes.add(vInputNode); } } if (bop.getBindingOutput() != null) { String outName = bop.getBindingOutput().getName(); if (!StringUtils.isEmpty(outName)) { XNode vOutputNode = getOutputXNode(vOpNode, outName); vOutputNode.setFailurePoint(getOutputXNode(vBopNode, outName)); vNodes.add(vOutputNode); } } for (Iterator<?> iter1 = bop.getBindingFaults().keySet().iterator(); iter1.hasNext();) { String faultName = (String) iter1.next(); XNode vFaultNode = getFaultXNode(vOpNode, faultName); vFaultNode.setFailurePoint(getFaultXNode(vBopNode, faultName)); vNodes.add(vFaultNode); } } } }
Example 12
Source File: JAXWSDefinitionBuilderTest.java From cxf with Apache License 2.0 | 4 votes |
@Test public void testBuildDefinitionWithXMLBinding() { String qname = "http://apache.org/hello_world_xml_http/bare"; String wsdlUrl = getClass().getResource("resources/hello_world_xml_bare.wsdl").toString(); JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder(); builder.setBus(BusFactory.getDefaultBus()); builder.setContext(env); Definition def = builder.build(wsdlUrl); assertNotNull(def); Map<?, ?> services = def.getServices(); assertNotNull(services); assertEquals(1, services.size()); Service service = (Service)services.get(new QName(qname, "XMLService")); assertNotNull(service); Map<?, ?> ports = service.getPorts(); assertNotNull(ports); assertEquals(1, ports.size()); Port port = service.getPort("XMLPort"); assertNotNull(port); assertEquals(1, port.getExtensibilityElements().size()); Object obj = port.getExtensibilityElements().get(0); if (obj instanceof JAXBExtensibilityElement) { obj = ((JAXBExtensibilityElement)obj).getValue(); } assertTrue(obj.getClass().getName() + " is not an AddressType", obj instanceof AddressType); Binding binding = port.getBinding(); assertNotNull(binding); assertEquals(new QName(qname, "Greeter_XMLBinding"), binding.getQName()); BindingOperation operation = binding.getBindingOperation("sayHi", null, null); assertNotNull(operation); BindingInput input = operation.getBindingInput(); assertNotNull(input); assertEquals(1, input.getExtensibilityElements().size()); obj = input.getExtensibilityElements().get(0); if (obj instanceof JAXBExtensibilityElement) { obj = ((JAXBExtensibilityElement)obj).getValue(); } assertTrue(obj.getClass().getName() + " is not an XMLBindingMessageFormat", obj instanceof XMLBindingMessageFormat); }
Example 13
Source File: AbstractWSDLBindingFactory.java From cxf with Apache License 2.0 | 4 votes |
protected BindingInfo initializeBindingInfo(ServiceInfo service, Binding binding, BindingInfo bi) { bi.setName(binding.getQName()); copyExtensors(bi, binding, null); for (BindingOperation bop : cast(binding.getBindingOperations(), BindingOperation.class)) { String inName = null; String outName = null; if (bop.getBindingInput() != null) { inName = bop.getBindingInput().getName(); } if (bop.getBindingOutput() != null) { outName = bop.getBindingOutput().getName(); } String portTypeNs = binding.getPortType().getQName().getNamespaceURI(); QName opName = new QName(portTypeNs, bop.getName()); BindingOperationInfo bop2 = bi.getOperation(opName); if (bop2 == null) { bop2 = bi.buildOperation(opName, inName, outName); if (bop2 != null) { bi.addOperation(bop2); } } if (bop2 != null) { copyExtensors(bop2, bop, bop2); if (bop.getBindingInput() != null) { copyExtensors(bop2.getInput(), bop.getBindingInput(), bop2); } if (bop.getBindingOutput() != null) { copyExtensors(bop2.getOutput(), bop.getBindingOutput(), bop2); } for (BindingFault f : cast(bop.getBindingFaults().values(), BindingFault.class)) { if (StringUtils.isEmpty(f.getName())) { throw new IllegalArgumentException("wsdl:fault and soap:fault elements" + " must have a name attribute."); } copyExtensors(bop2.getFault(new QName(service.getTargetNamespace(), f.getName())), bop.getBindingFault(f.getName()), bop2); } } } return bi; }
Example 14
Source File: HeavyweightOperationInfoBuilder.java From tomee with Apache License 2.0 | 4 votes |
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); } }