I'm using a web service created in C#, its purpose is to get files from a server, and I'm trying to use it in AIR 2 (AS3).
Actually I can communicate with the web service with this library: http://labs.alducente.com/gophr/
When I call the webservice function I get this XML:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetFileResponse xmlns="http://tempuri.org/">
<GetFileResult>ZXN0byBlcyB1bmEgcHJ1ZWJhDQoNCnZhbW9zIGEgdmVyIHNpIHRyYWJhamENCg0KbXVhamphamFq</GetFileResult>
</GetFileResponse>
</soap:Body>
</soap:Envelope>
The file is encoded inside this tag:
< GetFileResult >
ZXN0byBlcyB1bmEgcHJ1ZWJhDQoNCnZhbW9zIGEgdmVyIHNpIHRyYWJhamENCg0KbXVhamphamFq
< /GetFileResult >
So how can I decode and write to hard drive...
Web service code:
[WebMethod]
public byte[] GetFile(string path)
{
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
// Create a byte array of file stream length
byte[] ImageData = new byte[fs.Length];
//Read block of bytes from stream into the byte array
fs.Read(ImageData,0,System.Convert.ToInt32(fs.Length));
//Close the File Stream fs.Close();
return ImageData;
//return the byte data
}