【发布时间】:2015-10-20 20:32:49
【问题描述】:
我无法读取传递到我的 Web 服务的标头。我正在使用 curl 调用我的 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>
这是网络服务代码:
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
【问题讨论】: