java - HTTP 400 Bad request - Only on JBoss Server -
i have rest service class, intends update inventory using put method via rest web service. when call service class junit or main class (public static void main
) inventory got update , don't issue.
but same service class throws exception when it's deployed jboss-eap server , called remote method, see following error in log,
http 400 - bad error sun.net.www.protocol.https.delegatehttpsurlconnection:https://www.webstore.com
please see below piece of code,
url apiurl = new url("https://..."); string authtobytes = username + ":" + password; byte authbytes[] = base64.encodebase64(authtobytes.getbytes()); string authbytesstring = new string(authbytes); conn = (httpurlconnection) apiurl.openconnection(); conn.setrequestmethod("put"); conn.setrequestproperty("accept", "application/xml"); conn.setdooutput(true); conn.setrequestproperty("authorization", "basic " + authbytesstring); outputstream output = new bufferedoutputstream(conn.getoutputstream()); output.write(body.getbytes()); //string body ="xml data.." output.flush(); if (conn.getresponsecode() != 200) { // got exception on jboss throw new customexception(conn.getresponsecode() + "", conn.getresponsemessage()); } inputstream = conn.getinputstream();
Comments
Post a Comment