function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AnkurItengAnkurIteng 

'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':html'

hello Experts,

 

I m facing same problem. Please help me out

 

Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'

 

Thank in advance.

roubrooroubroo

Any luck with this? We have WS callouts that were working before but have stopped since Apri;  2012

Jerun JoseJerun Jose

This happens when the target system doesnt return a proper response XML. The reasons could be many, one common reason is the endpoint could not be found or is busy.

 

To get more info, I would suggest you change the callout from using webservicecallout.invoke methods to use the HTTPRequest and HTTPResponse objects. Use these methods to make a HTTP Post callout with the SOAP envelope in your message body. You can then anaylse the response code to see how well the callout fared.

bakul.patelbakul.patel

Any idea why this could happen?

 

System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found 'http://www.w3.org/2003/05/soap-envelope:Envelope'


Actually, I wasn't able to import the wsdl file as it was. Salesforce was complaining about multi-part wsdl messages. I had to update wsdl to have only single part messages. Then the wsdl was imported.

Jerun JoseJerun Jose
I believe this is because the namespaces defined in the wsdl autogenerated class are not having a different namespace definition that what is got in the response.

You can try editing the wsdl apex class to modify the namespace defined for the response element. However, I am wondering how the namespaces were switched in the beginning. If the WSDL defined the response element namespace properly, then WSDL 2 Apex should put in the namespaces correctly (atleast I hope so). Can you try making the callout in SOAP UI tool?
riffindusriffindus

Hi Jerun,

 

I am facing the same situation. SOAP UI request is giving proper response but if called from SF it is giving me this HTMl error.

 

Any solution?

Jerun JoseJerun Jose

Again, try to use the HTTPRequest and HTTPResponse classes to send a request to the endpoint. Check the response to see what was returned to figure out what the problem is.

c_sramakc_sramak

Hi All,

 

Were you able to resolve this issue? Im getting the same exception on combining the two wsdl's into one.

Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found 'http://www.w3.org/2003/05/soap-envelope:Envelope'

 

Thanks,

Sandeep

ProJules1ProJules1

Some points to consider:

 

1. You can try to modify wsdl before parsing it. if I am not mistaken any wsdl prepared in conjunction of SOAP 1.2 will fail parsing as SFDC does not support SOAP 1.2 yet. I may be wrong, please check latest support.

2. Use HTTPRequest objects and build request XML in apex to send request. I mean do not use the generated classes

3. This error may be because the response xml is not correct, due to error thrown in the external application.

 

Bakul