I have wsdl SOAP service with basic auth. I need to call this service and can send some file e.g pdf,txt or any other format to scan.
I am looking for some option to send SOAP request with file stream and basic auth. Any pointers will be helpful
I tried some of the options methioned in below url, however it do not have basic auth

Uttam ChaturvediPosted Mar 1, 2023, 3:40 AM
Here is the code I tried in c#, however API is returning 500
var handler = new HttpClientHandler();
HttpContent stringContent = new StringContent("test.pdf", Encoding.UTF8);
var byteArrayContent = new ByteArrayContent(fileBytes);
HttpContent bytesContent = new ByteArrayContent(fileBytes);
handler.PreAuthenticate = true;
using (var client = new HttpClient(handler))
{
ByteArrayContent byteContent = new ByteArrayContent(fileBytes);
var authString = Convert.ToBase64String(Encoding.UTF8.GetBytes("sirius-vscan-qas-0:m,'^ZT^=n/D^i1AgCVoh"));
var formData = new MultipartFormDataContent();
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue ("Basic", authString);
//formData.Add(stringContent, "fileName", "TestVirus");
formData.Add(stringContent, "contentID", "test.pdf");
formData.Add(byteArrayContent,"application/pdf");
var response = await client.PostAsync("https://azure-vscan.application.qas.supplyon.com/com.supplyon.vs/VirusScanService", formData);
if (!response.IsSuccessStatusCode)
{
return null;
}
}
Tuhin PaulPosted Mar 1, 2023, 3:34 AM
Hi Uttam,
To send a SOAP request with a file stream and basic authentication, you can use a SOAP client library in your programming language of choice. let me know if you are looking some code example for that. and in which language , i will try to share.