mardi 20 octobre 2015

Unable to read header information in vb.net web service

I am unable to read the header that is being passed into my web service. I am using curl to call my web service which returns without errors but the header value passed in is blank.

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://ift.tt/1hRcGWA">200 OK - </string>

Here is the Web Service code:

Public Class clsSoapHeader
    Inherits SoapHeader
    Public Token As String
End Class



<WebService(Namespace:="http://ift.tt/1hRcGWA")> _
<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




Aucun commentaire:

Enregistrer un commentaire