WSDLParser parser = null; try { parser = new WSDLParser(wsdl); List<Operation> operations = parser.getOperations(); for (Operation op : operations) { WSDLActivityItem item = new WSDLActivityItem(); try { item.setOperation(op.getName()); item.setUse(parser.getUse(item.getOperation())); item.setStyle(parser.getStyle()); item.setUrl(wsdl); add(item);
protected BodyBuilder createBuilder(String wsdl, String operation) throws Exception { WSDLParser parser = new WSDLParser(wsdl); return BodyBuilderFactory.instance().create(parser, operation, parser.getOperationInputParameters(operation)); } }
public Map<String, TypeDescriptor> getTypeDescriptorsForOutputPorts() throws UnknownOperationException, IOException { Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>(); List<TypeDescriptor> inputDescriptors = parser .getOperationOutputParameters(configurationBean.getOperation().getOperationName()); for (TypeDescriptor descriptor : inputDescriptors) { descriptors.put(descriptor.getName(), descriptor); } return descriptors; }
@Test public void isWSRF() throws Exception { wsdlParser = new WSDLParser(counterServiceWSDL.toExternalForm()); assertTrue("Not recognized as WSRF service", wsdlParser.isWsrfService()); }
@Test public void testGoVizNoOutputs() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("GoViz.wsdl")); List<TypeDescriptor> inputs = parser .getOperationInputParameters("destroySession"); List<TypeDescriptor> outputs = parser .getOperationOutputParameters("destroySession"); assertEquals("wrong number of inputs", 1, inputs.size()); assertEquals("wrong number of outputs", 0, outputs.size()); TypeDescriptor typeDesc = inputs.get(0); assertTrue("input should be BaseType", typeDesc instanceof BaseTypeDescriptor); assertEquals("wrong name", "sessionID", typeDesc.getName()); assertEquals("wrong type", "string", typeDesc.getType()); }
@Test public void testLiteralUnwrappedParserForNonXMLOutput() throws Exception { SOAPResponseParserFactory factory = SOAPResponseParserFactory.instance(); List<String> response = new ArrayList<String>(); WSDLParser wsdlParser = new WSDLParser(wsdlResourcePath("TestServices-unwrapped.wsdl")); SOAPResponseParser parser = factory.create(response, "literal", "document", wsdlParser.getOperationOutputParameters("getString")); assertTrue("The parser is the wrong type, it was:"+parser.getClass().getSimpleName(),parser instanceof SOAPResponsePrimitiveLiteralParser); }
WSDLParser parser = new WSDLParser(wsdlLocation); List operations = parser.getOperations(); String style = parser.getStyle(); PortType portType = parser.getPortType(op.getName()); String portTypeName = portType.getQName().getLocalPart();
@Test public void testGetOperations() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl")); List<Operation> operations = parser.getOperations(); assertEquals( "wrong number of operations found (wsdl may have changed)", 12, operations.size()); Operation op = operations.get(0); assertEquals("wrong name for first operation", "run_eGquery", op .getName()); assertEquals("wrong style", "document", parser.getStyle()); }
parser = new WSDLParser(wsdlLocation); } catch (Exception e) { ProcessorCreationException pce = new ProcessorCreationException( "http://schemas.xmlsoap.org/wsdl/soap/", new WSIFDynamicProvider_ApacheAxis()); Definition def = parser.getDefinition(); List inputs = parser.getOperationInputParameters(operationName); List outputs = parser.getOperationOutputParameters(operationName); setDescription(parser.getOperationDocumentation(operationName)); PortType portType = parser.getPortType(operationName); service = factory.getService(def, s, portType);
@Test public void testMissingStyleInBinding() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("SBWReader.wsdl")); assertEquals("Style should default to document if missing", "document", parser.getStyle()); }
@Test public void testGetUseLiteral() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl")); String use = parser.getUse("run_eInfo"); assertEquals("use should be literal", "literal", use); }
private VisitReport testStyleAndUse(String endpoint, WSDLParser parser, String operationName) throws UnknownOperationException { VisitReport report; String style = parser.getStyle().toLowerCase(); String use = "?"; use = parser.getUse(operationName).toLowerCase(); if (!checkStyleAndUse(style, use)) { report = new VisitReport(HealthCheck.getInstance(), activity, "Unsupported style", HealthCheck.UNSUPPORTED_STYLE, Status.SEVERE); report.setProperty("use", use); report.setProperty("style", style); report.setProperty("endpoint", endpoint); } else { report = new VisitReport(HealthCheck.getInstance(), activity, style + "/" + use + " is OK", HealthCheck.NO_PROBLEM, Status.OK); } return report; }
@Test public void testGetOperationNamespace() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("CurrencyExchangeService.wsdl")); String operationNamespace = parser.getOperationNamespaceURI("getRate"); assertEquals("operation namespace is wrong", "urn:xmethods-CurrencyExchange", operationNamespace); }
@Test public void testGetOperationElementQName2() throws Exception { URL tav744Url = getClass().getResource( "/net/sf/taverna/wsdl/parser/TAV-744/InstrumentService__.wsdl"); WSDLParser parser = new WSDLParser(tav744Url.toExternalForm()); QName operationQName = parser.getOperationQname("getList"); assertEquals("operation element name is wrong", "GetListRequest", operationQName.getLocalPart()); assertEquals("operation namespace is wrong", "http://InstrumentService.uniparthenope.it/InstrumentService", operationQName.getNamespaceURI()); } }
private void configurePorts() throws UnknownOperationException, IOException { List<TypeDescriptor> inputDescriptors = parser .getOperationInputParameters(configurationBean.getOperation().getOperationName()); List<TypeDescriptor> outputDescriptors = parser .getOperationOutputParameters(configurationBean.getOperation().getOperationName()); for (TypeDescriptor descriptor : inputDescriptors) { addInput(descriptor.getName(), descriptor.getDepth(), true, null, String.class); } isWsrfService = parser.isWsrfService(); if (isWsrfService) { // Make sure the port name is unique endpointReferenceInputPortName = ENDPOINT_REFERENCE; int counter = 0; while (Tools.getActivityInputPort(this, endpointReferenceInputPortName) != null) { endpointReferenceInputPortName = ENDPOINT_REFERENCE + counter++; } addInput(endpointReferenceInputPortName, 0, true, null, String.class); } for (TypeDescriptor descriptor : outputDescriptors) { addOutput(descriptor.getName(), descriptor.getDepth()); outputDepth.put(descriptor.getName(), Integer.valueOf(descriptor .getDepth())); } // add output for attachment list addOutput("attachmentList", 1); outputDepth.put("attachmentList", Integer.valueOf(1)); }
@Test public void testGetActionURI() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl")); String actionURI = parser.getSOAPActionURI("run_eInfo"); assertEquals("action uri is wrong", "einfo", actionURI); }
private void parseWSDL() throws ParserConfigurationException, WSDLException, IOException, SAXException, UnknownOperationException { URLConnection connection = null; try { URL wsdlURL = configurationBean.getOperation().getWsdl().toURL(); connection = wsdlURL.openConnection(); connection.setConnectTimeout(RemoteHealthChecker.getTimeoutInSeconds() * 1000); connection.connect(); } catch (MalformedURLException e) { throw new IOException("Malformed URL", e); } catch (SocketTimeoutException e) { throw new IOException("Timeout", e); } catch (IOException e) { throw e; } finally { if ((connection != null) && (connection.getInputStream() != null)) { connection.getInputStream().close(); } } parser = new WSDLParser(configurationBean.getOperation().getWsdl().toString()); }
public Map<String, TypeDescriptor> getTypeDescriptorsForInputPorts() throws UnknownOperationException, IOException { Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>(); List<TypeDescriptor> inputDescriptors = parser .getOperationInputParameters(configurationBean.getOperation().getOperationName()); for (TypeDescriptor descriptor : inputDescriptors) { descriptors.put(descriptor.getName(), descriptor); } return descriptors; }
@Override /** * Overridden to catch when a scavenger is removed from the tree (newParent = null). * This triggers the flushing of the WSDLParser cache. */ public void setParent(MutableTreeNode newParent) { super.setParent(newParent); if (newParent==null) { WSDLParser.flushCache(wsdlLocation); } }
@Override protected List<SOAPHeaderElement> makeSoapHeaders() { List<SOAPHeaderElement> soapHeaders = new ArrayList<SOAPHeaderElement>( super.makeSoapHeaders()); if (wsrfEndpointReference != null && getParser().isWsrfService()) { addEndpointReferenceHeaders(soapHeaders); } return soapHeaders; }