I printed out the output for both the good and bad ones. I noticed the content-type is text/html when I call the REST service within Weblogic. It should be application/json since the code is exactly the same.
ERROR
=====
connAllowUserInteraction: false
connContentType:
text/html
connContentEncoding: null
connRequestMethod: POST
connDoInput: true
connDoOutput: true
connPermission: (java.net.SocketPermission servername:80 connect,resolve)
connURL:
http://servername/rest/user/login
connHeaderField: null
=[HTTP/1.1 401 Unauthorized: Missing required argument username]
connHeaderField: ETag=["1348297842"]
connHeaderField: Date=[Sat, 22 Sep 2012 07:10:42 GMT]
connHeaderField: Vary=[Accept]
connHeaderField: Transfer-Encoding=[chunked]
connHeaderField: Expires=[Sun, 19 Nov 1978 05:00:00 GMT]
connHeaderField: Last-Modified=[Sat, 22 Sep 2012 07:10:42 GMT]
connHeaderField: Connection=[close]
connHeaderField: Content-Type=[text/html]
connHeaderField: Server=[Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8m DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635]
connHeaderField: X-Powered-By=[PHP/5.2.17]
connHeaderField: Cache-Control=[no-cache, must-revalidate, post-check=0, pre-check=0]
GOOD
====
connAllowUserInteraction: false
connContentType:
application/json
connContentEncoding: null
connRequestMethod: POST
connDoInput: true
connDoOutput: true
connPermission: (java.net.SocketPermission servername:80 connect,resolve)
connURL:
http://servername/rest/user/login
connHeaderField: null=[HTTP/1.1 200 OK]
connHeaderField: ETag=["1348297985"]
connHeaderField: Expires=[Sun, 19 Nov 1978 05:00:00 GMT]
connHeaderField: Last-Modified=[Sat, 22 Sep 2012 07:13:05 GMT]
connHeaderField: Set-Cookie=[SESS0b960ba15fe89f91c2c8b1f79c14a60f=Xehs0in8jvrGLHaPBh3EqkMTdVtCAx_DhFAVse18a4E; expires=Mon, 15-Oct-2012 10:46:26 GMT; path=/; domain=servername; HttpOnly]
connHeaderField: Connection=[close]
connHeaderField: X-Powered-By=[PHP/5.2.17]
connHeaderField: Server=[Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8m DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635]
connHeaderField: Cache-Control=[no-cache, must-revalidate, post-check=0, pre-check=0]
connHeaderField: Transfer-Encoding=[chunked]
connHeaderField: Vary=[Accept]
connHeaderField: Date=[Sat, 22 Sep 2012 07:13:05 GMT]
connHeaderField: Content-Type=[application/json]