The wsdl2apex generated classes will include the
You can use inputHttpHeaders_x to send additional HTTP headers in on the request and outputHttpHeaders_x to read any additional ones on the response.
See HTTP Header Support
Manually generating SOAP headers will be more involved. Typically these would be defined in the WSDL and would then be generated for you.
To do it manually you will need:
- An Apex class to hold the header data. This will include the
_type_info members to define any members plus the generic apex_schema_type_info and field_order_type_info string arrays.
- A member on the Port class of the header data type
- A string with the members name and the
_hns suffix. The value of the string will set the namespace for that header.
The exact steps to do this will depend on the header you are trying to send.