1
我無法讀取傳遞到我的Web服務中的標題。我正在使用curl來調用我的web服務,它返回時沒有錯誤,但傳入的標題值爲空。無法讀取vb.net Web服務中的標題信息
curl command with return message:
C:\curl>curl -X POST -H "Token: 123" -d '' http://localhost/Service.asm
x/GoCardLessWebHook
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://MyGoCardLessAPI.org/">200 OK - </string>
這裏是Web服務代碼:
Public Class clsSoapHeader
Inherits SoapHeader
Public Token As String
End Class
<WebService(Namespace:="http://MyGoCardLessAPI.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<System.Web.Script.Services.ScriptService()>
Public Class Service
Inherits System.Web.Services.WebService
Public GoCardLessHeaders As New clsSoapHeader
<WebMethod(), _
SoapHeader("GoCardLessHeaders", Direction:=SoapHeaderDirection.InOut)> _
Public Function GoCardLessWebHook() As String
Dim sTemp As String = "Unknown"
sTemp = GoCardLessHeaders.Token
Return "200 OK - " & sTemp
End Function