N
Nick Locke
I have this in the class generated by wsdl.exe:
<System.Web.Services.Protocols.SoapHeaderAttribute("ContextValue"), _
System.Web.Services.WebMethodAttribute(), _
System.Web.Services.Protocols.SoapDocumentMethodAttribute("DeleteStolenVehicle",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
Public MustOverride Function
DeleteStolenVehicle(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://xxxx-yyyyy.org.uk/namespaces/20061021/types")>
ByVal VehicleId As VehicleId) As
<System.Xml.Serialization.XmlElementAttribute("VehicleResponse",
[Namespace]:="http://xxxx-yyyyy.org.uk/namespaces/20061021/types")>
VehicleResponse
The I have this in my own code:
Public Class Service
Inherits Vehicle
' Add a member variable of the type deriving from SoapHeader.
Public objMemberHeader As Context
<WebMethod(Description:="Deletes details of a stolen vehicle.",
messagename:="DeleteStolenVehicle"), _
SoapHeader("objMemberHeader",
Direction:=SoapHeaderDirection.In)> _
Public Overrides Function DeleteStolenVehicle(ByVal objVehicleId As
VehicleId) As VehicleResponse
' For now, just an instance of the return values so we can frig it
Dim objReturn As New VehicleResponse
objReturn.UpdateTime = Now()
objReturn.VehicleFraudId = 999 '*******
Return objReturn
End Function
When I call that, I get back exactly what Iwould expect:
<DeleteStolenVehicleResult>
<VehicleFraudId>999</VehicleFraudId>
<UpdateTime>2006-10-22T10:38:38.0144535+01:00</UpdateTime>
</DeleteStolenVehicleResult>
But as soon as I try and refer to the incoming data, for example, by
changing the asterisked line above to:
objReturn.VehicleFraudId = objVehicleId.VehicleFraudId
I get a problem:
<faultstring>System.Web.Services.Protocols.SoapException: Server was
unable to process request. ---> System.NullReferenceException: Object
reference not set to an instance of an object.
at Service.DeleteStolenVehicle(VehicleId objVehicleId)
--- End of inner exception stack trace ---</faultstring>
I am probably missing something extremely simple! What do I need to do so
that I can get hold of the incoming data?
Thanks
<System.Web.Services.Protocols.SoapHeaderAttribute("ContextValue"), _
System.Web.Services.WebMethodAttribute(), _
System.Web.Services.Protocols.SoapDocumentMethodAttribute("DeleteStolenVehicle",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
Public MustOverride Function
DeleteStolenVehicle(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://xxxx-yyyyy.org.uk/namespaces/20061021/types")>
ByVal VehicleId As VehicleId) As
<System.Xml.Serialization.XmlElementAttribute("VehicleResponse",
[Namespace]:="http://xxxx-yyyyy.org.uk/namespaces/20061021/types")>
VehicleResponse
The I have this in my own code:
Public Class Service
Inherits Vehicle
' Add a member variable of the type deriving from SoapHeader.
Public objMemberHeader As Context
<WebMethod(Description:="Deletes details of a stolen vehicle.",
messagename:="DeleteStolenVehicle"), _
SoapHeader("objMemberHeader",
Direction:=SoapHeaderDirection.In)> _
Public Overrides Function DeleteStolenVehicle(ByVal objVehicleId As
VehicleId) As VehicleResponse
' For now, just an instance of the return values so we can frig it
Dim objReturn As New VehicleResponse
objReturn.UpdateTime = Now()
objReturn.VehicleFraudId = 999 '*******
Return objReturn
End Function
When I call that, I get back exactly what Iwould expect:
<DeleteStolenVehicleResult>
<VehicleFraudId>999</VehicleFraudId>
<UpdateTime>2006-10-22T10:38:38.0144535+01:00</UpdateTime>
</DeleteStolenVehicleResult>
But as soon as I try and refer to the incoming data, for example, by
changing the asterisked line above to:
objReturn.VehicleFraudId = objVehicleId.VehicleFraudId
I get a problem:
<faultstring>System.Web.Services.Protocols.SoapException: Server was
unable to process request. ---> System.NullReferenceException: Object
reference not set to an instance of an object.
at Service.DeleteStolenVehicle(VehicleId objVehicleId)
--- End of inner exception stack trace ---</faultstring>
I am probably missing something extremely simple! What do I need to do so
that I can get hold of the incoming data?
Thanks