Call an axis2 web service from a java application - java

I have create one simple web service and I deploy it to the axis2 web application based on this tutorial
After creating my service, I am able to deploy it to the server and I can see the WSDL file by this url: localhost:8084/axis2/services/HelloAxisWorld?wsdl
Now, I want to call this service by an independent java application. I found some pieces of code that makes the invocation, but I am facing problems because I suppose that I don't include the proper libraries in my project.
Does anybody knows an example to call the web service by using axis2?

A simple Google for 'axis2 client tutorial' gives me this. It covers setting up your classpath properly, generating java from the WSDL via wsdl2java, and developing the client from this.

Related

Deploying the google translation api in my java server locally and not invoking web service.

I want to deploy the google translation api in my java server locally. Is there any option where we can get the translation result either from any jar or something else instead of invoking the web service. Since, data which i need to translate is secure and it cannot be exposed. Could you please provide me the information on deploying the same on application server and not invoking web services.
Google Translation API works great with web service call, but i need something which can be done locally not via web service.
Or is there any other API which i can use for the same.
There is no jar that you can install and run it locally. You have to call Google Web Services.

Accessing Web Service using Play Framework 1.2.5

I am using Play framework 1.2.5 in my application in Eclipse IDE. I need to access a web service built using IBM JAX-RPC. I have got the wsdl file of the web service which I need to access in my applicatiom.
For normal Java EE applications, I used to paste the WSDL in my workspace, generate the files by right clicking the WSDL file => Generate Client option i.e. generating files with the help of Eclipse IDE.
I am not sure how to access the WSDL using Play framework.
I want to know:
1) Where to paste the WSDL file in my workspace?
2) In Play framework how do generate the client (Not sure even if we need this or not in play framework) and access the service methods?
3) Any additional settings needed for accessing the service methods?
Please let me know about this.
Regards,
The easy way:
Use Play!'s built-in play.libs.WS (Link #2 and #3). You have to create the raw HTTP requests yourself, and parse the XML result from the server yourself. Of course, this can become a complex task, if the web service interface is complex.
Preferably, you will create a JAX-RPC client based on your WSDL, and use it from your Play! application.

how to run web service endpoint class in tomcat or jboss

I have created webservice using following link
http://www.ibm.com/developerworks/webservices/tutorials/ws-eclipse-javase1/section2.html
When i am running a endpoint publish class as java application in eclipse (in my case it is a runservice.java), web service is running fine.
i have created a client for the same webservice client is communicating with webservice properly.
I want to run this endpoint class with jboss or with tomcat without eclipse, it is possible to do this.
Please help.
Notice that the tutorial states that it is a tutorial on how to run a "stand alone webservice application". Since what you are creating is not a java web application but is instead a JavaSE application you will not be able to deploy it to an application server. You will have to create a java web application in order to do that.
Eclipse WS Tutorial

Developing a web page which invokes web services through CXF

I have already generated the files using wsdl2Java and created the proxy client in JAVA.I am using Apache CXF framework and using Maven as Build Management tool. I can run the JAVA application and consume the service using JAVA. There is no problem with JAVA implementation.
The need is I need to invoke and request the same web service from PHP or JSP file and display the result in PHP or JSP file. I would like to use the present JAVA code. I don't know how to invoke the JAVA code from PHP or JSP page.
Please help me with the solutions.
You have created a web service, so your design should be centered around that. For Java programs (including JSP's) you can use the generated client classes to access the web service. For PHP I would recommend using one of the many SOAP client libraries to process and consume your WSDL. You might want to take a look at wsdl2php, NuSoap, or SoapClient.

Deploying Web Service

I have made an Axis2 Web Service in Java. I am using Apache Tomcat 6.0.32 as a Web Server. My Web Service gets the data from the database(MySQL), and it returns the data into my mobile application. Now I want to deploy my Web Service. What are the steps for that?
Check this link if you want to deploy without using eclipse
http://www.ibm.com/developerworks/opensource/library/ws-webaxis1/
If you are using eclipse then
In preferences setup the Axis 2 runtime
Right click on the project where you have your service implementation & choose the New webservice option. Use the Bottom Up Java Bean Web Service option
You can also quickly create a client to test it.

Categories