Java Code Examples for javax.wsdl.Operation#getInput()
The following examples show how to use
javax.wsdl.Operation#getInput() .
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: WSDL11SOAPOperationExtractor.java From carbon-apimgt with Apache License 2.0 | 6 votes |
/** * Gets the target namespace given the soap binding operation * * @param bindingOperation soap operation * @return target name space */ private String getTargetNamespace(BindingOperation bindingOperation) { Operation operation = bindingOperation.getOperation(); if (operation != null) { Input input = operation.getInput(); if (input != null) { Message message = input.getMessage(); if (message != null) { Map partMap = message.getParts(); for (Object obj : partMap.entrySet()) { Map.Entry entry = (Map.Entry) obj; Part part = (Part) entry.getValue(); if (part != null) { if (part.getElementName() != null) { return part.getElementName().getNamespaceURI(); } } } } } } return targetNamespace; }
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: 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 6
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 7
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 8
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 9
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 10
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 11
Source File: WSDLHelper.java From cxf with Apache License 2.0 | 5 votes |
public List<Part> getInMessageParts(Operation operation) { Input input = operation.getInput(); List<Part> partsList = new ArrayList<>(); if (input != null && input.getMessage() != null) { Collection<Part> parts = CastUtils.cast(input.getMessage().getParts().values()); for (Part p : parts) { partsList.add(p); } } return partsList; }
Example 12
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 13
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 14
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 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: 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(); } }