javax.wsdl.BindingInput Java Examples
The following examples show how to use
javax.wsdl.BindingInput.
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 |
private List<SOAPHeader> makeHeaders(Definition definition) throws WSDLException { List<SOAPHeader> list = new ArrayList<SOAPHeader>(); String[] parts = new String[] { XTeeHeader.CLIENT.getLocalPart(), XTeeHeader.SERVICE.getLocalPart(), XTeeHeader.USER_ID.getLocalPart(), XTeeHeader.ID.getLocalPart(), XTeeHeader.PROTOCOL_VERSION.getLocalPart() }; ExtensionRegistry extReg = definition.getExtensionRegistry(); for (int i = 0; i < parts.length; i++) { SOAPHeader header = (SOAPHeader) extReg.createExtension(BindingInput.class, new QName(SOAP_11_NAMESPACE_URI, "header")); header.setMessage(new QName(definition.getTargetNamespace(), XTeeWsdlDefinition.XROAD_HEADER)); header.setPart(parts[i]); if (use.equalsIgnoreCase(LITERAL)) { header.setUse(LITERAL); } else { header.setUse(ENCODED); header.setEncodingStyles(Arrays.asList(ENCODING)); } list.add(header); } return list; }
Example #2
Source File: AttributeVisitor.java From cxf with Apache License 2.0 | 6 votes |
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: 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 #4
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 #5
Source File: LightWeightMappingValidator.java From tomee with Apache License 2.0 | 5 votes |
@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 #6
Source File: JaxRpcServiceInfoBuilder.java From tomee with Apache License 2.0 | 5 votes |
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: AbstractWSDLBindingFactory.java From cxf with Apache License 2.0 | 5 votes |
private void copyExtensors(AbstractPropertiesHolder info, ElementExtensible extElement, BindingOperationInfo bop) { if (info != null) { for (ExtensibilityElement ext : cast(extElement.getExtensibilityElements(), ExtensibilityElement.class)) { info.addExtensor(ext); if (bop != null && extElement instanceof BindingInput) { addMessageFromBinding(ext, bop, true); } if (bop != null && extElement instanceof BindingOutput) { addMessageFromBinding(ext, bop, false); } } } }
Example #8
Source File: PartialWSDLProcessor.java From cxf with Apache License 2.0 | 5 votes |
private static BindingInput getBindingInput(Input input, Definition wsdlDefinition, ExtensionRegistry extReg) throws Exception { BindingInput bi = wsdlDefinition.createBindingInput(); bi.setName(input.getName()); bi.addExtensibilityElement(getSoapBody(BindingInput.class, extReg)); return bi; }
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: 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 #11
Source File: ServiceWSDLBuilder.java From cxf with Apache License 2.0 | 5 votes |
protected void buildBindingInput(Definition def, BindingOperation bindingOperation, BindingMessageInfo bindingMessageInfo) { BindingInput bindingInput = null; if (bindingMessageInfo != null) { bindingInput = def.createBindingInput(); addDocumentation(bindingInput, bindingMessageInfo.getDocumentation()); bindingInput.setName(bindingMessageInfo.getMessageInfo().getName().getLocalPart()); bindingOperation.setBindingInput(bindingInput); addExtensibilityAttributes(def, bindingInput, bindingMessageInfo.getExtensionAttributes()); addExtensibilityElements(def, bindingInput, getWSDL11Extensors(bindingMessageInfo)); } }
Example #12
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 #13
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 #14
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 #15
Source File: WSDLToXMLProcessor.java From cxf with Apache License 2.0 | 5 votes |
private BindingInput getBindingInput(Input input, String operationName) throws ToolException { BindingInput bi = wsdlDefinition.createBindingInput(); bi.setName(input.getName()); //This ext element in some scenario is optional, but if provided, won't cause error bi.addExtensibilityElement(getXMLBody(BindingInput.class, operationName)); return bi; }
Example #16
Source File: WSDLToSoapProcessor.java From cxf with Apache License 2.0 | 5 votes |
private BindingInput getBindingInput(Input input) throws ToolException { BindingInput bi = wsdlDefinition.createBindingInput(); bi.setName(input.getName()); // As command line won't specify the details of body/header for message // parts // All input message's parts will be added into one soap body element bi.addExtensibilityElement(getSoapBody(BindingInput.class)); return bi; }
Example #17
Source File: WSDLToCorbaBinding.java From cxf with Apache License 2.0 | 5 votes |
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 #18
Source File: OperationVisitor.java From cxf with Apache License 2.0 | 5 votes |
public Message generateInputMessage(Operation operation, BindingOperation bindingOperation) { Message msg = definition.createMessage(); QName msgName; if (!mapper.isDefaultMapping()) { //mangle the message name //REVISIT, do we put in the entire scope for mangling msgName = new QName(definition.getTargetNamespace(), getScope().tail() + "." + operation.getName()); } else { msgName = new QName(definition.getTargetNamespace(), operation.getName()); } msg.setQName(msgName); msg.setUndefined(false); String inputName = operation.getName() + REQUEST_SUFFIX; Input input = definition.createInput(); input.setName(inputName); input.setMessage(msg); BindingInput bindingInput = definition.createBindingInput(); bindingInput.setName(inputName); bindingOperation.setBindingInput(bindingInput); operation.setInput(input); definition.addMessage(msg); return msg; }
Example #19
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 #20
Source File: XTeeSoapProvider.java From j-road with Apache License 2.0 | 5 votes |
@Override protected void populateBindingInput(Definition definition, BindingInput bindingInput, Input input) throws WSDLException { for (SOAPHeader header : makeHeaders(definition)) { bindingInput.addExtensibilityElement(header); } super.populateBindingInput(definition, bindingInput, input); }
Example #21
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 #22
Source File: WSDLManagerImpl.java From cxf with Apache License 2.0 | 4 votes |
private WSDLManagerImpl(Bus b) throws BusException { try { // This is needed to avoid security exceptions when running with a security manager if (System.getSecurityManager() == null) { factory = WSDLFactory.newInstance(); } else { try { factory = AccessController.doPrivileged( (PrivilegedExceptionAction<WSDLFactory>) WSDLFactory::newInstance); } catch (PrivilegedActionException paex) { throw new BusException(paex); } } registry = factory.newPopulatedExtensionRegistry(); registry.registerSerializer(Types.class, WSDLConstants.QNAME_SCHEMA, new SchemaSerializer()); // these will replace whatever may have already been registered // in these places, but there's no good way to check what was // there before. QName header = new QName(WSDLConstants.NS_SOAP, "header"); registry.registerDeserializer(MIMEPart.class, header, registry.queryDeserializer(BindingInput.class, header)); registry.registerSerializer(MIMEPart.class, header, registry.querySerializer(BindingInput.class, header)); // get the original classname of the SOAPHeader // implementation that was stored in the registry. Class<? extends ExtensibilityElement> clazz = registry.createExtension(BindingInput.class, header).getClass(); registry.mapExtensionTypes(MIMEPart.class, header, clazz); // register some known extension attribute types that are not recognized by the default registry addExtensionAttributeTypes(registry); } catch (WSDLException e) { throw new BusException(e); } definitionsMap = new CacheMap<>(); schemaCacheMap = new CacheMap<>(); setBus(b); }
Example #23
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); } }
Example #24
Source File: WsdlVisitor.java From tomee with Apache License 2.0 | 4 votes |
protected void visit(BindingInput bindingInput) { }
Example #25
Source File: WSDLDocCreator.java From jolie with GNU Lesser General Public License v2.1 | 4 votes |
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(); } }