Guys, I've already generated a WS Client by a WSDL File + Axis + TomCat 8 in Deploy level.
But now I don't know what to do to consume those classes. Can you give me a light or some link where it explain better?
I am not sure my answer is going to help of not but I am going to give it a try.
There are front end frameworks which consume the webservices methods and Data Transfer Objects.
There are back end frameworks which create the webservice and then when its created, we deploy that webservice to an app server. Whether or not the webservice is exposed to the internet is determined on whether the app server is exposed to the Internet or not.
There are two main backend frameworks in Java. Spring and EJBs. I use EJBs. And so that will be what I will discuss in my answer.
I have an EJB which is the web service itself. That EJB also talks to a second EJB to access Entity Objects which are stored in some kind of database. This is normally managed using JPA. Java Persistence API
Also, in my EJB project, I have a remote client Which contains the DTO's Data Transfer Objects and my Interface which describes what methods are available through my EJB.
The Front end framework I am using is Flex and the User Interface is FlashBuilder. In this UI, it has a wizard which if I give it the URL for my WSDL on the appserver, then it will build the DTO Objects and provide access to the Web Services Methods for me.
The front end framework calls the methods that are in the Interface and retrieves the data into the DTO objects.
So, lets say my Web Service has a method called getAccounts and returns a list of accountDTO. Since my UI already created the service stuff for me, All I have to do is call the method from the created service. ie. accountsservice.getAccounts().
Now since this framework is asynchronous, this call is assigned to a call responder. So that when the call is returned, the responder then adds the successful respond to an ArrayList of Accounts but basically its like saying List<Accounts> accounts = accountsservice.getAccounts();
So, once my front end gets the request to get accounts, it creates a soap message and sends it to the webservice and asks the webService for the getAccounts Method. The EJB receives the request and runs that method getAccounts.
In that method, the EJB contacts the EAO EJB and runs its getAccounts Method which it then uses Jquery and does some basic sql type query but more object oriented.
Select * from Accounts eo where eo.archived = null
In this case there is an Entity class called Accounts and we are assigning a variable eo (Entity Object) and there should be a variable in the Accounts Entity class called archived and we want all records from our associated Database which contains a table with Accounts where archived is null
JPA now instantiates the Accounts Entity Class and runs the query and builds a list of Accounts of Entity type Account. The result is sent back to the Web Service EJB
The Web Service EJB now takes that List of Entity Accounts and converts them to a list of AccountDTO. Which is the format your front end understands. Once it has this list, it sends the result back to the front end via soap which is basically xml
The front end gets the answer and assigns the list of AccountDTOs to what ever variable you defined. And there you go. You have access to a list of AccountDTOs and in this case its called accounts
You would use this list just like you would any other arraylist. Display the data. Edit the data and send the changes to the webservice with a call like accountsservice.setAccount(AccountDTO). Whatever you would normally do.
Contains the WebService EJB, Entities, and the EAO EJB and the Conversion utility which converts Entities to DTOs and DTOs to Entities
This also contains the persistence.xml file which jpa uses for jta ad jndi for access to the jdbc database calls.
Contains the WebService Interface and DTO Classes
Contains the Deployment infrastructure. This is what gets deployed to the app server.
The App Server which I am using WebLogic has Datasources which interface with my Database and allow access through jndi which jta uses through jdbc The jndi file
And the App Server has Deployed apps which in this case has a web service called AccountsService. In the Deployed Service, under testing, you would find the WSDL and the URL needed to retrieve it or display it.
On my front end
Contains the generated service classes
ValueObjects which contains the DTO classes
And then the front end app which calls these methods and uses these DTO classes.