Ray Booysen said:
Is the RemoteUserDataBean class serializable?
That was part of the problem.
I needed to make the RemoteUserDataBean Serializable (as well as the
DataBean it was inherited from).
But I am still getting a problem if I just define the Service.
I made sure I set the classes to Serializable but I am still getting an
error:
Here is the code VS creates when I added the Web Server:
*****************************************************************************
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.2032
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
//
// This source code was auto-generated by Microsoft.VSDesigner, Version
1.1.4322.2032.
//
namespace NewHires.RemoteUser {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="RemoteUserServiceSoapBinding",
Namespace="
http://10.0.0.3:8082/data_connect/services/RemoteUserService")]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(ScorpeoDataBean))]
[Serializable]
public class RemoteUserServiceService :
System.Web.Services.Protocols.SoapHttpClientProtocol
{
/// <remarks/>
public RemoteUserServiceService() {
this.Url =
"
http://10.0.0.3:8082/data_connect/services/RemoteUserService";
}
/// <remarks/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("",
RequestNamespace="
http://webservice.fwdco.com",
ResponseNamespace="
http://10.0.0.3:8082/data_connect/services/RemoteUserService")]
[return:
System.Xml.Serialization.SoapElementAttribute("fetchRemoteUserInfoReturn")]
public RemoteUserDataBean fetchRemoteUserInfo(string in0, string
in1, string in2, string in3, string in4) {
object[] results = this.Invoke("fetchRemoteUserInfo", new
object[] {
in0,
in1,
in2,
in3,
in4});
return ((RemoteUserDataBean)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginfetchRemoteUserInfo(string in0,
string in1, string in2, string in3, string in4, System.AsyncCallback
callback, object asyncState) {
return this.BeginInvoke("fetchRemoteUserInfo", new object[] {
in0,
in1,
in2,
in3,
in4}, callback, asyncState);
}
/// <remarks/>
public RemoteUserDataBean EndfetchRemoteUserInfo(System.IAsyncResult
asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((RemoteUserDataBean)(results[0]));
}
}
/// <remarks/>
[System.Xml.Serialization.SoapTypeAttribute("RemoteUserDataBean",
"com.fwdco.wsbeans")]
[Serializable]
public class RemoteUserDataBean : ScorpeoDataBean {
/// <remarks/>
public string employeeId;
/// <remarks/>
public string[][] employerList;
/// <remarks/>
public string ipAddress;
/// <remarks/>
public string password;
/// <remarks/>
public string peoContactEmail;
/// <remarks/>
public string userName;
/// <remarks/>
public string valid;
}
/// <remarks/>
[System.Xml.Serialization.SoapTypeAttribute("ScorpeoDataBean",
"
http://wsbeans.fwdco.com")]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(RemoteUserDataBean))]
[Serializable]
public class ScorpeoDataBean {
/// <remarks/>
public string businessType;
/// <remarks/>
public string chksm;
/// <remarks/>
public string debug;
/// <remarks/>
public string debugId;
/// <remarks/>
public string emailFrom;
/// <remarks/>
public string emailHost;
/// <remarks/>
public string[] emailList;
/// <remarks/>
public string emailMessage;
/// <remarks/>
public string emailPort;
/// <remarks/>
public string emailSubject;
/// <remarks/>
public string[][] employeeList;
/// <remarks/>
public int errorCode;
/// <remarks/>
public string errorMessage;
/// <remarks/>
public string[][] fieldPermissions;
/// <remarks/>
public string menuName;
/// <remarks/>
public string securityFilter;
/// <remarks/>
public string[][] securityFilterDetail;
/// <remarks/>
public string userId;
/// <remarks/>
public string userMessage;
/// <remarks/>
public string userType;
}
}
******************************************************************
I also changed the .cs file to take out the DataBean and add in the
reference to the Web Service:
*********************************************************************
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;
using NewHires.RemoteUser;
using MyFunctions;
namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>
[Serializable]
public class NewHire
{
RemoteUserServiceService remoteUserService = new
RemoteUserServiceService();
public NewHire(string sessionIDPassed,int applicantIDpassed)
{
}
}
}
***********************************************************************
Thanks,
Tom
tshad said:
Here is a stripped down version of the class:
************************************************************************************
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;
using MyFunctions;
namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>
[Serializable]
public class NewHire
{
private int applicantID = 0;
private string sessionID = "";
NewHires.RemoteUser.RemoteUserDataBean ruDataBean; <--
Take out and it serializes
DataSet ds = new DataSet("NewHires");
public NewHire(string sessionIDPassed,int applicantIDpassed)
{
applicantID = applicantIDpassed;
sessionID = sessionIDPassed;
NewHireLogon(sessionID);
}
private void NewHireLogon(string sessionID)
{
}
}
}
**************************************************************************
The RemoteUser (above) is a Web Service. Even with the Web Service added
to the DLL, there is no problem. But when I add this line, it causes the
error.
Tom.
Ray Booysen said:
tshad wrote:
Post the rest of the class...
So far, you posted nothing to serialize.
I will need to put together a stripped down version as this one is very
large with about 6 web services.
Thanks,
Tom
You still need to post code! The code you posted before shows nothing
that could cause the problem. What else is in the NewHire class?
--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp
I had asked about this before, but have been unable to solve the
problem. Could this be a problem with Web Services?
I have 4 web services that I reference in this object. There is only
one class.
I have an object I am unable to put in my session. I have others
that have
no problem. The difference is the the one I am having problems with
was
created in VS 2003. The others were created using DW and compiling
using the
commandline and they work fine.
The error I am getting is:
Unable to serialize the session state. Please note that
non-serializable
objects or MarshalByRef objects are not permitted when session state
mode is
'StateServer' or 'SQLServer'.
The start of the code is:
namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>
[Serializable]
public class NewHire
{
Why won't this work?
Thanks,
Tom