all groups > dotnet web services > march 2007 >
You're in the

dotnet web services

group:

WebService over FTP


WebService over FTP Peter Morris
3/27/2007 12:00:00 AM
dotnet web services:
Hi all


I would like my Pocket PC application (.NET Compact Framwork V2) to talk to
a webservice, but the only port open on the server is 21 where an FTP server
is sitting.

I was wondering if it is possible to stream WS requests to a MemoryStream
which I can then ZIP and put onto the FTP, and then maybe have a service on
the server which looks for these files and calls the webservice on the local
machine eventually streaming the response back into a MemoryStream which I
zip and make available on the FTP server?

Basicaly I need to know if I can use webservices over FTP on .NET 2 compact
framework.


Thanks


Pete

Re: WebService over FTP Peter Morris
3/27/2007 5:53:27 PM
Okay, I have managed to get the web service client to stream its request to
an XML file which I then FTP onto the server. What I need to do next is to
HTTP Post that XML to the real web service....


WebService definition
=====================
[WebMethod]
public string StartSession(string deviceUniqueID, string
applicationVersion)
{
return "SessionID";
}


CLIENT
======
private string QueryXml = "<?xml version=\"1.0\"
encoding=\"utf-8\"?><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><StartSession
xmlns=\"http://tempuri.org/\"><deviceUniqueID>123</deviceUniqueID><applicationVersion>123</applicationVersion></StartSession></soap:Body></soap:Envelope>";

private void Form1_Load(object sender, EventArgs e)
{
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://localhost/HandheldVendorWebService/SyncService.asmx");
request.Method = "POST";
request.ContentType = "text/xml";
request.ContentLength = QueryXml.Length;
byte[] postData = System.Text.ASCIIEncoding.ASCII.GetBytes(QueryXml);
request.GetRequestStream().Write(postData, 0, postData.Length);
/*******************************/
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
textBox1.Text = reader.ReadToEnd();
}The QueryXml string is exactly what is generated by the client to call
StartSession(). When I call request.GetResponse() I get "500 Internal
server error", but this works fine in the test page inside Internet
Explorer.Any ideas?ThanksPete

AddThis Social Bookmark Button