Streaming the response of type byte[]
-
I'm trying to write a client for a webservice method, which responds with byte[] I would like to stream it because byte[] will be failed if there is large file. I changed Transfer Mode and Encoding to Streamed and Mtom respectively. I commented XMLTypeAttribute declaration in reference file for the byte[] class. Please correct the code. Reference.cs
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4016")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
//[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http//tempuri.org/sample/types")]
public partial class echoBinaryDataResponse : object, System.ComponentModel.INotifyPropertyChanged {private byte\[\] paramField; /// \[System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary", Order = 0)\] public byte\[\] param { get { return this.paramField; } set { this.paramField = value; this.RaisePropertyChanged("param"); } }
My client call -----------
ServiceReference1.echoBinaryData echo = new ServiceReference1.echoBinaryData();
MemoryStream str = new MemoryStream(myByteArray);
echo.param = str;
ServiceReference1.echoBinaryDataResponse echoResp = new ServiceReference1.echoBinaryDataResponse();
ServiceReference1.SamplePortTypeClient sample = new ServiceReference1.SamplePortTypeClient();
sample.echoBinaryData(echo);-----getting exception hereNote: myByteArray is of type byte[];
-
I'm trying to write a client for a webservice method, which responds with byte[] I would like to stream it because byte[] will be failed if there is large file. I changed Transfer Mode and Encoding to Streamed and Mtom respectively. I commented XMLTypeAttribute declaration in reference file for the byte[] class. Please correct the code. Reference.cs
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4016")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
//[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http//tempuri.org/sample/types")]
public partial class echoBinaryDataResponse : object, System.ComponentModel.INotifyPropertyChanged {private byte\[\] paramField; /// \[System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary", Order = 0)\] public byte\[\] param { get { return this.paramField; } set { this.paramField = value; this.RaisePropertyChanged("param"); } }
My client call -----------
ServiceReference1.echoBinaryData echo = new ServiceReference1.echoBinaryData();
MemoryStream str = new MemoryStream(myByteArray);
echo.param = str;
ServiceReference1.echoBinaryDataResponse echoResp = new ServiceReference1.echoBinaryDataResponse();
ServiceReference1.SamplePortTypeClient sample = new ServiceReference1.SamplePortTypeClient();
sample.echoBinaryData(echo);-----getting exception hereNote: myByteArray is of type byte[];
NarVish wrote:
sample.echoBinaryData(echo);-----getting exception here
What exception?
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
-
NarVish wrote:
sample.echoBinaryData(echo);-----getting exception here
What exception?
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
-
Sorry, forgot to add the exception Exception:There was an error reflecting 'echoBinaryData'.
You need to trap this with your debugger or add some more code to identify the inner exception. "There was an error" tells us nothing.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
-
You need to trap this with your debugger or add some more code to identify the inner exception. "There was an error" tells us nothing.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
-
Irrespective of above exceptions, can u just guide me to stream byte array (which comes as response of webmethod)
Sorry, not something I have much experience of. Try the articles section or the MSDN documentation.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
-
Sorry, not something I have much experience of. Try the articles section or the MSDN documentation.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness