
Hi,
In my old webservice (Dynamics AX20112), I usually pass the credentials as follow.
MyService.ClientCredentials.UserName.UserName = U;
MyService.ClientCredentials.UserName.Password = P;
Now our service is on Dynamics 365 (Azure), we need to pass the bearer token to this soap webservice? How can that be done or is there anything similar to the above?
Thanks in advance.
I am able to get the it working. Here is how I add the "Authorization" header':
sc = myService.Client...
using (new OperationContextScope(sc.InnerChannel))
{
// Add a HTTP Header to an outgoing request
string auth = "Bearer " + authToken;
HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
requestMessage.Headers["Authorization"] = auth;
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
sc.GetServiceInfo(c, out ret);
}