Calling webservice with NTLM authentication and getting error 'System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'' I am able to access the webservice through browser but not through apex.

  • 2
    Your Apex Code is expecting a SOAP message, but the server is returning a HTML page. The server has to be able to speak SOAP in order to communicate through that interface. Maybe you meant to use the REST interface instead?
    – sfdcfox
    Jul 24 '13 at 16:36

Perhaps the authentication is failing and the page is returning HTML as an "error" page.

Update your question with more details - how did you upload your WSDL? Have you used SoapUI to test your callouts and review the results?

This is what I do before I try to debug my SOAP callouts on the Salesforce APEX environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.