Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - WCF RC1: having problem with the DataContract attribute

 
 
Old 10-20-2006   #1 (permalink)
Steve B.


 
 

WCF RC1: having problem with the DataContract attribute

Hi,

I'm building a small application that can send data between servers.

The Data object is a simple class with 3 properties (2 strings, and a byte[]
array).

If I add [DataMember] over each properties, the call to the remote server
throw an error : 400 Bad Request (I'm using the wsHttpBinding).

If I remove the [DataMember] attribute, the remote method is reached, but
each properties of my object is "null" (normal since the datamember
attribute is not set).

As I said in a previous post, the server sometimes acts as client, sometimes
act as server. Then I don't use a proxy created by VS, but a ChannelFactory.

What is wrong ?

Thanks in advance for any help...
Steve

[DataContract]

public class MyDataClass

{

private byte[] m_bytes;


[DataMember]

public byte[] Bytes

{

get { return m_bytes; }

set { m_bytes= value; }

}

private string m_string2;

[DataMember]

public string String2

{

get { return m_string2; }

set { m_string2= value; }

}

private string m_string1;

[DataMember]

public string String1

{

get { return m_string1; }

set { m_string1= value; }

}



public MyDataClass(

string string1,

string string1,

byte[] raw

)

{

this.m_string1= string1;

this.m_string1= string1;

this.m_raw= raw;

}

public MyDataClass()

{

}

}



My System SpecsSystem Spec
Old 10-20-2006   #2 (permalink)
Steve B.


 
 

Re: WCF RC1: having problem with the DataContract attribute

I found the reason of this error ... The array of byte exceeds 16K, and it
is more than what the default behaviour allow.

What are the possible solutions ? The byte array was used to embed files...
Is there any other better way to transfert file ? (which should be quite
large (up to 100 Mo)...

Steve
"Steve B." <steve_beauge@com.msn_swap_msn_and_com> a écrit dans le message
de news: OUYqIyC9GHA.1172@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I'm building a small application that can send data between servers.
>
> The Data object is a simple class with 3 properties (2 strings, and a
> byte[] array).
>
> If I add [DataMember] over each properties, the call to the remote server
> throw an error : 400 Bad Request (I'm using the wsHttpBinding).
>
> If I remove the [DataMember] attribute, the remote method is reached, but
> each properties of my object is "null" (normal since the datamember
> attribute is not set).
>
> As I said in a previous post, the server sometimes acts as client,
> sometimes act as server. Then I don't use a proxy created by VS, but a
> ChannelFactory.
>
> What is wrong ?
>
> Thanks in advance for any help...
> Steve
>
> [DataContract]
>
> public class MyDataClass
>
> {
>
> private byte[] m_bytes;
>
>
> [DataMember]
>
> public byte[] Bytes
>
> {
>
> get { return m_bytes; }
>
> set { m_bytes= value; }
>
> }
>
> private string m_string2;
>
> [DataMember]
>
> public string String2
>
> {
>
> get { return m_string2; }
>
> set { m_string2= value; }
>
> }
>
> private string m_string1;
>
> [DataMember]
>
> public string String1
>
> {
>
> get { return m_string1; }
>
> set { m_string1= value; }
>
> }
>
>
>
> public MyDataClass(
>
> string string1,
>
> string string1,
>
> byte[] raw
>
> )
>
> {
>
> this.m_string1= string1;
>
> this.m_string1= string1;
>
> this.m_raw= raw;
>
> }
>
> public MyDataClass()
>
> {
>
> }
>
> }
>
>



My System SpecsSystem Spec
Old 10-20-2006   #3 (permalink)
Arkady Frenkel


 
 

Re: WCF RC1: having problem with the DataContract attribute

IMHO you need stream for that.Check
http://windowssdk.msdn.microsoft.com...20(VS.80).aspx
Arkady

"Steve B." <steve_beauge@com.msn_swap_msn_and_com> wrote in message
news:uW0KCpE9GHA.4644@TK2MSFTNGP04.phx.gbl...
>I found the reason of this error ... The array of byte exceeds 16K, and it
>is more than what the default behaviour allow.
>
> What are the possible solutions ? The byte array was used to embed
> files... Is there any other better way to transfert file ? (which should
> be quite large (up to 100 Mo)...
>
> Steve
> "Steve B." <steve_beauge@com.msn_swap_msn_and_com> a écrit dans le message
> de news: OUYqIyC9GHA.1172@TK2MSFTNGP03.phx.gbl...
>> Hi,
>>
>> I'm building a small application that can send data between servers.
>>
>> The Data object is a simple class with 3 properties (2 strings, and a
>> byte[] array).
>>
>> If I add [DataMember] over each properties, the call to the remote server
>> throw an error : 400 Bad Request (I'm using the wsHttpBinding).
>>
>> If I remove the [DataMember] attribute, the remote method is reached, but
>> each properties of my object is "null" (normal since the datamember
>> attribute is not set).
>>
>> As I said in a previous post, the server sometimes acts as client,
>> sometimes act as server. Then I don't use a proxy created by VS, but a
>> ChannelFactory.
>>
>> What is wrong ?
>>
>> Thanks in advance for any help...
>> Steve
>>
>> [DataContract]
>>
>> public class MyDataClass
>>
>> {
>>
>> private byte[] m_bytes;
>>
>>
>> [DataMember]
>>
>> public byte[] Bytes
>>
>> {
>>
>> get { return m_bytes; }
>>
>> set { m_bytes= value; }
>>
>> }
>>
>> private string m_string2;
>>
>> [DataMember]
>>
>> public string String2
>>
>> {
>>
>> get { return m_string2; }
>>
>> set { m_string2= value; }
>>
>> }
>>
>> private string m_string1;
>>
>> [DataMember]
>>
>> public string String1
>>
>> {
>>
>> get { return m_string1; }
>>
>> set { m_string1= value; }
>>
>> }
>>
>>
>>
>> public MyDataClass(
>>
>> string string1,
>>
>> string string1,
>>
>> byte[] raw
>>
>> )
>>
>> {
>>
>> this.m_string1= string1;
>>
>> this.m_string1= string1;
>>
>> this.m_raw= raw;
>>
>> }
>>
>> public MyDataClass()
>>
>> {
>>
>> }
>>
>> }
>>
>>

>
>



My System SpecsSystem Spec
Old 10-20-2006   #4 (permalink)
Joerg Jooss


 
 

Re: WCF RC1: having problem with the DataContract attribute

Thus wrote Arkady,

> IMHO you need stream for that.Check
> http://windowssdk.msdn.microsoft.com...520(VS.80).asp
> x Arkady


Not only in your opinion ;-)

Streams are the *only* way to handle such a payload, as messages are fully
buffered in memory.

Cheers,
--
Joerg Jooss
news-reply@joergjooss.de


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
ConfigurationManager with file attribute problem .NET General
Temp Folder Attribute Problem Vista file management
How to insert the "modified time" attribute in "date taken" attribute in batch mode-in vista or theough a software? Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46