pentaho/pentaho-kettle · error · IllegalArgumentException

Port: + portName + is not defined in the service: +…

Error message

Port:  + portName +  is not defined in the service:  + serviceQName

What it means

Guard in the Wsdl constructor: the requested port name is not defined in the selected service of the parsed WSDL. After the service was resolved (explicitly or by taking the first one), no port matched the given portName, so no SOAP port can be bound.

Solutions

  1. Copy the exact <port name> value from the relevant <service> block of the WSDL
  2. If unsure, pass null for portName so the first SOAP port is auto-selected via getSoapPort
  3. Re-load the WSDL in the transform after server-side changes and re-pick the port
  4. Confirm the port is a SOAP binding port, not just any port

Example fix

// before
Wsdl wsdl = new Wsdl(uri, user, pass, svcQName, "OldPort");
// after
Wsdl wsdl = new Wsdl(uri, user, pass, svcQName, "Soap11Port"); // exact name from WSDL <port name=...>
Defensive patterns

Strategy: validation

Validate before calling

javax.wsdl.Definition d = WSDLFactory.newInstance().newWSDLReader().readWSDL(wsdlUrl);
Service s = d.getService(serviceQName);
if (s == null || s.getPort(portName) == null)
  throw new IllegalArgumentException("Unknown port " + portName + "; available: " + s.getPorts().keySet());

Try / catch

try {
  Wsdl wsdl = new Wsdl(uri, user, pass, serviceQName, portName);
} catch (IllegalArgumentException e) {
  logError("Port mismatch: " + e.getMessage());
  throw e;
}

Prevention

When it happens

Trigger: new Wsdl(wsdlURI, username, password, serviceQName, portName, ...) with a portName that does not appear under the resolved service's <port> elements.

Common situations: Port renamed in a new WSDL version; specifying a SOAP 1.2 port name where only a SOAP 1.1 port exists (or vice versa); typo/extra whitespace in the port name in transform settings.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/e5d9f34450303d8a. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/webservices/wsdl/Wsdl.java:101

    } catch ( KettleException e ) {
      throw new RuntimeException( "Could not load WSDL file: " + e.getMessage(), e );
    }
    if ( serviceQName == null ) {
      _service = (Service) _wsdlDefinition.getServices().values().iterator().next();
    } else {
      _service = _wsdlDefinition.getService( serviceQName );
      if ( _service == null ) {
        throw new IllegalArgumentException( "Service: "
          + serviceQName + " is not defined in the WSDL file " + wsdlURI );
      }
    }

    if ( portName == null ) {
      _port = getSoapPort( _service.getPorts().values() );
    } else {
      _port = _service.getPort( portName );
      if ( _port == null ) {
        throw new IllegalArgumentException( "Port: "
          + portName + " is not defined in the service: " + serviceQName );
      } else {
        _port = _service.getPort( portName );
      }
    }

    _wsdlTypes = new WsdlTypes( _wsdlDefinition );
    _operationCache = new HashMap<String, WsdlOperation>();
  }

  /**
   * Returns the first Soap port from the passed collection of Ports.
   *
   * @param portCollection
   * @return
   */
  private Port getSoapPort( Collection<?> portCollection ) {
    Port soapPort = null;

View on GitHub (pinned to f3058517a1)