Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

webservice sending object - serialisation error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rotsey - 01 Aug 2007 05:54 GMT
Hi,

I am trying to send a object to a webservice and I get an serialisation
error
on the object saying "object not expected" add "XmlInclude or
SoapInclude attribute"

I have done this but still get the error.

Below is the class. The problem is with "data" object.

I want to send different classes not known to the service wrapped
in another object.

Antyone know why?

Is there a better method I am missing?

rotsey

[XmlInclude(typeof(NukedEmShot))]

public class BroadcastMessage

{

private BroadcastMessageType messageType;

public BroadcastMessageType MessageType

{

get { return MessageType;}

set { MessageType = value;}

}

[XmlElement(typeof(NukedEmShot))]

private object data;

public object Data

{

get { return data; }

set { data = value; }

}

private string sender;

public string Sender

{

get { return sender; }

set { sender = value; }

}

private ArrayList recipients;

public ArrayList Recipients

{

get { return recipients; }

set { recipients = value; }

}

private ReturnStatus status;

public ReturnStatus Status

{

get { return status; }

set { status = value; }

}

public BroadcastMessage()

{

}

}
John Saunders [MVP] - 01 Aug 2007 15:34 GMT
> Hi,
>
[quoted text clipped - 13 lines]
>
> Is there a better method I am missing?

How will the service process the objects of types it doesn't know about? How
would the service know how to deserialize the objects?

Depending on what you expect to have happen, you might need to process the
data as XML.
Signature

John Saunders [MVP]

Rotsey - 02 Aug 2007 05:14 GMT
John,

What I am trying to do is send data to the webservice and that other
requests can receive. I am using the Application object for this.
This is a small appliation with not much data being sent.

So I have several objects that I want to wrap in a  wrapper class
and send to be broadcasted.

I tried your idea of sending xml, so I serialize my objects and
then send then in a string in the wrapper class

Now I get this error message

Client found response content type of 'text/html; charset=utf-8', but
expected 'text/xml'.

Do you have any input in the way I should do this?

rotsey

>> Hi,
>>
[quoted text clipped - 19 lines]
> Depending on what you expect to have happen, you might need to process the
> data as XML.
John Saunders [MVP] - 02 Aug 2007 15:41 GMT
> John,
>
[quoted text clipped - 12 lines]
> Client found response content type of 'text/html; charset=utf-8', but
> expected 'text/xml'.

This message means that you've received an error from ASP.NET in the form of
a HTML page. You should look at the HTML to see what the error is.
Alternatively, you should look in the Application event log for warning
messages from ASP.NET. Look to see what error is happening. It may be due to
a simple bug in your code rather than a problem with the technique.
Signature

John Saunders [MVP]


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.