aspose file tools*
The moose likes Web Services and the fly likes How to connect two Web services to each other Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to connect two Web services to each other" Watch "How to connect two Web services to each other" New topic
Author

How to connect two Web services to each other

Ales Mesni
Greenhorn

Joined: Dec 16, 2009
Posts: 14
Hello everybody.

I have a problem:

I want to make two webservices communicate to each other. Lets say we have two Web services App1 and App2.
I want that App1 could call any function of the App2.
I searched a lot on this server but i couldn't find anything useful for me.
Please help me and thank you in advance for any anwsers.

lp, Mesni
Ales Mesni
Greenhorn

Joined: Dec 16, 2009
Posts: 14
I forgot to say that we are using WASCE and im going to install MQseries but i dont know if this could help me achieve my goal
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41867
    
  63
The standard way to access a web service is through HTTP, but it sounds as if you're asking about a Java method call ... ? If so, refactor the services so that their access logic (that deals with HTTP) is in a separate class from their business logic. Then you can instantiate the business logic classes wherever and whenever you need to.


Ping & DNS - my free Android networking tools app
Ales Mesni
Greenhorn

Joined: Dec 16, 2009
Posts: 14
the thing you written sounds perfect but the problem is that i don't know how to achieve this. I have this from WSDL generated web service which i added the code. but i dont fully understend the separation from access logic and the bussines logic. the thing i made is that the a App1PortType.java which has al the
@webservice settings. Then i made a main funcion App1.java and in web.xml mad a connection to this App1.java so that there are the function that inherit the code.
Here is some code about my two classes
this is my app1


and this is my appPortType


and example would be grait

thank you for your help
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41867
    
  63
The actual requirement is not to call the other WS, it is to execute the logic that the other WS would execute, correct?

So you should move all the code that is currently in the "/* SOME CODE */" section to its own class that does not depend on any WS API. Then you can use that class directly, without having to call any WS.
Ales Mesni
Greenhorn

Joined: Dec 16, 2009
Posts: 14
Thank you very much for the reply.
So i have to create a different class and add the functions in there and then the other WS app2 that runs on the same WASCE can only include the files from this WS?

I dont understand the part when the WS app2 gets the classes of the app1.

Lp, Mesni
Ales Mesni
Greenhorn

Joined: Dec 16, 2009
Posts: 14
Ok i made it!!!
Here is the tutorial how to expose the service ( create a client )
http://px.pats.no/px/Eclipse_tutorial.html
And then you just add these files into you service make the connections, program whatever you want and compile it and load it onto your server and it works!!!
If any question just ask.

Lp, Mesni
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to connect two Web services to each other