Windows XP
FoxPro 6 sp5
Hi,
I need to know if this is possible in Foxpro 6 (the code is Csharp)
using System;
using System.IO;
using System.Net;
using System.Xml;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using java.io;
using java.util.zip;
namespace MISI.Sapiens.Client {
public partial class Main : Form {
public Main() {
InitializeComponent();
}
private void _btSend_Click(object sender, EventArgs e) {
// validate the xml
XmlDocument xml = new XmlDocument();
try {
xml.LoadXml(_tXml.Text);
}
catch(Exception) {
MessageBox.Show("Invalid Xml.");
return;
}
// get an array of bytes from this xml
byte[] buffer = Encoding.UTF8.GetBytes(xml.OuterXml);
// compress the xml into a memory stream
MemoryBuffer memory = new MemoryBuffer();
ZipOutputStream zip = new ZipOutputStream(memory);
// create the zip file entry
ZipEntry entry = new ZipEntry("XPTO.xml");
entry.setMethod(ZipEntry.DEFLATED);
zip.putNextEntry(entry);
for(int i = 0; i < buffer.Length; i ++) {
zip.write(buffer[i]);
}
zip.closeEntry();
zip.close();
// read the compressed bytes from the memory stream
memory.Stream.Position = 0;
buffer = new byte[memory.Stream.Length];
int bytes = memory.Stream.Read(buffer, 0, buffer.Length);
Prototype.Prototype ws = new Prototype.Prototype();
ws.PreAuthenticate = true;
ws.Url =
String.Format("http://{0}/XPTO.sapiens.webservices/prototype.asmx",
_tServer.Text);
ws.Credentials = new NetworkCredential(_tUser.Text.Split('\\')[1],
_tPwd.Text, _tUser.Text.Split('\\')[0]);
MessageBox.Show(ws.Upload(buffer));
memory.Stream.Close();
}
}
}
TIA,
ATSP