XmlSerializer, XSD and Web Service

O

Oscar Thornell

Hi,

1) I start with an XmlSchema...
2) I use xsd.exe MySchema.xsd /c to generate C# classes for the schema
3) I create an ASP.NET web service that exposes the root of the object
tree/xml schema
[WebMethod]
public void UploadData(MyObject obj)
{
....
}

4) I read an xml file from disk in my test app...
5) I Use XmlSerializer to serialize the xml to my generated/defined object
"MyObject"
6) Everything looks good on the client side...my object is full of data from
the xml file...
7) I call my web service....service.UploadData(obj);
8) On the Web Service side my obj is NULL...

Something bad is happening on the server side here...but what??

Help is needed!

/Oscar
 
L

Leon Friesema

Hi,

1) I start with an XmlSchema...
2) I use xsd.exe MySchema.xsd /c to generate C# classes for the schema
3) I create an ASP.NET web service that exposes the root of the object
tree/xml schema
[WebMethod]
public void UploadData(MyObject obj)
{
....
}

4) I read an xml file from disk in my test app...
5) I Use XmlSerializer to serialize the xml to my generated/defined object
"MyObject"
6) Everything looks good on the client side...my object is full of data from
the xml file...
7) I call my web service....service.UploadData(obj);
8) On the Web Service side my obj is NULL...

Something bad is happening on the server side here...but what??

Help is needed!

/Oscar

Is your object [Serializable]?

And besides that, I never tried to push my own objects to a
WebService, because I thought that couldn't be done (could be wrong
though)

Leon.
 
O

Oscar Thornell

Well it´s solved now...sort of...when the xsd.exe generates the classes the
tool tags them with alot of attributes...
I removed all of them except the xmlserialization ones...and now it
works....except that the wsdl files is messed up...had to do that manually
as well...

/Oscar


Leon Friesema said:
Hi,

1) I start with an XmlSchema...
2) I use xsd.exe MySchema.xsd /c to generate C# classes for the schema
3) I create an ASP.NET web service that exposes the root of the object
tree/xml schema
[WebMethod]
public void UploadData(MyObject obj)
{
....
}

4) I read an xml file from disk in my test app...
5) I Use XmlSerializer to serialize the xml to my generated/defined object
"MyObject"
6) Everything looks good on the client side...my object is full of data
from
the xml file...
7) I call my web service....service.UploadData(obj);
8) On the Web Service side my obj is NULL...

Something bad is happening on the server side here...but what??

Help is needed!

/Oscar

Is your object [Serializable]?

And besides that, I never tried to push my own objects to a
WebService, because I thought that couldn't be done (could be wrong
though)

Leon.
 

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

Top