Search in sources :

Example 1 with Wsdl

use of org.pentaho.di.trans.steps.webservices.wsdl.Wsdl in project pentaho-kettle by pentaho.

the class WebServiceDialog method loadWebService.

private void loadWebService(String anURI) throws KettleException {
    anURI = transMeta.environmentSubstitute(anURI);
    try {
        if (wProxyHost.getText() != null && !"".equals(wProxyHost.getText())) {
            Properties systemProperties = System.getProperties();
            systemProperties.setProperty("http.proxyHost", transMeta.environmentSubstitute(wProxyHost.getText()));
            systemProperties.setProperty("http.proxyPort", transMeta.environmentSubstitute(wProxyPort.getText()));
        }
        wsdl = new Wsdl(new URI(anURI), null, null, wHttpLogin.getText(), wHttpPassword.getText());
    } catch (Exception e) {
        wsdl = null;
        new ErrorDialog(shell, BaseMessages.getString(PKG, "WebServiceDialog.ERROR0009.UnreachableURI"), BaseMessages.getString(PKG, "WebServiceDialog.ErrorDialog.Title") + anURI, e);
        log.logError(BaseMessages.getString(PKG, "WebServiceDialog.ErrorDialog.Title") + anURI, e.getMessage());
        return;
    }
    String text = wOperation.getText();
    wOperation.removeAll();
    if (wsdl != null) {
        List<WsdlOperation> listeOperations = wsdl.getOperations();
        Collections.sort(listeOperations, new Comparator<WsdlOperation>() {

            public int compare(WsdlOperation op1, WsdlOperation op2) {
                return op1.getOperationQName().getLocalPart().compareTo(op2.getOperationQName().getLocalPart());
            }
        });
        for (Iterator<WsdlOperation> itr = listeOperations.iterator(); itr.hasNext(); ) {
            WsdlOperation op = itr.next();
            wOperation.add(op.getOperationQName().getLocalPart());
            if (op.getOperationQName().getLocalPart().equals(text)) {
                wOperation.setText(text);
            }
        }
    }
}
Also used : WsdlOperation(org.pentaho.di.trans.steps.webservices.wsdl.WsdlOperation) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) Properties(java.util.Properties) Wsdl(org.pentaho.di.trans.steps.webservices.wsdl.Wsdl) URI(java.net.URI) KettleStepException(org.pentaho.di.core.exception.KettleStepException) KettleException(org.pentaho.di.core.exception.KettleException)

Example 2 with Wsdl

use of org.pentaho.di.trans.steps.webservices.wsdl.Wsdl in project pentaho-kettle by pentaho.

the class WebService method initWsdlEnv.

private void initWsdlEnv() throws KettleException {
    if (meta.equals(cachedMeta)) {
        return;
    }
    cachedMeta = meta;
    try {
        cachedWsdl = new Wsdl(new java.net.URI(data.realUrl), null, null, environmentSubstitute(meta.getHttpLogin()), Encr.decryptPasswordOptionallyEncrypted(environmentSubstitute(meta.getHttpPassword())));
    } catch (Exception e) {
        throw new KettleStepException(BaseMessages.getString(PKG, "WebServices.ERROR0013.ExceptionLoadingWSDL"), e);
    }
    cachedURLService = cachedWsdl.getServiceEndpoint();
    cachedHostConfiguration = HttpClientContext.create();
    cachedHttpClient = getHttpClient(cachedHostConfiguration);
    // Generate the XML to send over, determine the correct name for the request...
    // 
    cachedOperation = cachedWsdl.getOperation(meta.getOperationName());
    if (cachedOperation == null) {
        throw new KettleException(BaseMessages.getString(PKG, "WebServices.Exception.OperarationNotSupported", meta.getOperationName(), meta.getUrl()));
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) Wsdl(org.pentaho.di.trans.steps.webservices.wsdl.Wsdl) URISyntaxException(java.net.URISyntaxException) XMLStreamException(javax.xml.stream.XMLStreamException) ParseException(java.text.ParseException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) KettleException(org.pentaho.di.core.exception.KettleException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Aggregations

KettleException (org.pentaho.di.core.exception.KettleException)2 KettleStepException (org.pentaho.di.core.exception.KettleStepException)2 Wsdl (org.pentaho.di.trans.steps.webservices.wsdl.Wsdl)2 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 UnknownHostException (java.net.UnknownHostException)1 ParseException (java.text.ParseException)1 Properties (java.util.Properties)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 WsdlOperation (org.pentaho.di.trans.steps.webservices.wsdl.WsdlOperation)1 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)1