Alan So

Greenhorn
+ Follow
since Sep 07, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Alan So

Hi,

I have a URL www.abc.com/a b c

When I manually enter the URL address in the browser it works.

But when I code it in java and java automatically launch the browser, my URL will become www.abc.com/a%20b%20c which this does not fetch the data.

Please advice. Thanks.
13 years ago
Hi,

Currently my program code is listening to TCP port and I will be receiviing XML data and the data will be save to a file.

The issue is that the XML data contains the respond data from the server whenever it send back to the client, how can I get rid of the respond data.

Example,

respond=ok;blah blah
<xml>
......
......
</xml>

if there are two responds... it will be

respond=ok;blah blah
<xml>
......
......
</xml>
respond=ok;blah blah
<xml>
......
......
</xml>


So I do not want to write the "respond=ok;blah blah" to the xml file. Because once I write that to a file, it will not be in a XML format. Please advice on how can I read the XML data from the TCP port correctly and save it to a file. Thanks.
The coding is done in java just that I need some help on how can I add an alert listener to a tcp/ip port.

I have try finding but all exampls mention only on listening to tcp/ip port.

Or am I in the wrong direction?? or the alert listener should done on the server side instead?

13 years ago
Ok I have requested for the API.

But in the mean time, should I do the codes for listening to the port and event/alert listener too not wasting time on waiting.

So is there any direction that I can look into it because I have google quite a lot but I cant find an alert listener example to listen to a tcp/ip port.

Please advice thanks.
13 years ago

Ulf Dittmer wrote:

ss sk wrote:

Ulf Dittmer wrote:If you used HttpClient for all requests, you could turn on its cookie support (which is, I assume, how authentication is controlled after a login).



Apologize i dont quite understand your statement, can you show me where to change. Thanks.


You're using HttpUrlConnection for the POST method, but HttpCLient for the GET method. If instead you were using HttpClient for both methods, you could use its cookie support for tracking any login cookies that may be set by the login (assuming cookies are used for that, which you need to find out).

Also, you need to change your display name -which is invalid- or your account will be closed soon.



O ok. So both should use the HttpClient method instead. Any issues will be back again.



thanks once again.
13 years ago

Jesper de Jong wrote:Welcome to the Ranch.

You first have to find out how exactly the server sends the alert.



Thanks.

The alerts are send by the APIs according to what I have been told. And listen to a TCP/IP port example 0080. the server will send a XML data which is the alert.

So I not sure how can I start or integrate it.

I understand that the ClientListener should be a jar file which is a class file i suppose, so that I can create a new instance. And this clientlistener file it should be provided, am I right?

And this is what I have from them..



Please advice and help again. Thanks.
13 years ago

Rob Spoor wrote:And welcome to the Ranch!



Thanks hopefully I can get all the helps in here.
13 years ago

Ulf Dittmer wrote:If you used HttpClient for all requests, you could turn on its cookie support (which is, I assume, how authentication is controlled after a login).



Apologize i dont quite understand your statement, can you show me where to change. Thanks.

Or you saiding that the http://ipaddress/platform/Login => should be using HttpCLient method follow by a Postmethod ? like what I did for the second API.
13 years ago
Hi all,

I need some help. I am writing a program to listen an alert from a server after that the alert will be do something.

May I know how can I start to do it or is there an example on alert listener for server?

Because I google and all I find is regards to event listener.

So any kind soul can help me out. Thanks
13 years ago
Hi,

I need some asistance.
I am writing http code for POST and GET method. Below are the 2 APIs that will be call to the server.

APIs
1)http://ipaddress/platform/Login?user=test&password=test
2)http://ipaddress/platform/reportdata

The first API using POST method and the second API using GET method.

The second API should returns me XML data. But it returns me saiding that I am not authenticated.

Is there a way to verify that I am sucessfully being authenticated so that I can use the second API.

So Is there any parts that I miss out or had I make any mistakes?? Below is my code.



Please advice. Thanks.
13 years ago