SF allowed the usage of Named Credentials with SOAP callouts but the documentation doesn't really go into details of how to pass/access the Username and Password to the stub.inputHttpHeaders_x . I have a webservice that uses basic authentication and I need to pass the details as below.
final String authHttpHeader = 'Basic ' + EncodingUtil.base64Encode( Blob.valueOf( User_Name + ':' + Password ) );
stub.inputHttpHeaders_x.put( 'Authorization', authHttpHeader );
stub.endpoint_x = 'callout:My_Named_Credential'
If some can give an example of how to access the username/password from the named credentials that will be a great help.