Hello,
I want to call a WebService that uses an Http Header from VB.Net.
In SoapUI, here is the XML that allows me to check the WS answers :
And under the Headers bottom tab, I've those values :
Header name : Authorization
Header value : Basic aXBhcmk6MzZkODA1NDEzMzRhODXXXXXXXXXzdlNDBiYmJhYzk=
In my VB.Net code, I tried to call one WS that does not requires this Authorization header.
The code is :
This is working because the Status webService does not requires the Authorization.
But if course, the other WebServices do require it.
So, my question is : How do I change my code to send the Authorization value ? From what I understand, I first must declare that there is this "Authorization" header, and then its value.
How do I do this ?
Thanks for your help.
I want to call a WebService that uses an Http Header from VB.Net.
In SoapUI, here is the XML that allows me to check the WS answers :
VB.NET:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v0="http://wse.sxx-dxx.com:8081/entreprise/v0.4">
<soapenv:Header/>
<soapenv:Body>
<v0:getIdentite>
<siret>481859700</siret>
<id>0</id>
</v0:getIdentite>
</soapenv:Body>
</soapenv:Envelope>
And under the Headers bottom tab, I've those values :
Header name : Authorization
Header value : Basic aXBhcmk6MzZkODA1NDEzMzRhODXXXXXXXXXzdlNDBiYmJhYzk=
In my VB.Net code, I tried to call one WS that does not requires this Authorization header.
The code is :
VB.NET:
Dim aaaa As New SR_SD.EntreprisePortClient 'Define aaaa as the Reference Service for the WebService.
Dim lStatus As SR_SD.StatusReturn ' Define lStatus as the result of the WS Status
Try
lStatus = aaaa.status ' Calls the WS Status and put the result in lStatus
If lStatus.statusCode <> 3000 Then ' Check that everything is OK.
MessageBox.Show("Error while trying to connect." & lStatus.statusMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
MessageBox.Show("Connexion OK")
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
This is working because the Status webService does not requires the Authorization.
But if course, the other WebServices do require it.
So, my question is : How do I change my code to send the Authorization value ? From what I understand, I first must declare that there is this "Authorization" header, and then its value.
How do I do this ?
Thanks for your help.