A
Arcadius A.
Hello!
I'm implementing a simple .NET(C#) web service.
The experiment is to pass custom object or complex data type as the
input parameter to my web service.
I have created a custom class:
[Serializable]
public class Person
{
private int userid;
private string username;
....
public string Username
{
get{ return username;}
set{username=value;}
}
...
}
Now, my web service has a method:
[WebMethod]
public int addUser(Person p)
{
Console.WriteLine("User ID is: "+p.Username);// line#278 !
return 0;
}
At the top of the web service provider class, I have
[System.Xml.Serialization.XmlInclude(typeof(Person))]
I have a .NET GUI client that takes as input a userID, username etc etc.
When I call the addUser() method using the .NET client, it just fails,
complaining about "System.NullReferenceException: Object reference not
set to an instance of an object .....
at addUser(Person p) in ...dp.asmx.cs line 278 "
So, there is something wrong with the web service provider.
I'm sure that my client works fine and send a non-empty object
correctly(I've tested it with a Java implementation of the same service,
It also works fine with other methods in this problememtic .NET
provider, but I'm having troubles with the only method that takes
complex data type.) It seems(?) that the problem is with the web service
provider not being able to unmarshall the sent object.
Any help is welcome.
Arcadius.
I'm implementing a simple .NET(C#) web service.
The experiment is to pass custom object or complex data type as the
input parameter to my web service.
I have created a custom class:
[Serializable]
public class Person
{
private int userid;
private string username;
....
public string Username
{
get{ return username;}
set{username=value;}
}
...
}
Now, my web service has a method:
[WebMethod]
public int addUser(Person p)
{
Console.WriteLine("User ID is: "+p.Username);// line#278 !
return 0;
}
At the top of the web service provider class, I have
[System.Xml.Serialization.XmlInclude(typeof(Person))]
I have a .NET GUI client that takes as input a userID, username etc etc.
When I call the addUser() method using the .NET client, it just fails,
complaining about "System.NullReferenceException: Object reference not
set to an instance of an object .....
at addUser(Person p) in ...dp.asmx.cs line 278 "
So, there is something wrong with the web service provider.
I'm sure that my client works fine and send a non-empty object
correctly(I've tested it with a Java implementation of the same service,
It also works fine with other methods in this problememtic .NET
provider, but I'm having troubles with the only method that takes
complex data type.) It seems(?) that the problem is with the web service
provider not being able to unmarshall the sent object.
Any help is welcome.
Arcadius.