You need to sign in to do that
Don't have an account?

can't get my wrapper for my webservice to work
I am trying to cummunicate with a external webservice, but i can't get my wrapper class to work!
i think it has to do something with the return values... there are 3 return elements...!?
i want to call the NewAccount operation...
could anybody tell me how to write the wrapper for this wsdl?
THIS IS THE WSDL
//Generated by wsdl2apex
public class soapserver_MS_SFService {
public class NewAccount {
public Integer errorCode;
public String errorMessage;
public Integer mskey;
public Integer relatiecode;
private String[] errorCode_type_info = new String[]{'errorCode','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
private String[] errorMessage_type_info = new String[]{'errorMessage','http://www.w3.org/2001/XMLSchema','string','1','1','true'};
private String[] mskey_type_info = new String[]{'mskey','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
private String[] relatiecode_type_info = new String[]{'relatiecode','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
private String[] apex_schema_type_info = new String[]{'http://soapserver.jsm.marktselect.com','true'};
private String[] field_order_type_info = new String[]{'errorCode','errorMessage','mskey','relatiecode'};
}
public class NewAccountResponse_element {
public soapserver_MS_SFService.NewAccount[] NewAccountReturn;
private String[] NewAccountReturn_type_info = new String[]{'NewAccountReturn','http://soapserver.jsm.marktselect.com','NewAccount','1','-1','false'};
private String[] apex_schema_type_info = new String[]{'http://soapserver.jsm.marktselect.com','true'};
private String[] field_order_type_info = new String[]{'NewAccountReturn'};
}
public class NewAccount_element {
public String UserId;
public String UserPw;
public Integer Mskey;
private String[] UserId_type_info = new String[]{'UserId','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] UserPw_type_info = new String[]{'UserPw','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] Mskey_type_info = new String[]{'Mskey','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
private String[] apex_schema_type_info = new String[]{'http://soapserver.jsm.marktselect.com','true'};
private String[] field_order_type_info = new String[]{'UserId','UserPw','Mskey'};
}
public class SalesForceService_EnterpriceServicePort {
public String endpoint_x = 'http://193.67.5.194/cgi-bin/jsmdirect?SFservice';
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public String clientCert_x;
public String clientCertPasswd_x;
private String[] ns_map_type_info = new String[]{'http://soapserver.jsm.marktselect.com', 'soapserver_MS_SFService'};
public soapserver_MS_SFService.NewAccount[] NewAccount(String UserId,String UserPw,Integer Mskey) {
soapserver_MS_SFService.NewAccount_element request_x = new soapserver_MS_SFService.NewAccount_element();
soapserver_MS_SFService.NewAccountResponse_element response_x;
request_x.UserId = UserId;
request_x.UserPw = UserPw;
request_x.Mskey = Mskey;
Map<String, soapserver_MS_SFService.NewAccountResponse_element> response_map_x = new Map<String, soapserver_MS_SFService.NewAccountResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'NewAccount',
'http://soapserver.jsm.marktselect.com',
'NewAccount',
'http://soapserver.jsm.marktselect.com',
'NewAccountResponse',
'soapserver_MS_SFService.NewAccountResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.NewAccountReturn;
}
}
}
THIS IS MY WRAPPER
error=
Compile Error: Return value must be of type: String at line 6 column 9 |
global class TestCallOut {
WebService static string LoadRlcode(string a, string b, integer mskey) {
soapserver_MS_SFService.SalesForceService_EnterpriceServicePort soap =
new soapserver_MS_SFService.SalesForceService_EnterpriceServicePort();
return soap.NewAccount(a, b, mskey);
}
}
You declare that the consuming method returns a string
WebService static string LoadRlcode(string a, string b, integer mskey)
but what you acutally return is not a string but, you return a "soapserver_MS_SFService.NewAccount[]".
Try this
global class TestCallOut { WebService static void LoadRlcode(string a, string b, integer mskey) { soapserver_MS_SFService.SalesForceService_EnterpriceServicePort soap = new soapserver_MS_SFService.SalesForceService_EnterpriceServicePort(); soapserver_MS_SFService.NewAccount[] accountArray = soap.NewAccount(a, b, mskey); } }