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
gprasunagprasuna 

Calling External Webservice from Visualforce Page

Hi,

 

I am calling an external webservice from a button in a visualforce page. I am passing a parameter, and i am getting this error:

 

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

 

This is my Controller:

public class WSContoller { String output; String input = 'detroit'; public void getRecord() { NhlserviceWS.NHLService stub = new NhlserviceWS.NHLService(); output= stub.getCurrentPosition(input); } public String getOutput() { return output; } }

This is wsdl2apex code which was generated:

//Generated by wsdl2apex public class NhlserviceWS { public class NHLService { public String endpoint_x = 'http://vb20:8410/axis2/NHLService.jws'; public Map<String,String> inputHttpHeaders_x; public Map<String,String> outputHttpHeaders_x; public String clientCert_x; public String clientCertPasswd_x; public Integer timeout_x; private String[] ns_map_type_info = new String[]{'http://vb20:8410/axis2/NHLService.jws', 'NhlserviceWS'}; public String getCurrentPosition(String input) { NhlserviceWS.getCurrentPosition_element request_x = new NhlserviceWS.getCurrentPosition_element(); NhlserviceWS.getCurrentPositionResponse_element response_x; request_x.input = input; Map<String, NhlserviceWS.getCurrentPositionResponse_element> response_map_x = new Map<String, NhlserviceWS.getCurrentPositionResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, '', 'http://vb20:8410/axis2/NHLService.jws', 'getCurrentPosition', 'http://vb20:8410/axis2/NHLService.jws', 'getCurrentPositionResponse', 'NhlserviceWS.getCurrentPositionResponse_element'} ); response_x = response_map_x.get('response_x'); return response_x.getCurrentPositionResult; } } public class getCurrentPositionResponse_element { public String getCurrentPositionResult; private String[] getCurrentPositionResult_type_info = new String[]{'getCurrentPositionResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] apex_schema_type_info = new String[]{'http://vb20:8410/axis2/NHLService.jws','true','false'}; private String[] field_order_type_info = new String[]{'getCurrentPositionResult'}; } public class getCurrentPosition_element { public String input; private String[] input_type_info = new String[]{'input','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] apex_schema_type_info = new String[]{'http://vb20:8410/axis2/NHLService.jws','true','false'}; private String[] field_order_type_info = new String[]{'input'}; } }

Can anyone please help me in this.

 

Thanks,

prasuna.

Ron HessRon Hess

the service you are trying to reach must be a public service, but when i tried to access it , i just timed out.

 

from the error message it looks like this service is not returning SOAP, but rather HTML 

 

what do you get if you just try to open 

 

http://vb20:8410/axis2/NHLService.jws