Question Getting SOAP node vlaues

BigAl64

New member
Joined
Oct 16, 2012
Messages
1
Programming Experience
5-10
I have the following soap header

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="XML Schema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
<wsa:To>https://www.xxxx.co.uk/webservices/xxxx/Service.asmx?op=AddData</wsa:To>
<wsa:From>
<Address>FromAddress</Address>
</wsa:From>
<wsa:ReplyTo>
<Address>ReplyToAddress</Address>
</wsa:ReplyTo>

<wsa:Action>https://www.xxxx.co.uk/webservices/xxxx/Service.asmx</wsa:Action>
<wsa:MessageId>ee9bd012-b08f-4fd2-be0b-33976715a75f</wsa:MessageId>
</soap:Header>

In my webservice I wand to get the MessageId so I created a Class as follows

<System.Xml.Serialization.XmlRootAttribute(ElementName:="MessageId", Namespace:="http://schemas.xmlsoap.org/ws/2004/03/addressing")> _
Public Class MessageId : Inherits SoapHeader
<System.Xml.Serialization.XmlTextAttribute()> _
Public TextValue As String
End Class

myMessageId as MessageId

The web method is delcared as

<WebMethod(), _
SoapHeader("myRelatesTo", Direction:=SoapHeaderDirection.InOut), _
SoapHeader("myMessageId", Direction:=SoapHeaderDirection.InOut)> _
Public Function TradesmanAllNBAt(ByVal objDocument As XmlDocument) As XmlDocument
Try

myRelatesTo = New RelatesTo
myRelatesTo.RelationshipType = "Reply"
'create GUID for message and save back to file
myMessageId = New MessageId

Dim test as string = myMessageId.TextValue
Catch ex As Exception
DataLayer.ErrorHandling.logError(ex)
Return Nothing

End Try
End Function


The variable test is always NOTHING can anyone tell me where I am going wrong please?
 

Latest posts

Back
Top