VB.NET InstanceContext不工作
感谢这些年来所有的帮助——我从来没有遇到过需要发帖的问题,因为大多数问题都已经得到了解答!不幸的是,我终于有了一个 使用一个web服务,该web服务需要在SOAP头中使用一个非常特别的措辞标记,如下所示:VB.NET InstanceContext不工作,vb.net,web-services,Vb.net,Web Services,感谢这些年来所有的帮助——我从来没有遇到过需要发帖的问题,因为大多数问题都已经得到了解答!不幸的是,我终于有了一个 使用一个web服务,该web服务需要在SOAP头中使用一个非常特别的措辞标记,如下所示: <soapenv:header> <Authentication xmlns="...">12345</Authentication> </soapenv:header> Imports System.ServiceModel Imports
<soapenv:header>
<Authentication xmlns="...">12345</Authentication>
</soapenv:header>
Imports System.ServiceModel
Imports System.ServiceModel.Channels
Private Sub GoXSQ_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoXSQ.Click
If My.Settings.XSQ <> "" Then
Dim XSQPService As New XSQ_Proxy.XsquareProxyService(New InstanceContext(Me))
XSQPService.Url = "http://" + My.Settings.XSQ + ":9004/XSquareProxyService"
Dim token As String = ""
Try
token = XSQPService.Authenticate(My.Settings.XSQUser, My.Settings.XSQPass)
Catch ex As Exception
SB.AppendText(Now() & " - Error communicating with XSQ API - " & ex.Message & " - " & ex.InnerException.ToString + Environment.NewLine)
End Try
If token <> "" And token > "000000" Then
SB.AppendText(Now() & " - Token received: " & token + Environment.NewLine)
'<!--- Insert XSQ process code here! ---!>
Using scope As New OperationContextScope(XSQPService.InnerChannel)
If Not OperationContext.Current.OutgoingMessageHeaders.FindHeader("Authentication", "http://www.evs.tv/XMLSchema/Authentication/") = -1 Then
OperationContext.Current.OutgoingMessageHeaders.RemoveAt(OperationContext.Current.OutgoingMessageHeaders.FindHeader("Authentication", "http://www.evs.tv/XMLSchema/Authentication/"))
End If
Dim header As MessageHeader = MessageHeader.CreateHeader("Authentication", "http://www.evs.tv/XMLSchema/Authentication/", token)
OperationContext.Current.OutgoingMessageHeaders.Add(header)
Dim jobsrunning = XSQPService.GetMachines()
For Each job In jobsrunning
SB.AppendText(job.Name)
Next
End Using
Else
SB.AppendText(Now() & " - XSQ API login failure - check username/password!" + Environment.NewLine)
End If
End If
End Sub
对公共子对象的参数太多
Using scope As New OperationContextScope(XSQPService.InnerChannel)
InnerChannel不是
我猜第二个是由于第一个,但我找不到任何东西来确定为什么这个短语不起作用-它完全支持.NET4.0,这是我的编译框架
任何帮助都将不胜感激
保罗
Using scope As New OperationContextScope(XSQPService.InnerChannel)