Adobe Connect User Community
Menu

#1 2010-04-09 17:34:38

**_marriedgeek_**

Can't POST XML to API in .NET? Times out.

I'm trying to POST serialized xml content to the API using C#. The code is using very basic calls using the HttpWebRequest and HttpWebResponse classes and StreamWriter/StreamReader to post and read.

It works just fine using GET, but when using POST, it times out when attempting to call the .GetResponse() method on the request object.

Thoughts? Is there a trick? Thanks.

Last edited by **_marriedgeek_** (2010-04-09 17:52:23)

Offline

#2 2010-04-09 17:37:17

**_marriedgeek_**

Re: Can't POST XML to API in .NET? Times out.

Also, I am closing the response object

Offline

#3 2010-07-19 07:04:06

**_ashleyb_**

Re: Can't POST XML to API in .NET? Times out.

If you are trying to use HttpWebRequest and HttpWebResponse you may need to handle the ssl certificate validation.

The simplest way is to look at http://social.msdn.microsoft.com/forums … 31f7fe389/

Offline

#4 2010-09-03 01:44:41

**_chrisadam12_**

Re: Can't POST XML to API in .NET? Times out.

edmine's REST API provides valid XML response only if all request parameters are valid and accepted.
So for this URL

http://demo.redmine.org/projects/ace/is … 5189b42ac7

a valid XML with list of issues will be returned,
but if I change query_id to some random value:
http://demo.redmine.org/projects/ace/is … 5189b42ac7
- then response shown in Google chrome browser is:

Oops! This link appears to be broken.
and in Java program:

java.lang.RuntimeException: java.io.FileNotFoundException: http://demo.redmine.org/projects/ace/is … 5189b42ac7
    at org.alskor.mspsync.connector.redmine.RedmineRESTAPIConnector.loadData(RedmineRESTAPIConnector.java:77)
    at org.alskor.mspsync.ui.editors.ConnectorPanel$2.run(ConnectorPanel.java:128)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.io.FileNotFoundException: http://demo.redmine.org/projects/ace/is … 5189b42ac7
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1311)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
I propose to change xml returned by Redmine REST API for ALL incoming requests to something like this:
<redmine_rest_api_response responseCode="0" responseDescription="...">
  <issues>..........
  </issues>
</redmine_rest_api_response>


the new wrapping "redmine_rest_api_response" header node (or whatever you want to call it) should provide
status code (0=OK, 1=authentication failure, 2=parameter invalid, 3=access key valid, but access denied to the specified resource - e.g. query ID belonging to other user, ...)
response description - some human-readable text like "authentication failed: key 123 is not recognized" or "value '6666' or parameter 'query_id' is not allowed for the given API access key because..."
this would be really useful for building external applications on top of Redmine REST API.



______________________________________________________________


Want to get-on Google's first page and loads of traffic to your website? Hire a SEO specialist from Ocean Groups seo specialist

Offline

Board footer