{"record":{"id":"6e63b1dfc0b3c1ad","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-document","errorCode":null,"errorMessage":"Unable to get document.","messagePattern":"Unable to get document\\.","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"critical","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/webservices/wsdl/Wsdl.java","lineNumber":373,"sourceCode":"   * @return wsdl Definition\n   * @throws WSDLException\n   *           on error.\n   */\n  private Definition parse( URI wsdlURI, String username, String password ) throws WSDLException, KettleException,\n    AuthenticationException {\n    WSDLReader wsdlReader = getReader();\n    return readWsdl( wsdlReader, wsdlURI.toString(), username, password );\n  }\n\n  private Definition readWsdl( WSDLReader wsdlReader, String uri, String username, String password ) throws WSDLException, KettleException, AuthenticationException {\n\n    try {\n      HTTPProtocol http = new HTTPProtocol();\n      Document doc = XMLHandler.loadXMLString( http.get( wsdlURI.toString(), username, password ), true, false );\n      if ( doc != null ) {\n        return ( wsdlReader.readWSDL( doc.getBaseURI(), doc ) );\n      } else {\n        throw new KettleException( \"Unable to get document.\" );\n      }\n    } catch ( MalformedURLException mue ) {\n      throw new KettleException( mue );\n    } catch ( AuthenticationException ae ) {\n      // re-throw this. If not IOException seems to catch it\n      throw ae;\n    } catch ( IOException ioe ) {\n      throw new KettleException( ioe );\n    }\n  }\n\n  /**\n   * Returns this objects WSDL types.\n   *\n   * @return WsdlTepes\n   */\n  public WsdlTypes getWsdlTypes() {\n    return this._wsdlTypes;","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/webservices/wsdl/Wsdl.java#L355-L391","documentation":"During Wsdl.readWsdl() (invoked from Wsdl.parse()), the WSDL document is fetched over HTTP via HTTPProtocol.get() and parsed with XMLHandler.loadXMLString. If the HTTP fetch succeeds but the returned string does not parse into a Document (doc == null), a KettleException 'Unable to get document.' is thrown because there is nothing to feed to the wsdl4j WSDLReader.","triggerScenarios":"Calling new Wsdl(wsdlURI, username, password, serviceQName) where the HTTP response body yields null after XML parsing — e.g., an empty body, or the server returning an HTML error/login page that XMLHandler refuses to load as XML.","commonSituations":"The WSDL URL points to a portal login redirect instead of the raw WSDL; the server returns 200 with an empty body; a proxy or firewall intercepts the request; the URL is mistyped and returns a generic HTML 404 page; credentials are wrong and the server returns an HTML challenge.","solutions":["Paste the WSDL URL into a browser or curl to confirm it returns actual XML (<definitions>...), not HTML or an empty body.","Verify username/password — an HTML-form or 401 challenge page will not parse as a WSDL document.","Correct the wsdlURI; a mistyped host/path often yields an HTML error page.","Check proxy/firewall settings so the HTTP request reaches the service host and returns the real WSDL."],"exampleFix":"// before\nWsdl wsdl = new Wsdl(new URI(\"http://host/services?wsdl\"), user, pass, svcQName);\n// after — verify the URL returns XML first\n// curl -u user:pass http://host/services?wsdl | head   → must start with <?xml / <wsdl:definitions>\nWsdl wsdl = new Wsdl(new URI(\"http://host/services?wsdl\"), user, pass, svcQName);","handlingStrategy":"try-catch","validationCode":"// Check the WSDL URL returns XML before constructing Wsdl\nString body = new HTTPProtocol().get(wsdlUrl, user, pass);\nif (body == null || body.trim().isEmpty() || !body.contains(\"<definitions\")) {\n  throw new IllegalStateException(\"URL did not return a WSDL document: \" + wsdlUrl);\n}","typeGuard":null,"tryCatchPattern":"try {\n  wsdl = new Wsdl(wsdlURI, username, password, serviceQName);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Unable to get document\")) {\n    logError(\"WSDL URL returned no parseable XML — check URL, credentials, proxy: \" + wsdlURI, e);\n  }\n  throw e;\n}","preventionTips":["curl the ?wsdl URL before wiring it into the step","Watch for HTML login/error pages returned with HTTP 200","Verify proxy and credentials early"],"tags":["wsdl","network","http","xml-parsing"],"backgroundTag":"http-request-failed","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"}