Hi All,
I am accessing a WCF service in my solution from URL provided(Third party).
The service is secured with WS Http Binding, having an user name ,password authentication with soap request.
I have added a service reference in my solution and passed a user name and password to service object.
ServiceReferenceAdmin client = new ServiceReferenceAdmin("WSHttpBinding_IAdmin");
client.ClientCredentials.UserName.UserName = "one";
client.ClientCredentials.UserName.Password = "two";
client.callServMethod("test");
When I am calling service method, connection is created with service method-->Used a fiddler to get request and response --> and came to know --
In soap request timestap is going as a local system timestamp which is in GMT format.
And server time zone(where service i hosted) is Pacific time zone (UTC -08:00).
Because of this the authentication is failing and rejecting service method call.
Tried following different ways :
1) Changed system time zone to Pacific time zone (UTC -8:00)
2)
using(new OperationContextScope(client.InnerChannel))
{
OperationContext.Current.OutgoingMessageHeaders.Add(new SecurityHeader("UsernameToken", "one", "two"));
string str = "acp";
}
public class SecurityHeader : MessageHeader
{
private readonly UsernameToken _usernameToken;
public SecurityHeader(string id, string username, string password)
{
_usernameToken = new UsernameToken(id, username, password);
}
public override string Name
{
get { return "Security"; }
}
public override string Namespace
{
get { return "namespace"; }
}
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
XmlSerializer serializer = new XmlSerializer(typeof(UsernameToken));
serializer.Serialize(writer, _usernameToken);
}
}
After all this settings SOAP request is not changing from GMT to Pacific timezone.
How to make change in timestamp of soap request?
Is there any way I can set time Zone in IIS ?
Thank you in advance for your response.
Please let me know your feedback and suggestions