tags:

views:

28

answers:

1

I've looked all around and decided to make my own library for accessing the EVE API.

Requests are sent to a server address such as /account/Characters.xml.aspx. Characters.xml.aspx requires two item be submitted in POST and then it returns an XML file. So far I have this but it does not work, probably becuase I am using GET instead of POST:

    //Get the API data
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    String url = "http://api.eveonline.com/account/Characters.xml.aspx?userID="+
            userID+"?apiKey="+key;
    Document doc = builder.parse(url);

How would I go about being able to parst an XML file that is generated by submitting variables in POST?

A: 

I don't know if DocumentBuilder.parse(String uri) would fetch a remote URI. Anyway, you're right, if it were to, it would likely to a get.

You should probably use an HTTP client library to do your POST and get the response. An option is: http://hc.apache.org/httpclient-3.x/ They have some examples, so it shouldn't be too hard for you to use that to do your post, get the result, and then use DocumentBuilder to build up a DOM and get what you want out of it.

nojo