ASP.net SOAP Header authenticatioon

Soldato
Joined
18 Oct 2002
Posts
9,158
Hi all,

My colleague has SOAP header authentication on his webservice and I am having a few issues connecting to it.



I have created a simple test page, and I can access the WS through that, like the following:


Code:
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Auth [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] LeedsBranch.AuthenticationHeader 
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Consume [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] LeedsBranch.cdean2 Auth.username = 
 
[/size][size=2][color=#800000]"james"[/color][/size][size=2] Auth.password = 
 
[/size][size=2][color=#800000]"ja90"[/color][/size][size=2] Consume.AuthenticationHeaderValue = Auth
 
 
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] ds [/size][size=2][color=#0000ff]As[/color][/size][size=2] Data.DataSet ds = Consume.GetAllStock()
 
GridView1.DataSource = ds
 
GridView1.DataBind()
But when I try to add this into a class, to cut down on having in instantiate every time it does not work, returning ¨System.NullReferenceException: Object reference not set to an instance of an object.¨

My code for the class is:




Code:
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Consume [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] LeedsBranch.cdean2 
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Auth [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] LeedsBranch.AuthenticationHeader 
 
[/size][size=2][color=#0000ff]Protected[/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] AuthDetails() [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Boolean[/color][/size][size=2] Auth.username = 
 
[/size][size=2][color=#800000]"james"[/color][/size][size=2] Auth.password = 
 
[/size][size=2][color=#800000]"ja90"[/color][/size][size=2] Consume.AuthenticationHeaderValue = Auth
 
 
 
[/size][size=2][color=#0000ff]Return[/color][/size][size=2][color=#0000ff]True[/color][/size][size=2] 
 
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] 
 
[/size][size=2][color=#0000ff]Public[/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] GetAllStock() [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataSet AuthDetails()
 
 
 
[/size][size=2][color=#0000ff]Return[/color][/size][size=2] Consume.GetAllStock() 
 
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Function[/color][/size]

Any ideas anyone?

Kind regards,

James

 
Back
Top Bottom