I Have a requirement to call Soap API of Exact target via a callout from my Salesforce CRM Apex class. I am using the WSDL2APex approach and i'm able to successfully make the call to exact target and receive the response when i pass the security tag with Usernametoken details.
However, due to some implicit requirements, I have a necessity to pass the fueloauth element instead of username and password in the soap envelop.
Below is the sample inner class i have for the header. However, it is adding an additional wrapper which<Header>
which I am not able to figure out how to remove. Need some help here.
public class Header{
public String fueloAuth;
private String[] fueloAuth_type_info = new String[]{'fueloAuth','http://exacttarget.com','String','1','-','false'};
private String[] apex_schema_type_info = new String[]{'','true','false'};
private String[] field_order_type_info = new String[]{'fueloAuth'};
}
public class Header{
public String fueloAuth;
private String[] fueloAuth_type_info = new String[]{'fueloAuth','http://exacttarget.com','String','1','-','false'};
private String[] apex_schema_type_info = new String[]{'','true','false'};
private String[] field_order_type_info = new String[]{'fueloAuth'};
}
code in my stub class is as below to add the header, where i have the webserviceCallout.invoke method.
public ETPartnerAPI.Header Header; private String Header_hns = 'env:Header=www.exacttarget.com';
public ETPartnerAPI.Header Header;
private String Header_hns = 'env:Header=www.exacttarget.com';
generated output is env:Header <env:Header xmlns="www.exacttarget.com"> somevalue </env:Header> </env:Header>
<env:Header>
<env:Header xmlns="www.exacttarget.com">
<fueloAuth>somevalue</fueloAuth>
</env:Header>
</env:Header>
What i'm looking at is <env:Header xmlns="www.exacttarget.com"> somevalue </env:Header>
<env:Header xmlns="www.exacttarget.com">
<fueloAuth>somevalue</fueloAuth>
</env:Header>