|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
httpclientI am trying to write a POST request to a server. I do get a response but it is clear that the server was not able to read the parameters I posted. The documentation is silent on what format the payload needs to be. In the mailing list I only found examples that used variables, which doesn't help. Could someone please enlighten me on the payload format? Thanks in advance, Wolfgang ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Exist-open mailing list Exist-open@... https://lists.sourceforge.net/lists/listinfo/exist-open |
|
|
Re: httpclientHi Wolfgang,
here's a code snippet using httpclient I was using to post a XUpdate query on a document in an eXist database. (raw posting). hope it helps. Gilles ------ // requete XUpdate String xuQuery="<?xml version=\"1.0\"?><xu:insert-before xmlns:xu=\"http://www.xmldb.org/xupdate\" select=\"//mdFileID\"><xu:comment>Test XUpdate (comment)</xu:comment></xu:insert-before>" ; String URL="http://host:8080/exist/servlet/db/document.xml" ; PostMethod httppost = new PostMethod(URL); httppost.setRequestBody(xuQuery); // chaine d'authentification generee a partir du username/password String authString= BasicScheme.authenticate(new UsernamePasswordCredentials ("user","password") ) ; httppost.addRequestHeader(HttpAuthenticator.WWW_AUTH_RESP,authString) ; HttpClient client= new HttpClient(); // execution de la requete try { client.executeMethod(httppost); } catch (IOException ioe) { System.out.println("IOE : "+ioe.getMessage()) ; } ----- Wolfgang Freis a écrit : > I am trying to write a POST request to a server. I do get a response but > it is clear that the server was not able to read the parameters I > posted. The documentation is silent on what format the payload needs to > be. In the mailing list I only found examples that used variables, > which doesn't help. > > Could someone please enlighten me on the payload format? > > Thanks in advance, > Wolfgang > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Exist-open mailing list > Exist-open@... > https://lists.sourceforge.net/lists/listinfo/exist-open > ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Exist-open mailing list Exist-open@... https://lists.sourceforge.net/lists/listinfo/exist-open |
|
|
|
|
|
|
|
|
Re: httpclientWolfgang,
Andrzej is correct, there is currently no way to add POST parameters, however this would be simple for us to do. In the mean time however, have you considered placing the parameters on the querystring, a lot of Server implementations do not actually differentiate between paremeters on the querystring and POST parameters (for example Java). e.g. POST to a url of something like http://blah.dom/blah/script?param1=1¶m2=param2 That may well work for you. Cheers Adam. 2008/6/30 Andrzej Jan Taramina <andrzej@...>: > > Wolfgang asked: > >> Could someone please enlighten me on the payload format? > > The actual format of the payload depends on the server that is receiving it. > > That being said, currently httpclient only allows the payload to be an XML > document, and this implies that the receiving server needs to be able to accept > an XML document as input. > > In other words, currently there is no way to specify a list of individual POST > parameters of the form parm=value in the payload, as you would with a GET. > > -- > Andrzej Taramina > Chaeron Corporation: Enterprise System Solutions > http://www.chaeron.com > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Exist-open mailing list > Exist-open@... > https://lists.sourceforge.net/lists/listinfo/exist-open > -- Adam Retter eXist Developer { England } adam@... irc://irc.freenode.net/existdb ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Exist-open mailing list Exist-open@... https://lists.sourceforge.net/lists/listinfo/exist-open |
| Free Forum Powered by Nabble | Forum Help |