I have a service provider that requires a non-standard Authorization Type for their web service.
Instead of Basic, Digest, NTLM, etc., they require “Basic API Access.”.
I have tried the code below and used Fiddler to check the web service request.
It does not seem that any custom strings can be used
Binding avail = new Binding();
avail.Url = "https://amer.webservicesxx.com/Availability";
NetworkCredential netCredential = new NetworkCredential("abc", "def");
Uri uri = new Uri(avail.Url);
CredentialCache cred = new CredentialCache();
cred.Add(uri, "Basic API Access", netCredential);
avail.Credentials = cred;
SearchRsp response = avail.service(request);
POST https://amer.webservicesxx.com/Availability HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
Protocol 4.0.30319.1)
VsDebuggerCausalityData:
uIDPo+CJPwpspBxKp939c…
Content-Type: text/xml; charset=utf-8
SOAPAction: “”
Host: america.webservicesxx.com
Content-Length:
658
Expect: 100-continue?xml version=”1.0″ encoding=”utf-8″?> ?soap:Envelope
xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:xsi=”http://www.w3.org/20 01/XMLSchema-instance”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”> …
?/soap:Envelope>
It is missing the …
Authorization: Basic API Access/dUFQSS04NDA0NTk2MDk6WiFyYzBuZDg0…
…line in the header.
If I just use "Basic" it adds the Authorization line properly, but is rejected by the service provider.
Is this the correct syntax to add an Authorization: header to the Soap transaction?
I needed to replace data in the web request.
inside the web service reference class.