Webservice failure

S

Stephen McCrea

I moved a web service from my development machine (once everything was
working fine) to the release machine and the release box the service fails
on calls that return a DataSet - other calls that return simple variables or
arrays of objects work fine. I believe that there is no major difference
between the two IIS 6.0s xcept that the release machine is on Windows 2003
server and the development machine is Windows XP Pro.

I have included the error page below - can anyone give me a hint?

Thanks,

Server Error in '/' Application.
----------------------------------------------------------------------------
----

The request failed with HTTP status 400: Bad Request.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: The request failed with HTTP
status 400: Bad Request.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[WebException: The request failed with HTTP status 400: Bad Request.]

System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient
Message message, WebResponse response, Stream responseStream, Boolean
asyncCall) +1352
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) +218

mccreaengineering.profilessvc_local.ProjectProfilesService.GetUserDataset()
+32
mccreaengineering.ProjectMgr.licenseusers.BindDataGrid() +101
mccreaengineering.ProjectMgr.licenseusers.Page_Load(Object sender,
EventArgs e) +300
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
 
S

Stephen McCrea

Never mind . . . it was due to returning a 'null'. If the dataset could not
be populated this seemed to cause some confusion for asp.net or whatever, on
the other machine. I had to change the code to always create a dataset and
return it empty (no tables) if necessary.

This happened even if the dataset could be populated - just the parsing of
the function or executing some tacked-on (soap?) header seemed to cause the
exception - even before it was executed - i.e., an empty function with the
same signature returning a null also caused the problem.

Are there rules for null returns from web service functions?

Thank you,
 
S

Stephen McCrea

It has nothing to do with error checking - just that the service did not
like returning a null value.
 
S

Stephen McCrea

For clarification this is what failed when called:

// to test I reduced the function to simply these lines
{WebMethod(EnableSession=true]
public DataSet Method()
{
return null; //(or return (DataSet)null;)
}

// Approximation of original function that failed
{WebMethod(EnableSession=true]
public DataSet Method()
{
if(condition() == false) return null;
DataSet ds = new DataSet()
...
return ds;
}

// Eventual function that worked
{WebMethod(EnableSession=true]
public DataSet Method()
{
DataSet ds = new DataSet()
if(condition1() == true)
{
...
}
return ds;
}
 
S

Stephen McCrea

I have a web service that works fine on my development machine.
I call several other service methods that do not return datasets and they
work without problem on the server.

It is only the dataset returning function that fails.

The method in the service is (I even removed all extra code to test it in
its simplest form):

[WebMethod(EnableSession=true)]
public DataSet GetUserDataset()
{
DataSet ds = new DataSet();
return ds;
}

It is called as:

DataSet m_dataset;
m_dataset = service.GetUserDataset(); // crashes on call

If I wrap the above call in: try { } catch(Exception ex) { }
I receive HttpException 400

Here is the original error message:

Server Error in '/' Application.
----------------------------------------------------------------------------
----

The request failed with HTTP status 400: Bad Request.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: The request failed with HTTP
status 400: Bad Request.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[WebException: The request failed with HTTP status 400: Bad Request.]

System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient
Message message, WebResponse response, Stream responseStream, Boolean
asyncCall) +1345
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) +218

mccreaengineering.profilessvc_local.ProjectProfilesService.GetUserDataset()
+32
mccreaengineering.ProjectMgr.licenseusers.BindDataGrid() +101
mccreaengineering.ProjectMgr.licenseusers.Page_Load(Object sender,
EventArgs e) +300
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top