Axis - Get the server Url and Path

T

theGirl

Hi,

I am beggining with Axis, I have made classes, like the sample
"example6" of userguide in Axis samples. So my webservice run
correctly.
But now in my Java code, I need to get the url where is running the
webservice, because I have to connect to another application running on
the same server. I don't know how to find this information, because my
class is MyServiceSoapBindingImpl.java, and it extends nothing. I hope
you will understand my query, because I am french...

Thanks

theGirl
 
I

iksrazal

Let me try and understand:

1) You want to make a client side call to web service.
2) You want to know how to connect to that other web service.

There are several ways. But mainly its wsdl, jws or direct. Try
wsdl/jws first, its easier.

WSDL/JWS is like:

String endpoint =
"http://localhost:8888/axis/MessageObject.jws";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new
java.net.URL(endpoint) );
call.setOperationName(new
QName("http://soapinterop.org/", "getMessage") );
msg = (String) call.invoke( new Object[]{} );

That would invoke the web service "getMessage". Try the "axis happiness
page" on your server to see which jws/wsdl you have available.

HTH,
iksrazal
http://www.braziloutsource.com/
 
F

Ferenc Hechler

theGirl said:
I am beggining with Axis, I have made classes, like the sample
"example6" of userguide in Axis samples. So my webservice run
correctly.
But now in my Java code, I need to get the url where is running the
webservice, because I have to connect to another application running on
the same server. I don't know how to find this information, because my
class is MyServiceSoapBindingImpl.java, and it extends nothing. I hope
you will understand my query, because I am french...

If you want to get additional infos on the serversite you can use the
MessageContext Class:

MessageContext mctx = MessageContext.getCurrentContext();

From here you can get all details about the current request.
I am not sure, perhaps is mctx.TRANS_URL what you are looking for.

Best regards,

feri
 
T

theGirl

Thank you very very much Feri, it is exactly what I want and what I
didn't find in hours of searching !
I can't use TRANS_URL, but I use getProperty("transport.url") and it
works very well.

Thank you for your precious help !

Sorry iksrazal, you haven't understood my request in a strange english
!

theGirl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top