{"record":{"id":"e5d9f34450303d8a","repo":"pentaho/pentaho-kettle","slug":"port-portname-is-not-defined-in-the-service-serviceqname","errorCode":null,"errorMessage":"Port:  + portName +  is not defined in the service:  + serviceQName","messagePattern":"Port:  \\+ portName \\+  is not defined in the service:  \\+ serviceQName","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/webservices/wsdl/Wsdl.java","lineNumber":101,"sourceCode":"    } catch ( KettleException e ) {\n      throw new RuntimeException( \"Could not load WSDL file: \" + e.getMessage(), e );\n    }\n    if ( serviceQName == null ) {\n      _service = (Service) _wsdlDefinition.getServices().values().iterator().next();\n    } else {\n      _service = _wsdlDefinition.getService( serviceQName );\n      if ( _service == null ) {\n        throw new IllegalArgumentException( \"Service: \"\n          + serviceQName + \" is not defined in the WSDL file \" + wsdlURI );\n      }\n    }\n\n    if ( portName == null ) {\n      _port = getSoapPort( _service.getPorts().values() );\n    } else {\n      _port = _service.getPort( portName );\n      if ( _port == null ) {\n        throw new IllegalArgumentException( \"Port: \"\n          + portName + \" is not defined in the service: \" + serviceQName );\n      } else {\n        _port = _service.getPort( portName );\n      }\n    }\n\n    _wsdlTypes = new WsdlTypes( _wsdlDefinition );\n    _operationCache = new HashMap<String, WsdlOperation>();\n  }\n\n  /**\n   * Returns the first Soap port from the passed collection of Ports.\n   *\n   * @param portCollection\n   * @return\n   */\n  private Port getSoapPort( Collection<?> portCollection ) {\n    Port soapPort = null;","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/webservices/wsdl/Wsdl.java#L83-L119","documentation":"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.","triggerScenarios":"new Wsdl(wsdlURI, username, password, serviceQName, portName, ...) with a portName that does not appear under the resolved service's <port> elements.","commonSituations":"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.","solutions":["Copy the exact <port name> value from the relevant <service> block of the WSDL","If unsure, pass null for portName so the first SOAP port is auto-selected via getSoapPort","Re-load the WSDL in the transform after server-side changes and re-pick the port","Confirm the port is a SOAP binding port, not just any port"],"exampleFix":"// before\nWsdl wsdl = new Wsdl(uri, user, pass, svcQName, \"OldPort\");\n// after\nWsdl wsdl = new Wsdl(uri, user, pass, svcQName, \"Soap11Port\"); // exact name from WSDL <port name=...>","handlingStrategy":"validation","validationCode":"javax.wsdl.Definition d = WSDLFactory.newInstance().newWSDLReader().readWSDL(wsdlUrl);\nService s = d.getService(serviceQName);\nif (s == null || s.getPort(portName) == null)\n  throw new IllegalArgumentException(\"Unknown port \" + portName + \"; available: \" + s.getPorts().keySet());","typeGuard":null,"tryCatchPattern":"try {\n  Wsdl wsdl = new Wsdl(uri, user, pass, serviceQName, portName);\n} catch (IllegalArgumentException e) {\n  logError(\"Port mismatch: \" + e.getMessage());\n  throw e;\n}","preventionTips":["Pick the port name from the WSDL's <service><port> list, not from memory","Pass null portName to let getSoapPort auto-select the first SOAP port","Verify the selected port has a SOAP binding (soap:address present)","Re-validate port names after every WSDL version bump"],"tags":["wsdl","qname","configuration","webservices"],"backgroundTag":"entity-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}