all groups > dotnet web services > january 2007 >
You're in the

dotnet web services

group:

Why is my SoapContext.Current null?


Why is my SoapContext.Current null? Joseph Geretz
1/17/2007 2:46:13 PM
dotnet web services:
I have a web service page which uses WSE 2.0 SP3 to return a file attachment
on one of its method calls. All web service methods are functioning
properly, except for this one method which uses WSE / DIME to attach the
file to SoapContext.Current. I've traced into the problem running the page
in the IDE and I'm finding that the problem is that this object is null.
SoapContext is a valid object, but the Current object is null.

My environment:

IIS 5
..NET Framework 2.0
WSE 2.0 / SP3
Visual Studio 2005 (C#)

Here's my WebService class definition:

[WebService(Namespace="http://srssoft.com/webservices/")]
[System.Web.Services.WebServiceBindingAttribute(Name = "RepositorySoap",
Namespace = "http://srssoft.com/webservices/")]
public class Repository : Microsoft.Web.Services2.WebServicesClientProtocol
{ ...

(I never had the WebServiceBindingAttribute coded until I moved from Fx 1.1
to Fx 2.0. The code compiled cleanly without it, but I started receiving
run-time errors which I managed to squelch by placing this attribute onto
the class. But maybe this somehow affects whether I get
SoapContext.Current?)

Also, should the Web Services class be inheriting ffrom
Microsoft.Web.Services2.WebServicesClientProtocol? That doesn't sound right
to me, since this is a Server, rather than a Client class, but I checked
back in Source Safe and this has been the definition since the class was
originally developed and it was previously working, as far as I know.

Here's the Web method call:

[WebMethod]
public int GetFile(string FileSpec, bool Checkout, string AuthentiKey)
{...

I'm also finding in the client class which initiates this call, that
RequestSoapContext.Current is also a null object before initiating a Web
request to upload a file. Clearly my infrastructure is deficient in some way
and I'm not able to get access to either the Request or Response contexts I
need to set up the DIME attachment passing between client and server. Any
idea what's wrong with my either my environment or my code?

Thanks immensely for any help which you can provide!

- Joe Geretz -

Re: Why is my SoapContext.Current null? Joseph Geretz
1/17/2007 10:22:42 PM
Forget it.

WSE 2.0 DIME is dead - long live WSE 3.0 MTOM!

Because I don't want to go through another such conversion anytime soon!!!

- Joe Geretz -

[quoted text, click to view]

AddThis Social Bookmark Button