You need to sign in to do that
Don't have an account?
Spector
External webcall SOAP header not being set.
Hello,
Currently the proxy code generated by the wsdl2apex utility is behaving badly in regard to SOAP headers. From the documentation, it is said that these headers are supported via the public fields generated in the SOAP proxy class. I have no problem when using these headers to call out to my service. The problem however is that the proxy class does NOT read the headers passed back from the remote call and populate these fields. See code below:
The problem:
EXTAPI.EXTAPISoap stub = new EXTAPI.EXTAPISoap();
stub.Login();
// this is not set, even though the SOAP header DOES exist in the XML passed back
stub.MFResponseHeader == null; <-- This value should not be null!
Any help at all would be greatly appreciated.
Here is my proxy class:
//Generated by wsdl2apex public class EXTAPI { public static testMethod void Test() { EXTAPISoap service = new EXTAPISoap(); service.MFAuthHeader = new MFAuthHeader(); service.Login(); } public class Login_element { private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{}; } public class EXTAPISoap { public String endpoint_x = <address omitted>; public EXTAPI.MFAuthHeader MFAuthHeader; public EXTAPI.MFResponseHeader MFResponseHeader; private String MFAuthHeader_hns = 'MFAuthHeader=http://tempuri.org/'; private String MFResponseHeader_hns = 'MFResponseHeader=http://tempuri.org/'; private String[] ns_map_type_info = new String[]{'http://tempuri.org/', 'EXTAPI'}; public EXTAPI.EXTForm GetForm(String formID) { EXTAPI.GetForm_element request_x = new EXTAPI.GetForm_element(); EXTAPI.GetFormResponse_element response_x; request_x.formID = formID; Map<String, EXTAPI.GetFormResponse_element> response_map_x = new Map<String, EXTAPI.GetFormResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, 'http://tempuri.org/GetForm', 'http://tempuri.org/', 'GetForm', 'http://tempuri.org/', 'GetFormResponse', 'EXTAPI.GetFormResponse_element'} ); response_x = response_map_x.get('response_x'); return response_x.GetFormResult; } public void ProcessForm(EXTAPI.EXTForm form) { EXTAPI.ProcessForm_element request_x = new EXTAPI.ProcessForm_element(); EXTAPI.ProcessFormResponse_element response_x; request_x.form = form; Map<String, EXTAPI.ProcessFormResponse_element> response_map_x = new Map<String, EXTAPI.ProcessFormResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, 'http://tempuri.org/ProcessForm', 'http://tempuri.org/', 'ProcessForm', 'http://tempuri.org/', 'ProcessFormResponse', 'EXTAPI.ProcessFormResponse_element'} ); response_x = response_map_x.get('response_x'); } public void Login() { EXTAPI.Login_element request_x = new EXTAPI.Login_element(); EXTAPI.LoginResponse_element response_x; Map<String, EXTAPI.LoginResponse_element> response_map_x = new Map<String, EXTAPI.LoginResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, 'http://tempuri.org/Login', 'http://tempuri.org/', 'Login', 'http://tempuri.org/', 'LoginResponse', 'EXTAPI.LoginResponse_element'} ); response_x = response_map_x.get('response_x'); } } public class EXTForm { public String FormID; public String FormHeader; public EXTAPI.ArrayOfEXTFormElement elements; private String[] FormID_type_info = new String[]{'FormID','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] FormHeader_type_info = new String[]{'FormHeader','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] elements_type_info = new String[]{'elements','http://tempuri.org/','ArrayOfEXTFormElement','0','1','false'}; private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{'FormID','FormHeader','elements'}; } public class LoginResponse_element { private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{}; } public class MFAuthHeader { public String EXTID; public String EXTAccountID; public String EXTUserID; public String EXTUserName; public String EXTUserEmail; public String EXTSessionID; public String EXTServerLocation; public String MFSessID; public String MFDomainName; private String[] EXTID_type_info = new String[]{'EXTID','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] EXTAccountID_type_info = new String[]{'EXTAccountID','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] EXTUserID_type_info = new String[]{'EXTUserID','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] EXTUserName_type_info = new String[]{'EXTUserName','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] EXTUserEmail_type_info = new String[]{'EXTUserEmail','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] EXTSessionID_type_info = new String[]{'EXTSessionID','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] EXTServerLocation_type_info = new String[]{'EXTServerLocation','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] MFSessID_type_info = new String[]{'MFSessID','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] MFDomainName_type_info = new String[]{'MFDomainName','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{'EXTID','EXTAccountID','EXTUserID','EXTUserName','EXTUserEmail','EXTSessionID','EXTServerLocation','MFSessID','MFDomainName'}; } public class EXTFormElement { public String Type_x; public String Layout; public String Caption; public String Value; public String Name; public Boolean IsPassword; public EXTAPI.ArrayOfEXTFormElement Options; private String[] Type_x_type_info = new String[]{'Type','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] Layout_type_info = new String[]{'Layout','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] Caption_type_info = new String[]{'Caption','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] Value_type_info = new String[]{'Value','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] Name_type_info = new String[]{'Name','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] IsPassword_type_info = new String[]{'IsPassword','http://www.w3.org/2001/XMLSchema','boolean','1','1','false'}; private String[] Options_type_info = new String[]{'Options','http://tempuri.org/','ArrayOfEXTFormElement','0','1','false'}; private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{'Type_x','Layout','Caption','Value','Name','IsPassword','Options'}; } public class ProcessFormResponse_element { private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{}; } public class GetFormResponse_element { public EXTAPI.EXTForm GetFormResult; private String[] GetFormResult_type_info = new String[]{'GetFormResult','http://tempuri.org/','EXTForm','0','1','false'}; private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{'GetFormResult'}; } public class MFResponseHeader { public String ResponseCode; public String ErrorMessage; public String ErrorHTML; public String StackTrace; public Integer ErrorCode; private String[] ResponseCode_type_info = new String[]{'ResponseCode','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] ErrorMessage_type_info = new String[]{'ErrorMessage','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] ErrorHTML_type_info = new String[]{'ErrorHTML','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] StackTrace_type_info = new String[]{'StackTrace','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] ErrorCode_type_info = new String[]{'ErrorCode','http://www.w3.org/2001/XMLSchema','int','1','1','false'}; private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{'ResponseCode','ErrorMessage','ErrorHTML','StackTrace','ErrorCode'}; } public class GetForm_element { public String formID; private String[] formID_type_info = new String[]{'formID','http://www.w3.org/2001/XMLSchema','string','0','1','false'}; private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{'formID'}; } public class ArrayOfEXTFormElement { public EXTAPI.EXTFormElement[] EXTFormElement; private String[] EXTFormElement_type_info = new String[]{'EXTFormElement','http://tempuri.org/','EXTFormElement','0','-1','true'}; private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{'EXTFormElement'}; } public class ProcessForm_element { public EXTAPI.EXTForm form; private String[] form_type_info = new String[]{'form','http://tempuri.org/','EXTForm','0','1','false'}; private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'}; private String[] field_order_type_info = new String[]{'form'}; } }
Certainly! Here is the raw xml response message...
I will file a bug. In case you contact support, use bug id: #188151
Do you have control over the service? Can you change
the service to return login result in soap body? Or as HTTP headers?
get updated to the latest? You will also have to regenerate the stub (wsdl2apex) after the
upgrade.
I dont think there is an easy way to workaround the parsing problem.
Some of the instance are upgraded to summar 08 last week. Rest will be
upgraded this week.
Go to setup > develop > api > download
If the wsdl endpoint ends with 12.0 you are still on older vesion.
If it is 13.0 then you are on summer 08.
https://www.salesforce.com/services/Soap/c/13.0
I'm on na2. I also have another account on na5. It appears that both instances are still using 12.0. Is there anyway to request to be upgraded to the updated instances?
Thanks again,
Spector