[color=blue]
> I want to combine these two methods so that my application can use one
> method looking something like this:
> public String sendRequest(String xml){
> ...
> }
> which returns the results. Is this possible?[/color]
[color=blue]
> I think it must be to include the second method someway in the first
> method and wait for the respons, but I don't know how to do so.
>
> To summarize, the problem is to make one method return something when
> another method is called. I guess there are some smart ways around
> this problem, but I haven't found any yet.[/color]
You'll need some object to lock on, so you can wait for the response.
However, in your current setup I cannot figure any way to wait for the
response. Please take a look at Mark Grand's "Future" design pattern at:
http://www.clickblocks.org/patterns1...ed.html#Future
This is an approach that worked for me; I needed to send multiple
requests to a site and await each response 'synchronously' in its own
thread and return the response to the caller. This design pattern
encapsulates sync/async issues (a bit more than you actually need) and
provides locking.
This all means you can call a method and receive its return variable as
if the communication went synchronously, even though the actual
communication was asynchronously.
Regards,
Joost van Stuijvenberg