Inheritance / Override problem - I think !

Discussion in 'ASP .Net Web Services' started by Nick Locke, Oct 22, 2006.

  1. Nick Locke

    Nick Locke Guest

    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
     
    Nick Locke, Oct 22, 2006
    #1
    1. Advertising

  2. "Nick Locke" <> wrote in message
    news:...
    > 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
     
    John Saunders, Oct 22, 2006
    #2
    1. Advertising

  3. Nick Locke

    Nick Locke Guest

    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

    "John Saunders" <john.saunders at trizetto.com> wrote
    > 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
    >
    >
     
    Nick Locke, Oct 23, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page