Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2006

Tip: Looking for answers? Try searching our database.

Inheritance / Override problem - I think !

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nick Locke - 22 Oct 2006 10:47 GMT
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
John Saunders - 22 Oct 2006 19:47 GMT
> 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
Nick Locke - 23 Oct 2006 19:52 GMT
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

> You have been given all of the incoming data that you asked for. None.
>
[quoted text clipped - 3 lines]
>
> John

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.