[google-appengine] Re: How to write a C# client to access google app engine?

2010-08-19 Thread Darien Caldwell

On Aug 18, 6:04 pm, Vassili vassi...@gmail.com wrote:
 My post is regarding Google App Engine Plug-in for Eclipse. I am
 working with the default project there (which is using a POST, not a
 GET, as in you case).
 Did you create your application using that plug-in? If not, then we
 are talking about different things.

Not really. All App Engine applications are just web services, whether
made with a plugin or not. They are accessed via HTTP requests, and
return HTTP responses. There's nothing hidden, magical, or secret
about how that's done. The whole World Wide Web is built on the very
public HTTP standard.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: How to write a C# client to access google app engine?

2010-08-18 Thread Vassili
I do understand how browsers work:)
Unfortunately the request sent by the web browser is quite hidden by
Google App Engine plugin in all the html/java script unfriendly
looking files it creates for you.
I even do not know the name of the parameter of this default google
app engine project.
What I am asking is not a program in C#, but a simple concrete example
in ANY language for sending this POST request in any format you wish.
Interpreting the returned results is not needed (but details are
important, like the parameter name).

Thanks,
Vassili

On Aug 18, 5:29 am, Greg g.fawc...@gmail.com wrote:
 You need to understand how browsers work - in a nutshell, they send a
 request for a URL, and the server returns data. In most cases this
 data is HTML code to be rendered by your browser, but you can in fact
 make it anything you want - XML, JSON or a custom data format.

 Your C# application needs to be able to make an HTTP request to your
 URL, and then interpret the returned data. I don't know C# at all, but
 it must contain components to do the request part of this. That leaves
 you to add code to do whatever it is you want to with tee returned
 data.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: How to write a C# client to access google app engine?

2010-08-18 Thread bFlood
here's a decent example of how to use C# to authenticate using Google
ClientLogin. There enough code in there to see how you would GET/POST
against HTTP endpoints as well
http://dalelane.co.uk/blog/?p=894

we use C# (but any language would do) for our client libraries and
bulkloader and its been working great

cheers
brian


On Aug 18, 5:51 am, Vassili vassi...@gmail.com wrote:
 I do understand how browsers work:)
 Unfortunately the request sent by the web browser is quite hidden by
 Google App Engine plugin in all the html/java script unfriendly
 looking files it creates for you.
 I even do not know the name of the parameter of this default google
 app engine project.
 What I am asking is not a program in C#, but a simple concrete example
 in ANY language for sending this POST request in any format you wish.
 Interpreting the returned results is not needed (but details are
 important, like the parameter name).

 Thanks,
 Vassili

 On Aug 18, 5:29 am, Greg g.fawc...@gmail.com wrote:



  You need to understand how browsers work - in a nutshell, they send a
  request for a URL, and the server returns data. In most cases this
  data is HTML code to be rendered by your browser, but you can in fact
  make it anything you want - XML, JSON or a custom data format.

  Your C# application needs to be able to make an HTTP request to your
  URL, and then interpret the returned data. I don't know C# at all, but
  it must contain components to do the request part of this. That leaves
  you to add code to do whatever it is you want to with tee returned
  data.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: How to write a C# client to access google app engine?

2010-08-18 Thread Vassili
Thanks for the link.
So is it so hidden? Has anyone been able to decode the Webservice
beyond the default project created with the Eclipse plugin?

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: How to write a C# client to access google app engine?

2010-08-18 Thread Vassili
OK guys and gals, I got it! If you also use google app engine plugin
for Eclipse, read on since there is a hack I have not found anywhere
else out there.

Here is the answer in C#:

WebRequest request = WebRequest.Create(http://
1.latest.myapp.appspot.com/appname/greet);
request.Credentials = CredentialCache.DefaultCredentials;

request.Method = POST;
request.ContentType = text/x-gwt-rpc; charset=utf-8;

string content = 5|0|6|http://1.latest.myapp.appspot.com/
myapp/|AF76B9CA2759BDA4DBA207D5542054B2|myapp.client.GreetingService|
greetServer|java.lang.String/2004016611|ThisIsAParameterValue|1|2|3|4|
1|5|6|;
byte[] contentBytes =
System.Text.UTF8Encoding.UTF8.GetBytes(content);
request.ContentLength = contentBytes.Length;
using (Stream stream = request.GetRequestStream())
{
stream.Write(contentBytes, 0, contentBytes.Length);
}

WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
Console.WriteLine(responseFromServer);
reader.Close();
response.Close();

The hacky part here is the content string, especially the magic guid
AF76B9CA2759BDA4DBA207D5542054B2.
You will (very probably) have a different guid. To figure out what you
need to submit for the request do the following:
- either print the value of request.getInputStream() from your servlet
when you get a request
- or go to war/yourapp/anotherguid.cache.html (this file is created
when you compile your project) and look for the mS parameter defined
there

The question remains why Google made it so complicated? Or am I
missing something and there is a much simpler solution?

Cheers,
Vassili

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: How to write a C# client to access google app engine?

2010-08-18 Thread Spines
I'm not sure what you're talking about with respect to decoding the
Webservice, but my application uses a c# client to access it.  Here is
the c# code where it accesses it:


HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = GET;
req.KeepAlive = false;
using (var respstream = req.GetResponse().GetResponseStream())
return respstream.ReadFully();


ReadFully is just an extension method that fully reads a stream.

Hope this helps!

On Aug 18, 4:13 pm, Vassili vassi...@gmail.com wrote:
 Thanks for the link.
 So is it so hidden? Has anyone been able to decode the Webservice
 beyond the default project created with the Eclipse plugin?

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: How to write a C# client to access google app engine?

2010-08-18 Thread Vassili
My post is regarding Google App Engine Plug-in for Eclipse. I am
working with the default project there (which is using a POST, not a
GET, as in you case).
Did you create your application using that plug-in? If not, then we
are talking about different things.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: How to write a C# client to access google app engine?

2010-08-17 Thread Greg
You need to understand how browsers work - in a nutshell, they send a
request for a URL, and the server returns data. In most cases this
data is HTML code to be rendered by your browser, but you can in fact
make it anything you want - XML, JSON or a custom data format.

Your C# application needs to be able to make an HTTP request to your
URL, and then interpret the returned data. I don't know C# at all, but
it must contain components to do the request part of this. That leaves
you to add code to do whatever it is you want to with tee returned
data.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.