You need to sign in to do that
Don't have an account?
Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'
I got an error: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML"
Can anyone tell me how I can generate some test code in Execute Anonymous to troubleshoot the following Callout SOAP request and response. The callout logic is very simple and it's about celsius to farenheit conversion.
//Generated by wsdl2apex
public class ConverterWS {
public class ConverterHttpSoap11Endpoint {
public String endpoint_x = 'http://localhost:8080/Axis2WSTest/services/Converter.ConverterHttpSoap11Endpoint/';
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public String clientCertName_x;
public String clientCert_x;
public String clientCertPasswd_x;
public Integer timeout_x;
private String[] ns_map_type_info = new String[]{'http://wtp', 'ConverterWS'};
public Double celsiusToFarenheit(Double celsius) {
ConverterWS.celsiusToFarenheit_element request_x = new ConverterWS.celsiusToFarenheit_element();
ConverterWS.celsiusToFarenheitResponse_element response_x;
request_x.celsius = celsius;
Map<String, ConverterWS.celsiusToFarenheitResponse_element> response_map_x = new Map<String, ConverterWS.celsiusToFarenheitResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'urn:celsiusToFarenheit',
'http://wtp',
'celsiusToFarenheit',
'http://wtp',
'celsiusToFarenheitResponse',
'ConverterWS.celsiusToFarenheitResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.return_x;
}
public Double farenheitToCelsius(Double farenheit) {
ConverterWS.farenheitToCelsius_element request_x = new ConverterWS.farenheitToCelsius_element();
ConverterWS.farenheitToCelsiusResponse_element response_x;
request_x.farenheit = farenheit;
Map<String, ConverterWS.farenheitToCelsiusResponse_element> response_map_x = new Map<String, ConverterWS.farenheitToCelsiusResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'urn:farenheitToCelsius',
'http://wtp',
'farenheitToCelsius',
'http://wtp',
'farenheitToCelsiusResponse',
'ConverterWS.farenheitToCelsiusResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.return_x;
}
}
public class celsiusToFarenheit_element {
public Double celsius;
private String[] celsius_type_info = new String[]{'celsius','http://www.w3.org/2001/XMLSchema','float','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://wtp','true','true'};
private String[] field_order_type_info = new String[]{'celsius'};
}
public class celsiusToFarenheitResponse_element {
public Double return_x;
private String[] return_x_type_info = new String[]{'return','http://www.w3.org/2001/XMLSchema','float','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://wtp','true','true'};
private String[] field_order_type_info = new String[]{'return_x'};
}
public class farenheitToCelsiusResponse_element {
public Double return_x;
private String[] return_x_type_info = new String[]{'return','http://www.w3.org/2001/XMLSchema','float','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://wtp','true','true'};
private String[] field_order_type_info = new String[]{'return_x'};
}
public class farenheitToCelsius_element {
public Double farenheit;
private String[] farenheit_type_info = new String[]{'farenheit','http://www.w3.org/2001/XMLSchema','float','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://wtp','true','true'};
private String[] field_order_type_info = new String[]{'farenheit'};
}
}
Hi,
I have seen this error, couple of times during my development cycle.
The most likely cause of the error , is the webservice that you are trying to call is throwing an exception.
Its most likely a webservice built using .NET framework.
Also the end point url, seems to be incorrect, its pointing to localhost, it should have the server IP or name.
http://localhost:8080/Axis2WSTest/services/Conver
ter.ConverterHttpSoap11Endpoint
I have changed the localhost to actual IP but still the same error message.
I published this web service from one of my Java Dynamic Web Projects.
If I want to monitor the SOAP request and response by using Eclipse's Execute Anonymous, can you give me some sample code of writing the test program by using the code I have posted?
Thanks,
Hi,
Can you invoke the webservice externally, using SOAP UI tool.
I believe the problem is not with the SFDC code, but with the webservice configuration,Its either not being fully exposed to the or its always returning an exception.
IF the webservice is being called, externally it should be callable with Apex code.
Hi Baseball,
Did you get any solution for your issue. Even i am gettting same error. But when i request using SOAP UI. it is giving response properly.
Line: 67, Column: 1
System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found 'http://schemas.xmlsoap.org/wsdl/:definitions'