Inheritance / Override problem - I think !

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. ---&gt; 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
 
J

John Saunders

Nick Locke said:
I am probably missing something extremely simple! What do I need to do so
that I can get hold of the incoming data?

You have been given all of the incoming data that you asked for. None.

You've probably got the namespaces incorrect between client and server.
Since no elements sent by the client match the namespace you asked for, you
get Nothing.

John
 
N

Nick Locke

John,

Can I just thank you for all your help over the past few days. This one was
down to a spurious elementFormDefault="qualified" in a schema definition. I
now have SOAP Headers and Bodies flying around as I want them too.

I have also realised that it is a LOT easier to use /ServerInterface rather
than /Server as a WSDL qualifier - it results in a lot less work!

Thanks again.

Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top