Kullanıcıya/geçişe sahip bir üçüncü taraf web hizmeti kullanmaya çalışıyorum. Kullanıcı kimliği doğrulamak ve ayarlamak için gerekli olanı yaptığıma inanıyorum, ama bunları http başlığında veya başka bir şeye dahil etmiyor gibi görünüyor ...WCF - BasicHttpBinding, Kullanıcı adı ve/veya parola mevcut değil, name: null, password: null
Aramaya çalışırken;
nameList.AddRange(service.getBlobNameByIdAndSectionId(section, id))
Bu hatayı alıyorum;
No user name and/or password is available, name: null, password: null
Tam kodu:
Private Function GetVendorService() As Services.ServiceClient
Dim binding As New BasicHttpBinding(BasicHttpSecurityMode.Transport)
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic
Dim ea As New EndpointAddress(GetVendorServiceURL())
Dim service As New Services.ServiceClient(binding, ea)
service.ClientCredentials.UserName.UserName = "user"
service.ClientCredentials.UserName.Password = "password"
Return service
End Function
Public Function GetVendorServiceURL() As String
Select Case Informix.HostType
Case HostServerType.Stage
Return "https://url-s.net:8443/cxf/Service/v1/ws"
Case HostServerType.Dev
Return "https://url-d.net:8443/cxf/Service/v1/ws"
Case Else 'Live
Return "https://url.net:8443/cxf/Service/v1/ws"
End Select
End Function
Private Function GetPdfListById(ByVal Id As Integer, ByVal Section As SectionId) As List(Of Services.blobName)
Dim service As Services.ServiceClient = GetVendorService()
Dim nameList As New List(Of Services.blobName)
service.Open()
nameList.AddRange(service.getBlobNameByIdAndSectionId(section, id))
service.Close()
Return nameList
End Function
app.config gerekli doğrulama ise Temel HTTP sadece, o zaman şöyle basicHttpBinding güvenliğini belirtmek gerekir
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ServiceSoapBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://url.net:8443/cxf/Service/v1/ws"
binding="basicHttpBinding" bindingConfiguration="ServiceSoapBinding"
contract="Services.Service"
name="ServiceSoapPort" />
</client>
Eh, bazı potansiyel karışıklığı ortadan kaldırmak amacıyla, ikinci bağlanma tanımlı ('ServiceSoapBinding1') şu anda (kodda sen göstermiştir) başvurulan değildir, bu nedenle göz ardı edilecek ve güvenle kaldırabilir. – paul
Teşekkürler, mesaj gönderirken bunu kaçırdı. Örnekden kaldırıldı. – Tomcat
Aptal soru, ama bunun nasıl yapılacağı hakkında herhangi bir belgeleriniz var mı? Üçüncü taraf ne diyor? –