1

http://commerce.qa.mycomp.comでホストされている安らかな Web サービスにアクセスする単純な appengine プロジェクトを作成しました(mycomp は実際の会社名に置き換える必要があります)。

クライアントリクエストを行うためにJersey Clientを使用しています。上記の URL に POST リクエストを送信します。アプリケーションをローカルで実行すると、常に 404 Not Found 応答が返されます。実験のために、私はhttp://www.bbc.co.uk/news/に POST リクエストを送信しました。これは正常に動作し、ステータスとして 200 を返します。

I just decoupled my app from appengine and ran it in the separately-configured tomcat server, and there it works fine and returns 200 status code. I think appengine uses Jetty as the server. Does Jetty have any bugs processing urls like commerce.qa.mycomp.com. Why I am asking this is urls that start with www.any.com seems to be working fine.

The two code snippets shown below is not working when run within appengine locally(not running even if I host it to appspot).

Client client = Client.create();
WebResource service = client.resource("http://commerce.qa.mycomp.com/rest");
ClientResponse response = service
    .header("Content-Type", "text/xml; Charset=utf-8")
.header("Authorization", "Basic dwt3hkl553lsfsfssf3")
.post(ClientResponse.class, "does not need to be actual xml");

URL url = new URL("http://commerce.qa.mycomp.com/rest");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/xml; Charset=utf-8");
conn.addRequestProperty("Authorization", "Basic dwt3hkl553lsfsfssf3");
OutputStream os = conn.getOutputStream();
os.write("no need to be actual xml".getBytes());
os.flush();
System.out.println("Response Code: " + conn.getResponseCode());

But when run with tomcat, it just works.

My installations are: Google App Engine Java SDK 1.6.1 Google Plugin for Eclipse 3.7 jersey-client-1.12, jersey-core-1.12, jersey-json-1.8

Please share thoughts.

4

0 に答える 0