I need to create a resource adaptor for a proprietary protocol based on HTTP protocol
Basically i have to send and receive requests . The main things here are :
1. For sending requests i have to open a connection (eg. http url connection ) to a network element which listens to the HTTP requests , construct the
HTTP POST request and send this POST request . My doubt here is can i use the same connection to send multiple requests .If so how can i match the responses to the requests. Please suggest how can i achieve this.
2. For receiving HTTP POST request from the network element i have to listen to the network element running on some ip , port continously . I must be able to receive multiple requests simultaneouly and send the responses syncronously or synschronously . How can i achieve this.
HttpConnection con = (HttpConnection) Connector.open("http://twitter.com/statuses/update.json");
once we have this connection, linked to the url in question we can set a few request properties which are needed by the site
OutputStreamWriter ow = new OutputStreamWriter(con.openOutputStream());
The call to the above method should be something like updateStatus("status=this is a status @ptay89&in_reply_to_status_id=4051308780");
the data is the stuff you post, fieldName=fieldData&fieldName2=fieldName2data and so on, as a String
Sorry if that doesn't work, very basic as i said