function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
neophyteneophyte 

How to set the password and its type in the header (WS-Security) when making a soap request

I am facing the exact problem being described here.

 

My header looks like this:

 

<env:Header>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-ecext-1.0.xsd">
<UsernameToken><Username>username</Username>
<Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest" />
</UsernameToken>
<TimeStamp />
</Security>
</env:Header>

 

This is when the class is :

public class Password_element {
public String Type_x;
private String[] Type_x_att_info = new String[]{'Type'};
private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
private String[] field_order_type_info = new String[]{};

public Password_element(String typeOfpwd)
{
this.Type_x = typeOfpwd;
}
}

 

If I add an extra element in the class: Like: 

 public String Password;

 private String[] Password_type_info = new String[]{'Password','http://www.w3.org/2001/XMLSchema','string','0','1','false'};

 

Then the header looks like :

<Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest" > <Password> Password </Password></Password>

 

How do I set the password without adding an additional tag?

 

Thanks,

Anand

Muni ManjunathMuni Manjunath
Need help in resolving  this issue. Is there any solution exist currently to set the passwordtype ?