Java Code Examples for javax.wsdl.Operation#getOutput()
The following examples show how to use
javax.wsdl.Operation#getOutput() .
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: OperationInfo.java From tesb-studio-se with Apache License 2.0 | 6 votes |
public OperationInfo(Operation operation) { targetMethodName = operation.getName(); Input inDef = operation.getInput(); if (inDef != null) { Message inMsg = inDef.getMessage(); if (inMsg != null) { input = getParameterFromMessage(inMsg); } } Output outDef = operation.getOutput(); if (outDef != null) { Message outMsg = outDef.getMessage(); if (outMsg != null) { output = getParameterFromMessage(outMsg); } } for (Fault fault : (Collection<Fault>) operation.getFaults().values()) { Message faultMsg = fault.getMessage(); if (faultMsg != null) { faults.add(getParameterFromMessage(faultMsg)); } } }
Example 2
Source File: ServiceWSDLBuilderTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testGreetMeOneWayOperation() throws Exception { setupWSDL(WSDL_PATH); PortType portType = newDef.getPortType(new QName(newDef.getTargetNamespace(), "Greeter")); Operation greetMeOneWay = portType.getOperation("greetMeOneWay", "greetMeOneWayRequest", null); assertNotNull(greetMeOneWay); assertEquals("greetMeOneWay", greetMeOneWay.getName()); Input input = greetMeOneWay.getInput(); assertNotNull(input); assertEquals("greetMeOneWayRequest", input.getName()); Message message = input.getMessage(); assertNotNull(message); assertEquals("greetMeOneWayRequest", message.getQName().getLocalPart()); assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI()); assertEquals(1, message.getParts().size()); assertEquals("in", message.getPart("in").getName()); Output output = greetMeOneWay.getOutput(); assertNull(output); assertEquals(0, greetMeOneWay.getFaults().size()); }
Example 3
Source File: WSDLToXMLProcessor.java From cxf with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private void addBindingOperation() throws ToolException { List<Operation> ops = portType.getOperations(); for (Operation op : ops) { BindingOperation bindingOperation = wsdlDefinition.createBindingOperation(); bindingOperation.setName(op.getName()); if (op.getInput() != null) { bindingOperation.setBindingInput(getBindingInput(op.getInput(), op.getName())); } if (op.getOutput() != null) { bindingOperation.setBindingOutput(getBindingOutput(op.getOutput(), op.getName())); } if (op.getFaults() != null && op.getFaults().size() > 0) { addXMLFaults(op, bindingOperation); } bindingOperation.setOperation(op); binding.addBindingOperation(bindingOperation); } }
Example 4
Source File: PartialWSDLProcessor.java From cxf with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private static void addBindingOperation(Definition wsdlDefinition, PortType portType, Binding binding, ExtensionRegistry extReg) throws Exception { List<Operation> ops = portType.getOperations(); for (Operation op : ops) { BindingOperation bindingOperation = wsdlDefinition.createBindingOperation(); setSoapOperationExtElement(bindingOperation, extReg); bindingOperation.setName(op.getName()); if (op.getInput() != null) { bindingOperation.setBindingInput(getBindingInput(op.getInput(), wsdlDefinition, extReg)); } if (op.getOutput() != null) { bindingOperation.setBindingOutput(getBindingOutput(op.getOutput(), wsdlDefinition, extReg)); } if (op.getFaults() != null && op.getFaults().size() > 0) { addSoapFaults(op, bindingOperation, wsdlDefinition, extReg); } bindingOperation.setOperation(op); binding.addBindingOperation(bindingOperation); } }
Example 5
Source File: PublishMetadataRunnable.java From tesb-studio-se with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private Collection<String> getAllPaths() throws URISyntaxException { final Set<String> paths = new HashSet<String>(); final Set<QName> portTypes = new HashSet<QName>(); final Set<QName> alreadyCreated = new HashSet<QName>(); for (Binding binding : (Collection<Binding>) wsdlDefinition.getAllBindings().values()) { final QName portType = binding.getPortType().getQName(); if (portTypes.add(portType)) { for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) { Operation oper = operation.getOperation(); Input inDef = oper.getInput(); if (inDef != null) { Message inMsg = inDef.getMessage(); addParamsToPath(portType, oper, inMsg, paths, alreadyCreated); } Output outDef = oper.getOutput(); if (outDef != null) { Message outMsg = outDef.getMessage(); addParamsToPath(portType, oper, outMsg, paths, alreadyCreated); } for (Fault fault : (Collection<Fault>) oper.getFaults().values()) { Message faultMsg = fault.getMessage(); addParamsToPath(portType, oper, faultMsg, paths, alreadyCreated); } } } } return paths; }
Example 6
Source File: LightweightOperationInfoBuilder.java From tomee with Apache License 2.0 | 5 votes |
public LightweightOperationInfoBuilder(BindingOperation bindingOperation, Method method) throws OpenEJBException { if (bindingOperation == null) { throw new OpenEJBException("No BindingOperation supplied for method " + method.getName()); } Operation operation = bindingOperation.getOperation(); this.operationName = operation.getName(); this.inputMessage = operation.getInput().getMessage(); this.outputMessage = operation.getOutput() == null ? null : operation.getOutput().getMessage(); this.method = method; }
Example 7
Source File: ServiceWSDLBuilderTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testPingMeOperation() throws Exception { setupWSDL(WSDL_PATH); PortType portType = newDef.getPortType(new QName(newDef.getTargetNamespace(), "Greeter")); Operation pingMe = portType.getOperation("pingMe", "pingMeRequest", "pingMeResponse"); assertNotNull(pingMe); assertEquals("pingMe", pingMe.getName()); Input input = pingMe.getInput(); assertNotNull(input); assertEquals("pingMeRequest", input.getName()); Message message = input.getMessage(); assertNotNull(message); assertEquals("pingMeRequest", message.getQName().getLocalPart()); assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI()); assertEquals(1, message.getParts().size()); assertEquals("in", message.getPart("in").getName()); Output output = pingMe.getOutput(); assertNotNull(output); assertEquals("pingMeResponse", output.getName()); message = output.getMessage(); assertNotNull(message); assertEquals("pingMeResponse", message.getQName().getLocalPart()); assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI()); assertEquals(message.getParts().size(), 1); assertEquals("out", message.getPart("out").getName()); assertEquals(1, pingMe.getFaults().size()); Fault fault = pingMe.getFault("pingMeFault"); assertNotNull(fault); assertEquals("pingMeFault", fault.getName()); message = fault.getMessage(); assertNotNull(message); assertEquals("pingMeFault", message.getQName().getLocalPart()); assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI()); assertEquals(1, message.getParts().size()); assertEquals("faultDetail", message.getPart("faultDetail").getName()); assertNull(message.getPart("faultDetail").getTypeName()); }
Example 8
Source File: ServiceWSDLBuilderTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testGreetMeOperation() throws Exception { setupWSDL(WSDL_PATH); PortType portType = newDef.getPortType(new QName(newDef.getTargetNamespace(), "Greeter")); Operation greetMe = portType.getOperation("greetMe", "greetMeRequest", "greetMeResponse"); assertNotNull(greetMe); assertEquals("greetMe", greetMe.getName()); Input input = greetMe.getInput(); assertNotNull(input); assertEquals("greetMeRequest", input.getName()); Message message = input.getMessage(); assertNotNull(message); assertEquals("greetMeRequest", message.getQName().getLocalPart()); assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI()); assertEquals(1, message.getParts().size()); assertEquals("in", message.getPart("in").getName()); Output output = greetMe.getOutput(); assertNotNull(output); assertEquals("greetMeResponse", output.getName()); message = output.getMessage(); assertNotNull(message); assertEquals("greetMeResponse", message.getQName().getLocalPart()); assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI()); assertEquals(1, message.getParts().size()); assertEquals("out", message.getPart("out").getName()); assertEquals(0, greetMe.getFaults().size()); }
Example 9
Source File: ServiceWSDLBuilderTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testSayHiOperation() throws Exception { setupWSDL(WSDL_PATH); PortType portType = newDef.getPortType(new QName(newDef.getTargetNamespace(), "Greeter")); Collection<Operation> operations = CastUtils.cast( portType.getOperations(), Operation.class); assertEquals(4, operations.size()); Operation sayHi = portType.getOperation("sayHi", "sayHiRequest", "sayHiResponse"); assertNotNull(sayHi); assertEquals(sayHi.getName(), "sayHi"); Input input = sayHi.getInput(); assertNotNull(input); assertEquals("sayHiRequest", input.getName()); Message message = input.getMessage(); assertNotNull(message); assertEquals("sayHiRequest", message.getQName().getLocalPart()); assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI()); assertEquals(1, message.getParts().size()); assertEquals("in", message.getPart("in").getName()); Output output = sayHi.getOutput(); assertNotNull(output); assertEquals("sayHiResponse", output.getName()); message = output.getMessage(); assertNotNull(message); assertEquals("sayHiResponse", message.getQName().getLocalPart()); assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI()); assertEquals(1, message.getParts().size()); assertEquals("out", message.getPart("out").getName()); assertEquals(0, sayHi.getFaults().size()); }
Example 10
Source File: WSDLHelper.java From cxf with Apache License 2.0 | 5 votes |
public List<Part> getOutMessageParts(Operation operation) { Output output = operation.getOutput(); List<Part> partsList = new ArrayList<>(); if (output != null && output.getMessage() != null) { Collection<Part> parts = CastUtils.cast(output.getMessage().getParts().values()); for (Part p : parts) { partsList.add(p); } } return partsList; }
Example 11
Source File: WSDLToSoapProcessor.java From cxf with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void addBindingOperation() throws ToolException { /** * This method won't do unique operation name checking on portType The * WS-I Basic Profile[17] R2304 requires that operations within a * wsdl:portType have unique values for their name attribute so mapping * of WS-I compliant WSDLdescriptions will not generate Java interfaces * with overloaded methods. However, for backwards compatibility, JAX-WS * supports operation name overloading provided the overloading does not * cause conflicts (as specified in the Java Language Specification[25]) * in the mapped Java service endpoint interface declaration. */ List<Operation> ops = portType.getOperations(); for (Operation op : ops) { BindingOperation bindingOperation = wsdlDefinition.createBindingOperation(); setSoapOperationExtElement(bindingOperation); bindingOperation.setName(op.getName()); if (op.getInput() != null) { bindingOperation.setBindingInput(getBindingInput(op.getInput())); } if (op.getOutput() != null) { bindingOperation.setBindingOutput(getBindingOutput(op.getOutput())); } if (op.getFaults() != null && op.getFaults().size() > 0) { addSoapFaults(op, bindingOperation); } bindingOperation.setOperation(op); binding.addBindingOperation(bindingOperation); } }
Example 12
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 13
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 14
Source File: WSDLConverter.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
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: WSDLRefValidator.java From cxf with Apache License 2.0 | 4 votes |
private void collectValidationPointsForPortTypes() { for (QName ptName : portTypeRefNames) { PortType portType = getPortType(ptName); if (portType == null) { vResults.addError(new Message("NO_PORTTYPE", LOG, ptName)); continue; } XNode vPortTypeNode = getXNode(portType); for (Operation operation : getOperations(portType).values()) { XNode vOperationNode = getOperationXNode(vPortTypeNode, operation.getName()); if (operation.getInput() == null) { vResults.addError(new Message("WRONG_MEP", LOG, operation.getName(), portType.getQName())); continue; } javax.wsdl.Message inMsg = operation.getInput().getMessage(); if (inMsg == null) { addWarning("Operation " + operation.getName() + " in PortType: " + portType.getQName() + " has no input message"); } else { XNode vInMsgNode = getXNode(inMsg); vInMsgNode.setFailurePoint(getInputXNode(vOperationNode, operation.getInput().getName())); vNodes.add(vInMsgNode); messageRefNames.add(inMsg.getQName()); } if (operation.getOutput() != null) { javax.wsdl.Message outMsg = operation.getOutput().getMessage(); if (outMsg == null) { addWarning("Operation " + operation.getName() + " in PortType: " + portType.getQName() + " has no output message"); } else { XNode vOutMsgNode = getXNode(outMsg); vOutMsgNode.setFailurePoint(getOutputXNode(vOperationNode, operation.getOutput().getName())); vNodes.add(vOutMsgNode); messageRefNames.add(outMsg.getQName()); } } for (Iterator<?> iter = operation.getFaults().values().iterator(); iter.hasNext();) { Fault fault = (Fault) iter.next(); javax.wsdl.Message faultMsg = fault.getMessage(); XNode vFaultMsgNode = getXNode(faultMsg); vFaultMsgNode.setFailurePoint(getFaultXNode(vOperationNode, fault.getName())); vNodes.add(vFaultMsgNode); messageRefNames.add(faultMsg.getQName()); } } } }
Example 16
Source File: WSDL11SOAPOperationExtractor.java From carbon-apimgt with Apache License 2.0 | 4 votes |
/** * Gets swagger output parameter model for a given soap operation * * @param bindingOperation soap operation * @return list of swagger models for the parameters * @throws APIMgtWSDLException */ private List<ModelImpl> getSoapOutputParameterModel(BindingOperation bindingOperation) throws APIMgtWSDLException { List<ModelImpl> outputParameterModelList = new ArrayList<>(); Operation operation = bindingOperation.getOperation(); if (operation != null) { Output output = operation.getOutput(); if (output != null) { Message message = output.getMessage(); if (message != null) { Map map = message.getParts(); for (Object obj : map.entrySet()) { Map.Entry entry = (Map.Entry) obj; Part part = (Part) entry.getValue(); if (part != null) { if (part.getElementName() != null) { outputParameterModelList.add(parameterModelMap.get(part.getElementName() .getLocalPart())); } else { if (part.getTypeName() != null && parameterModelMap .containsKey(part.getTypeName().getLocalPart())) { outputParameterModelList .add(parameterModelMap.get(part.getTypeName().getLocalPart())); } else { ModelImpl model = new ModelImpl(); model.setType(ObjectProperty.TYPE); model.setName(message.getQName().getLocalPart()); if (getPropertyFromDataType(part.getTypeName().getLocalPart()) instanceof RefProperty) { RefProperty property = (RefProperty) getPropertyFromDataType(part.getTypeName() .getLocalPart()); property.set$ref(SOAPToRESTConstants.Swagger.DEFINITIONS_ROOT + part.getTypeName().getLocalPart()); model.addProperty(part.getName(), property); } else { model.addProperty(part.getName(), getPropertyFromDataType(part.getTypeName().getLocalPart())); } parameterModelMap.put(model.getName(), model); outputParameterModelList.add(model); } } } } } } } return outputParameterModelList; }
Example 17
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 18
Source File: WsdlVisitor.java From tomee with Apache License 2.0 | 4 votes |
public void walkTree() { begin(); try { visit(definition); for (Iterator iterator = definition.getImports().entrySet().iterator(); iterator.hasNext(); ) { Map.Entry entry = (Map.Entry) iterator.next(); String namespaceURI = (String) entry.getKey(); List importsForNamespace = (List) entry.getValue(); for (Iterator iterator1 = importsForNamespace.iterator(); iterator1.hasNext(); ) { Import anImport = (Import) iterator1.next(); visit(anImport); } } visit(definition.getTypes()); Collection messages = definition.getMessages().values(); for (Iterator iterator = messages.iterator(); iterator.hasNext(); ) { Message message = (Message) iterator.next(); visit(message); Collection parts = message.getParts().values(); for (Iterator iterator2 = parts.iterator(); iterator2.hasNext(); ) { Part part = (Part) iterator2.next(); visit(part); } } Collection services = definition.getServices().values(); for (Iterator iterator = services.iterator(); iterator.hasNext(); ) { Service service = (Service) iterator.next(); visit(service); Collection ports = service.getPorts().values(); for (Iterator iterator1 = ports.iterator(); iterator1.hasNext(); ) { Port port = (Port) iterator1.next(); visit(port); Binding binding = port.getBinding(); visit(binding); List bindingOperations = binding.getBindingOperations(); for (int i = 0; i < bindingOperations.size(); i++) { BindingOperation bindingOperation = (BindingOperation) bindingOperations.get(i); visit(bindingOperation); visit(bindingOperation.getBindingInput()); visit(bindingOperation.getBindingOutput()); Collection bindingFaults = bindingOperation.getBindingFaults().values(); for (Iterator iterator2 = bindingFaults.iterator(); iterator2.hasNext(); ) { BindingFault bindingFault = (BindingFault) iterator2.next(); visit(bindingFault); } } PortType portType = binding.getPortType(); visit(portType); List operations = portType.getOperations(); for (int i = 0; i < operations.size(); i++) { Operation operation = (Operation) operations.get(i); visit(operation); { Input input = operation.getInput(); visit(input); } { Output output = operation.getOutput(); visit(output); } Collection faults = operation.getFaults().values(); for (Iterator iterator2 = faults.iterator(); iterator2.hasNext(); ) { Fault fault = (Fault) iterator2.next(); visit(fault); } } } } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } finally { end(); } }