+ Start a Discussion
Ken Koellner 1Ken Koellner 1 

Type attribute for password for ws-security using wsdl2apex webservice callout

I'm trying to generate a soap header for a web service callout via an wsdl2apex generated stub class like --
<env:Header>
                <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                                <UsernameToken>
                                                <Username>myUserName</Username>
                                                <Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">myPassword</Password>
                                </UsernameToken>
                </Security>
</env:Header>

The critical factor is inserting the Type attribute on the password element.  The answer of how to inject the Security info is clearly answered in my forums.  But I haven't found any answer to the problem of injecting the type element.  I know there is one post from many years ago saying there's no way to send both a value and an attribute for a simple element.  I do not know if that is still true.  I'd loved to find a work around for this issue.

If you know a work-around for the specific issue of sending that Type attribute with the password, please please please respond.

Not response required for related question of how to add the soap header in general.  No response required mentioning  old threads that don't specifically address and the Type attribute issue on password.