Alex Parvan

Ranch Hand
+ Follow
since Dec 10, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alex Parvan

I upload images to servlet using the following code:

Mobile:


Servlet:


This is something i use and works every time. I also looked and asked everywhere for this and was very hard to get, i hope this helps you.
Alex.
12 years ago
JRE is java runtime environment. Any computer user can have this installed, you don't need to be a developer to use this. For example if you want to play a game somewhere on the internet written in java, you will need JRE installed.

SDK is the development kit. You need this installed in order to be able to develop java programs.
12 years ago
Aha, that makes sense, thanks for your help.
12 years ago
JSP
I meant if the website (with the JSP pages) are on one machine, and the WS is on another machine.

Thanks for your reply.
12 years ago
JSP
I can call a WS operation using "useBean" but what if they are not on the same server ?

And i'm more interested in sending object, because i'm using JAXB in the Web Service.

Thanks,
Alex
12 years ago
JSP
Is there any way to do something when the session expires ? I would like to call a WS operation when the session expires, but how do i find out when that happens ?

Thanks,
Alex
12 years ago
JSP
Glad i could help
12 years ago
Don't worry about asking too many questions, i know how it is when no one helps you So just ask freely, if i can, i will help.

So, kSOAP does not create any classes, kSOAP calls the WS address you give it, you write the parameters manually. So basicly kSOAP is the manual way to call a WS operation.

The ksoap2 library contains the following classes:
org.ksoap2.SoapEnvelope;
org.ksoap2.serialization.SoapObject;
org.ksoap2.serialization.SoapSerializationEnvelope;
org.ksoap2.transport.HttpTransport;
which are used to call a WS operation.

Then you must read the SOAP response again manually.

Say you want to call an operation that looks like this:
public boolean login(String username, String password)
Here is the complete code how to call a WS operation using kSOAP:

Maybe seeing the code gives you an ideea how kSOAP works, you can just put this code in your J2ME application and use it, nothing else is needed. No stubs / classes will be generated.

Unfortunately these are the only 2 ways i know how to call a WS operation, and i find using kSOAP more efficient, althought it's slightly more complex.

Feel free to ask if you have any more questions or don't understand something,
Alex.
12 years ago
The first thing you need to do is to have a WSDL address, like http://localhost:8080/DEMOWS/services/DEMO?wsdl. Then you create a J2ME project in NetBeans. Then you right click on your project and select "New J2ME Web Service Client...", you enter the WSDL address and you are finished. The WSDL will be imported automatically by NB and all the code will be generated.

Once you've done this, you can use any WS operation at any time in your code. I was wrong in my first post, right click -> insert code can only be done in J2SE, in J2ME you use this code:

Once you write "service." NetBeans will show you all the operations with their parameters and what they return, just like a normal method.

Alex.
12 years ago
How can i get the client's IP in a WebService ?

Thanks,
Alex
12 years ago
Hello,

You can use NetBeans to parse the WSDL, it will create all the classes you need, and you can always call the operations (edit) using the code i wrote in my next post.

While KSOAP can call operations only when you know the parameters and return, the NetBeans generated code reads the WSDL and tells you what parameters you need and how the response looks like, which makes it as easy as calling a normal method.

There is one downside tho, you can only send and recieve Java types (int, double, String, etc.). Using XML complex types is only possible with KSOAP because JAXB is not yet implemented for J2ME.

Hope this helps !
If you have any questions please ask,
Alex.
12 years ago
Hello,

It's as simple as:

Hope this helps !
Alex.
12 years ago
I think you can also look for some hosting that has tomcat and JVM. I don't think you'll find any for free tho.
12 years ago
Welcome to you both ! I'm relieved to not see any exceptions or wierd problemes for a change
12 years ago