8

I'm going to create mobile application that works with CommuniGate Pro server.

For example, I need to make the following Android Client C - CGP Server S conversation and get XIMSS.nonce node value:

C:GET /ximsslogin/ HTTP/1.1
  Host: myserver.com
  Content-Type: text/xml
  Content-Length: 42

  <XIMSS><listFeatures id="list" /><XIMSS>

S:HTTP/1.1 200 OK
  Content-Length: 231
  Connection: keep-alive
  Content-Type: text/xml;charset=utf-8
  Server: CommuniGatePro/5.3

  <XIMSS><nonce>2C3E575E5498CE63574D40F18D00C873</nonce><language>german</language><response id="s"/></XIMSS> 

Example, in ActionScript 3.0 it looks this way:

var loader:Loader = new Loader();
loader.addEventListener(Event.COMPLETE, completeHandler);
var urlRequest:URLRequest = new URLRequest(...);
urlRequest.method = ...;
urlRequest.data = ...;
loader.load(urlRequest);

private function completeHandler(...):void { ... };

How will it look in Java for Android 2.1?

1
  • I believe you're going to need to elaborate more in order to get any meaningful assistance. Commented Jun 14, 2010 at 15:19

1 Answer 1

18

As Schnapple says your question seems very broad and is confusing to read and understand.

Here is some general code to send a HTTP POST and get a response from a server though that may be helpful.


public String postPage(String url, File data, boolean returnAddr) {

    ret = null;

    httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);

    httpPost = new HttpPost(url);
    response = null;

    FileEntity tmp = null;       

    tmp = new FileEntity(data,"UTF-8");

    httpPost.setEntity(tmp);

    try {
        response = httpClient.execute(httpPost,localContext);
    } catch (ClientProtocolException e) {
        System.out.println("HTTPHelp : ClientProtocolException : "+e);
    } catch (IOException e) {
        System.out.println("HTTPHelp : IOException : "+e);
    } 
            ret = response.getStatusLine().toString();

            return ret;
}
Sign up to request clarification or add additional context in comments.

1 Comment

When i used this method the response i got from my server is "Image not provided". How to solve this?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.