DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 1 Aug 2007 14:54:08 +1000,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Rotsey
          2    John Saunders [MVP] john.saunders at trizetto.com
                 3    Rotsey
                        4    John Saunders [MVP] john.saunders at trizetto.com


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

{

}

}
Date:Wed, 1 Aug 2007 14:54:08 +1000   Author:  

Re: webservice sending object - serialisation error   
"Rotsey"  wrote in message 
news:%2395O8f$0HHA.4932@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]
Date:Wed, 1 Aug 2007 10:34:54 -0400   Author:  

Re: webservice sending object - serialisation error   
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.com> wrote in message 
news:%23EuhhkE1HHA.6072@TK2MSFTNGP03.phx.gbl...

> "Rotsey"  wrote in message 
> news:%2395O8f$0HHA.4932@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]
> 
Date:Thu, 2 Aug 2007 14:14:10 +1000   Author:  

Re: webservice sending object - serialisation error   
"Rotsey"  wrote in message 
news:OBZCQuL1HHA.5532@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]
Date:Thu, 2 Aug 2007 10:41:26 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us