Hi Guys,
I need to upload a image binary data to server using a web service API generated from wsdl file. I read the byte[] from image file, and passed it to the web service API, then the API throwed an exception said "System.Web.Services.Protocols.SoapException: For input string: ' [here is the base64binary string for my image file] ' ". This issue draged me crazy, can anyone help me out?
Here is web service API define:
public BaseWSDto uploadImage([System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary", IsNullable=true)] byte[] imageByteArray) {
object[] results = this.Invoke("uploadImage", new object[] {imageByteArray});
rturn (BaseWSDto)results[0];
}
Here is how I call the API:
FileStream fs = new FileStream(imageFile, FileMode.Open, FileAccess.Read);
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, Convert.ToInt32(fs.Length));
BaseWSDto result = client.uploadImage(buffer);