BUG: org.apache.commons.httpclient.HttpException: 400

Having trouble installing Oxygen? Got a bug to report? Post it all here.
nachtkinder
Posts: 3
Joined: Wed Apr 20, 2005 1:34 pm

BUG: org.apache.commons.httpclient.HttpException: 400

Post by nachtkinder »

Within an extension jar (in the Oxygen lib folder) we have a Java method which returns a node set to be used in a transform.

This works fine in our production environment and fine when the transform is run directly from the cmd line, but when run within Oxygen it fails (with the Stack Trace at the bottom of this message)


Basically within the method:
com.bbc.cmc.documentum.cis.MDRemoteManager.requestFromServer


this code gets called:
URL serverServlet = new URL(“some url”);
URLConnection urlConn = serverServlet.openConnection();
urlConn.setDoInput(true);
urlConn.setDoOutput(true);
urlConn.setUseCaches(false);
urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");


// Send POST output.
printout = new DataOutputStream(urlConn.getOutputStream());
printout.writeBytes(urlEncodedRequestString);
printout.flush();
printout.close();

// Get response data.
final ObjectInputStream input = new ObjectInputStream(urlConn.getInputStream());




When run within Oxygen urlConn is an instance of ro.sync.net.protocol.http.A.A and when run elsewhere it is an instance of sun.net.www.protocol.http.HttpURLConnection


I would suspect the problem is something to do with how ro.sync.net.protocol.http.A.A deals with post requests.


Can any one in support shed any light on this?

Thanks.

Stack trace follows:
------------------------------------------------------------------------
LOG: MDRemoteManager IOException thrown connecting to Metadata Server: org.apache.commons.httpclient.HttpException: 400 Bad Request for: http://bbcdev2004.national.core.bbc.co. ... tconnector
org.apache.commons.httpclient.HttpException: 400 Bad Request for: http://bbcdev2004.national.core.bbc.co. ... tconnector
at ro.sync.net.protocol.http.A.A(Unknown Source)
at ro.sync.net.protocol.http.A.A(Unknown Source)
at ro.sync.net.protocol.http.WebdavHttpURLConnection$_B.close(Unknown Source)
at java.io.FilterOutputStream.close(Unknown Source)
at com.bbc.cmc.documentum.cis.MDRemoteManager.requestFromServer(Unknown Source)
at com.bbc.cmc.documentum.cis.MDRemoteManager.getConceptsByGuids(Unknown Source)
at com.bbc.cmc.documentum.cis.MDRemoteManager.getConceptsByGuids(Unknown Source)
at com.bbc.cmc.xsl.XSLUtils.getMetaDataInfo(XSLUtils.java:4051)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:394)
at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:438)
at org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:220)
at org.apache.xalan.transformer.TransformerImpl.extFunction(TransformerImpl.java:473)
at org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:206)
at org.apache.xpath.axes.FilterExprIteratorSimple.executeFilterExpr(FilterExprIteratorSimple.java:114)
at org.apache.xpath.axes.FilterExprWalker.setRoot(FilterExprWalker.java:129)
at org.apache.xpath.axes.WalkingIterator.setRoot(WalkingIterator.java:154)
at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:213)
at org.apache.xpath.axes.LocPathIterator.asIterator(LocPathIterator.java:267)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:205)
at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:176)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:393)
at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:176)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)
at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2281)
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1367)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:709)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262)
at ro.sync.exml.G.V.j.A(Unknown Source)
at ro.sync.exml.G.V.j.A(Unknown Source)
at ro.sync.exml.G.V.j$7.?(Unknown Source)
at ro.sync.ui.application.A.run(Unknown Source)
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

oXygen sets URL protocol handlers other than the default sun.net.www.protocol ones that are called when a URL resource is accessed from oXygen. From the error message it is not clear why you get the error when oXygen's HTTP client sends the request to the server. What is the name and version number of your HTTP server? Also please contact us to tell you how to enable logging for the requests and responses that go between oXygen and the server. This log will help us to understand why you get the "400 Bad Request" error.

You can force sending the request through the default protocol handler from package sun.net.www.protocol by replacing in your code

Code: Select all

URL serverServlet = new URL(“some url”);
with

Code: Select all

URL url = new URL(“some url”);
URL serverServlet = new URL(url, "", new sun.net.www.protocol.http.Handler());
Regards,
Sorin
Post Reply