You need to sign in to do that
Don't have an account?
Web service callout failed
Hi All,
I am making a webservice call out with the below apex class.
//Generated by wsdl2apex
public class washout {
public class request_element {
public washout.notification notification;
private String[] notification_type_info = new String[]{'notification','urn:WashOut','notification','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'notification'};
}
public class notification_response_element {
public Boolean ack;
private String[] ack_type_info = new String[]{'ack','http://www.w3.org/2001/XMLSchema','boolean','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'ack'};
}
public class notification {
public washout.sObject_x sObject_x;
private String[] sObject_x_type_info = new String[]{'sObject','urn:WashOut','sObject','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'sObject_x'};
}
public class sObject_x {
public String id;
public Boolean isDeleted;
public String recordTypeId;
private String[] id_type_info = new String[]{'id','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] isDeleted_type_info = new String[]{'isDeleted','http://www.w3.org/2001/XMLSchema','boolean','1','1','false'};
private String[] recordTypeId_type_info = new String[]{'recordTypeId','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:WashOut','false','false'};
private String[] field_order_type_info = new String[]{'id','isDeleted','recordTypeId'};
}
public class salesforce_accounts_port {
public String endpoint_x = 'http://hq12.localtunnel.com/salesforce_accounts';
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[]{'urn:WashOut', 'washout'};
public Boolean notifications(washout.notification notification) {
washout.request_element request_x = new washout.request_element();
washout.notification_response_element response_x;
request_x.notification = notification;
Map<String, washout.notification_response_element> response_map_x = new Map<String, washout.notification_response_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'notifications',
'urn:WashOut',
'request',
'urn:WashOut',
'notification_response',
'washout.notification_response_element'}
);
response_x = response_map_x.get('response_x');
return response_x.ack;
}
}
}
But the response is not in the expected format and it is raising error
System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'urn:WashOut:notification_response' but found 'http://schemas.xmlsoap.org/soap/envelope/:notification_response'
When i check logs in developer console the callout response is
<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<notification_response>{"ack"=>"true"}</notification_response>
</Body>
</Envelope>
can any one help me on how to resolve this issue.
Thanks,
krishna59.
Test out your webservice using the below link first, make sure its working and you are getting desired results... and i guess you added the site to remote sites.. correct?
http://www.soapclient.com/soaptest.html
Hi BUSYBOY,
I have tested the webservice with the link you provided. Below is the response i got
Sai Krishna.