views:

176

answers:

2

Hi,

I have created a custom SharePoint web service that was deployed to, and successfully tested on, a test environment. Unfortunately, the web service has since stopped working, and I am trying to determine what the error is.

The web service now returns the following error in the SOAP response:

SOAP:server
Server was unable to process request.  Object reference not set to an instance of an object.

There have been no changes to the deployed web service, so I am assuming that a more recent deployment has altered the SharePoint configuration. My web service .asmx is deployed to the _vti_bin folder, and the assembly is deployed to the GAC. I can see the WSDL file being displayed when I browse to http://servername:port/_vti_bin/MyCustomWebService.asmx. The web methods in the assembly make use of logging (to the Windows Event log), but no logging is occurring when I try and access the web service, which suggests that the call is not getting as far as entering the web method.

Given the above, can anyone offer any suggestions as to debug this issue?

Thanks. MagicAndi.

Update
I have now realised that when I consume the web service from the endpoint http://servername:port/Site/_vti_bin/MyCustomWebService.asmx, it works, but when I use the endpoint http://servername:port/_vti_bin/MyCustomWebService.asmx, the web service fails as described above. I will update further when I diagnose the cause of the issue.

+2  A: 

this is a try catch to get more infomraion on the exception. It will give you more information which will help debug your problem

try { 
// Do soap call here

} 
catch (System.Web.Protocols.SoapException soap_ex) 
{ 
  Console.WriteLine(soap_ex.Detail.OuterXML); 
} 
catch(System.Exception ex) 
{ 
  Console.WriteLine(ex.Message);         
}
Chris Jones
Chris, Thanks. Shouldn't that be System.Web.Services.Protocols.SoapException?
MagicAndi
That will only show the error as returned to the client, with limited information on the internal state of the web service.
Tom Clarkson
Chris, thanks again, +1.
MagicAndi
This will show a detailed error.I would also add a break point in, this should give you a very clear idea whats going on.
Chris Jones
have we helped you? may we close this issue?
Chris Jones
Chris, just checked out your profile. A piece of advice - don't get pushy about your answer being accepted. In this case, it just cost you some SO reputation. No one likes a Rep Farmer.
MagicAndi
I like to watch issues and make sure I have helped. I can't bleive you and take me down my rep.
Chris Jones
+1  A: 

The easiest option is to attach a debugger set to break on exceptions. If your infrastructure rules don't allow that, you'll probably need to add some additional logging to your code on the server. If you are lucky there may be enough information available in the soap message, but in my experience null reference exceptions usually need more information to be found easily.

Tom Clarkson
Tom, as this is a test environment, installing Visual Studio to debug the issue isn't an option. Also, I have logging in the web service code, as described above, and this isn't being called at all. The problem is not in the web service code, bit is in the connection to the endpoint.
MagicAndi
Tom, accepted as answer.
MagicAndi