473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

webservice sending object - serialisation error

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()

{

}

}
Aug 1 '07 #1
3 1414
"Rotsey" <ma***********@RemoveThis.optusnet.com.auwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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?
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.
--
John Saunders [MVP]

Aug 1 '07 #2
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


"John Saunders [MVP]" <john.saunders at trizetto.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
"Rotsey" <ma***********@RemoveThis.optusnet.com.auwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>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?

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.
--
John Saunders [MVP]

Aug 2 '07 #3
"Rotsey" <ma***********@RemoveThis.optusnet.com.auwrote in message
news:OB**************@TK2MSFTNGP02.phx.gbl...
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'.
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.
--
John Saunders [MVP]

Aug 2 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JohnSmith | last post by:
Hi, I'm consuming a webservice which returns an XMLNode with VB.NET and XSLT and sending the output to Response.OutputStream If I feed the returned XMLNode directly in the transform method, I...
4
by: Nick Gilbert | last post by:
Hi, I'm developing a webservice that will accept an Order and forward it to a backend system, but I'm having a problem with transferring my "Order" class over a webservice. When I try and...
9
by: Nick Gilbert | last post by:
Hi, I'm trying to create a system whereby my desktop application submits it's order to an online server using a webservice (pretty standard!). So, I added a new project to my solution to...
4
by: luckyabhishek | last post by:
Hi I am using a java webservice in a .NET application. The xml type of a field in this webservice is xsd:datetime. When i call the webservice from the application i get a deserialization error on...
12
by: mumebuhi | last post by:
Hi, Is it possible to send a non-string object from a Python program to another? I particularly need to send a dictionary over to the other program. However, this is not possible using the...
10
by: Phillip Taylor | last post by:
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm having some trivial issues. In Visual Studio I create a web services project and change the asmx.vb file to this: Imports...
0
by: David Kemp | last post by:
Hi, I am using asp.net (vb.net) to access a set of 3rd party web services and have successfully accessed some of them, however, when I try to access a particular web service, I get the following...
2
by: ksheerasagar17 | last post by:
Hello All, Scenario: Sending an image through webservice as byte array to an Java webservice. The Problem1: The webservice method image property expects (data type) SByte rather than Byte...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.