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
Pooja05Pooja05 

Web service callout failed

I am getting the following error when I callout a webservice.

 

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

 

I debugged in Execute Anonymous using the test code 


 

When I do this I get a com.sforce.ws.SoapFaultException.

 

Can anyone please help.

SuperfellSuperfell
You called a webservice and we're expecting to get a SOAP envelope back, but in fact got an HTML page back instead. Did you use a publicly reachable ip address and/or hostname for your service URL ?
Pooja05Pooja05

Is there any way I can figure out whether it is a publically reachable IP address.

 

Could it be because the webservice requires a user name and password and i am not providing any?

 

 

Pooja

Pooja05Pooja05

Apparently it is a publically reachable web service.

 

I am using an execute anonymous window to debug the web service

i get the following debug log. Can you please explain what is wrong?

 

DEBUG LOG
20090302202210.745:AnonymousBlock: line 1, column 1: Anonymous
20090302202210.745:AnonymousBlock: line 1, column 8: DeclareVar: public String endpoint_x
20090302202210.745:AnonymousBlock: line 1, column 8:     initial value: https://sapdev.thomsonreuters.com/sap/bc/srt/wsdl/bndg_49A58A0D49DA01F0E1008000A3E7533B/wsdl11/allinone/ws_policy/document?sap-client=280
20090302202210.745:AnonymousBlock: line 2, column 1: DeclareVar: sapComDocumentSapSoapFunctionsMcS.Z_SD_GET_CHARACT_WS_V01_TMP abc
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 3, column 8: Static initialization: sapComDocumentSapSoapFunctionsMcS
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 3, column 8: Entering user sharing mode
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 100, column 18: Exiting user sharing mode
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 64, column 18: Instance initialization: Z_SD_GET_CHARACT_WS_V01_TMP
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 64, column 18: Entering user sharing mode
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 65, column 16: DeclareVar: public String endpoint_x
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 65, column 16:     initial value: https://sapdev.thomsonreuters.com/sap/bc/srt/rfc/sap/z_sd_get_charact_ws_v01_tmp/280/z_sd_get_charact_ws_v01_tmp/z_sd_get_charact_ws_v01_tmp
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 66, column 20: DeclareVar: public MAP:String,String inputHttpHeaders_x
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 67, column 20: DeclareVar: public MAP:String,String outputHttpHeaders_x
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 68, column 16: DeclareVar: public String clientCert_x
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 69, column 16: DeclareVar: public String clientCertPasswd_x
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 70, column 16: DeclareVar: public Integer timeout_x
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 71, column 17: DeclareVar: private LIST:String ns_map_type_info
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 71, column 17:     initial value: (urn:sap-com:document:sap:soap:functions:mc-style, sapComDocumentSapSoapFunctionsMcS, urn:sap-com:document:sap:rfc:functions, sapComDocumentSapRfcFunctions)
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 71, column 17: Exiting user sharing mode
20090302202210.745:AnonymousBlock: line 2, column 1:     initial value: sapComDocumentSapSoapFunctionsMcS.Z_SD_GET_CHARACT_WS_V01_TMP:[clientCertPasswd_x=null, clientCert_x=null, endpoint_x=https://sapdev.thomsonreuters.com/sap/bc/srt/rfc/sap/z_sd_get_charact_ws_v01_tmp/280/z_sd_get_charact_ws_v01_tmp/z_sd_get_charact_ws_v01_tmp, inputHttpHeaders_x=null, ns_map_type_info=(urn:sap-com:document:sap:soap:functions:mc-style, sapComDocumentSapSoapFunctionsMcS, urn:sap-com:document:sap:rfc:functions, sapComDocumentSapRfcFunctions), outputHttpHeaders_x=null, timeout_x=null]
20090302202210.745:AnonymousBlock: line 3, column 1: sapComDocumentSapSoapFunctionsMcS.Z_SD_GET_CHARACT_WS_V01_TMP abc.inputHttpHeaders_x <= NewMap
20090302202210.745:AnonymousBlock: line 4, column 1: MAP:String,String.put(String, String)
20090302202210.745:AnonymousBlock: line 5, column 1: DeclareVar: sapComDocumentSapSoapFunctionsMcS.ZSdGetCharactWsV01Tmp_element request_x
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 94, column 18: Instance initialization: ZSdGetCharactWsV01Tmp_element
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 94, column 18: Entering user sharing mode
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 95, column 16: DeclareVar: public String IMaterial
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 96, column 17: DeclareVar: private LIST:String IMaterial_type_info
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 96, column 17:     initial value: (IMaterial, urn:sap-com:document:sap:rfc:functions, char18, 1, 1, false)
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 97, column 17: DeclareVar: private LIST:String apex_schema_type_info
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 97, column 17:     initial value: (urn:sap-com:document:sap:soap:functions:mc-style, false, true)
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 98, column 17: DeclareVar: private LIST:String field_order_type_info
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 98, column 17:     initial value: (IMaterial)
20090302202210.745:Class.sapComDocumentSapSoapFunctionsMcS: line 98, column 17: Exiting user sharing mode
20090302202210.745:AnonymousBlock: line 5, column 1:     initial value: sapComDocumentSapSoapFunctionsMcS.ZSdGetCharactWsV01Tmp_element:[IMaterial=null, IMaterial_type_info=(IMaterial, urn:sap-com:document:sap:rfc:functions, char18, 1, 1, false), apex_schema_type_info=(urn:sap-com:document:sap:soap:functions:mc-style, false, true), field_order_type_info=(IMaterial)]
20090302202210.745:AnonymousBlock: line 6, column 13: DeclareVar: sapComDocumentSapSoapFunctionsMcS.ZSdGetCharactWsV01TmpResponse_element response_x
20090302202210.745:AnonymousBlock: line 7, column 13: sapComDocumentSapSoapFunctionsMcS.ZSdGetCharactWsV01Tmp_element request_x.IMaterial <= Literal
20090302202210.745:AnonymousBlock: line 8, column 17: DeclareVar: MAP:String,sapComDocumentSapSoapFunctionsMcS.ZSdGetCharactWsV01TmpResponse_element response_map_x
20090302202210.745:AnonymousBlock: line 8, column 17:     initial value: {}
20090302202210.745:AnonymousBlock: line 9, column 13: MAP:String,sapComDocumentSapSoapFunctionsMcS.ZSdGetCharactWsV01TmpResponse_element.put(String, sapComDocumentSapSoapFunctionsMcS.ZSdGetCharactWsV01TmpResponse_element)
20090302202210.745:AnonymousBlock: line 10, column 1: WebServiceCallout.invoke(sapComDocumentSapSoapFunctionsMcS.Z_SD_GET_CHARACT_WS_V01_TMP, sapComDocumentSapSoapFunctionsMcS.ZSdGetCharactWsV01Tmp_element, MAP:String,sapComDocumentSapSoapFunctionsMcS.ZSdGetCharactWsV01TmpResponse_element, LIST:String)
20090302202210.745:AnonymousBlock: line 10, column 1:     Created Web Service callout to endpoint: https://xxxxxxxxxx/sap/bc/srt/wsdl/bndg_49A58A0D49DA01F0E1008000A3E7533B/wsdl11/allinone/ws_policy/document?sap-client=280
System.Exception: Got an unexpected error in callout : null. Contact support with error ID: 1796689214-1041 (1244934409)

AnonymousBlock: line 10, column 1


Cumulative resource usage:

Resource usage for namespace: (default)
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 10000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 100
Number of DML rows: 0 out of 10000
Number of script statements: 21 out of 200000
Maximum heap size: 0 out of 1000000
Number of callouts: 1 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 10
Number of record type describes: 0 out of 10
Number of child relationships describes: 0 out of 10
Number of picklist describes: 0 out of 10
Number of future calls: 0 out of 10
Number of find similar calls: 0 out of 10
Number of System.runAs() invocations: 0 out of 0

Total email recipients queued to be sent : 0
Static variables and sizes:
abc:379
endpoint_x:137
request_x:206
response_map_x:18

Stack frame variables and sizes:
  Frame0

Cumulative profiling information:

No profiling information for SOQL operations.

No profiling information for SOSL operations.

No profiling information for DML operations.

No profiling information for method invocations.

 

Thanks,

Pooja

kvinkvin

Did you figure out whats the issue is with..Can you please post the solution.... thank you

jayalajayala

Pooja i have the similar problem where in i have webservice and not publically reachable end point and have to give user name and password i am not aware of how prove these credentials in the Apex code. Any help is appreciated.