• damien priest
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
When parsing WSDL file into Apex we needed to change the header item (user/password) into complex type for Salesforce to accept it. 

Now unfortunately, the Apex class is sending the complex type information whereas the external system is expecting a string only. 

Ie, External System format requires:
<soapenv:Header>
 <web:SessionType>none</web:SessionType>
 <web:PasswordText>topsecret</web:PasswordText>
 <web:UsernameToken>BROKER</web:UsernameToken>
 </soapenv:Header>
However Salesforce is sending: 
<env:Header>
        <PasswordText
            xmlns="http://siebel.com/webservices">
            <inputParam>topsecret</inputParam>
        </PasswordText>
        <SessionType
            xmlns="http://siebel.com/webservices">
            <inputParam>none</inputParam>
        </SessionType>
        <UsernameToken
            xmlns="http://siebel.com/webservices">
            <inputParam>BROKER</inputParam>
        </UsernameToken>
    </env:Header>

This is what WSDL2Apex generated:
//Generated by wsdl2apex

public class AFGFlexWebservices {
    public class SessionType_element {
        public String inputParam;
        private String[] inputParam_type_info = new String[]{'inputParam','http://siebel.com/webservices',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://siebel.com/webservices','true','false'};
        private String[] field_order_type_info = new String[]{'inputParam'};
    }
    public class PasswordText_element {
        public String inputParam;
        private String[] inputParam_type_info = new String[]{'inputParam','http://siebel.com/webservices',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://siebel.com/webservices','true','false'};
        private String[] field_order_type_info = new String[]{'inputParam'};
    }
    public class UsernameToken_element {
        public String inputParam;
        private String[] inputParam_type_info = new String[]{'inputParam','http://siebel.com/webservices',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://siebel.com/webservices','true','false'};
        private String[] field_order_type_info = new String[]{'inputParam'};
    }
}

Does anyone have any ideas how I can instead send through just a string  for each header item rather than all the extra details?