I have a requirement to call 52 web services from one java project and this number will increase with time. I am using netbeans 7.3 as development tool. One way to do it is right click project and add web service reference for each service. It is not feasible because for every new web service I will have to add a new reference and redeploy the code. Also all these 52 web services will be calling each other so I will have to enter references for each web service in every other service if I go for this approach.
I hope I have explained the scenario. Now I will ask the question. If I have a url to wsdl file e.g. http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL and I know which method in this web service I need to call, is there a way to parse this wsdl dynamically to create proxy client and after that call a specific method in that web service? I have come accross javaxt API http://www.javaxt.com/javaxt-core/Web_Services which intends to do exactly the same but it is not working properly.
To sum up the question - If I have the wsdl url and I don't want to create compile time stubs but know which methods in that url take what inputs and return what values, can we do it?
The javaxt-core library should work. There was a release published 2/24 (version 1.6.0) that includes several updates to the javaxt.webservices package. More information can be found here:
http://www.javaxt.com/javaxt-core/RevisionHistory
Related
This may sound like a dumb question but i am new to web services.
I followed this tutorial and successfully created a Calculator web service up to the point where i created a local client application that consumed the web service method (A java class with main method which calls the web service method).
My question now is how can i access this method via my browser and set the parameters there, just get an XML/JSON result.
My guess is that i am missing something and i have to publish the web service somehow.
Any solutions, links are highly appreciated.
You have hosted your webservice on glassfish server. Now you want to consume it using internet browser like you did it using test webservice option in net beans.
That means you need to built your own client which runs on web browser.
You need to built a webpage having two input fields in it and a button as result and whenever you hit this button call your webservice and display it's result. You can follow any simple tutorial of web client or application and again you can deployed it on glassfish or apache server.
Also you can use soapui (a client to consume web services) to import your wsdl and access its methods, providing inputs and get result in form of soap.
Is there any way to automatically generate proxy class for android in eclipse for web service if I have web service url ?
I found ksoap2, but there I need to know method name and parameters to add to request, I can manually wrap but if there is already automatic way I can avoid bugs in my code
I know similar stuff can be done in Visual Studio/C#, where you get class with all methods like webservice.
When you say "for android" you mean for use in an android app? I haven't used it in some time, but I think you can use SoapUI. That article is a few years old, but should still be possible. There are also tools (wsdl2java) that come with Apache axis, and cxf that you can use.
I am working to create a web app. Simultaneously I am also developing a REST web service that will use the same codebase...What I want to know is, can I make the same codebase on a server function as base for both the web app and the web service. (In the web app a user can log in and perform operations while the web service is like an API).
Or do I need to keep 2 distinct code bases for the web app and the web service?
Also, I want the same web app to act as both producer and consumer of the web services...Is this possible?
Yes you can. Technical a REST API is the same thing as the server side of a web application.
But if your REST API is accessed by third parties you might want to have a different versioning strategy then for your web app, so for anything of serious size I would probably separate those.
Sorry can't speak about the producer/consumer part of the question. Don't understand that part of the question.
You can do it that way, but it means that you'll have to deploy the two together. That might not always be desirable.
The alternative is to refactor the common classes into a third project, removing them from the app and the service. Package those into a JAR that you add to both the REST service and the app, just as you would any other 3rd party JAR. If you do it that way, you can deploy the two independently. The cost is maintaining the common classes.
Yes you can do both things from one codebase.. app and web service also, the complete game will be around URLs i.e. app URL and Web service URL..
And Yes it's possible, same web app to act as both producer and consumer.
I am new to wavemaker but the development with it seems to be straightforward.
I tried to invoke some calls to the amazon Product Advertising API (with SOAP) but it didn't work. The problem seems to be that every call has to be signed (see e.g. here: http://www.mularien.com/blog/2009/08/13/tutorial-amazon-soap-product-advertising...)
This seems to render the whole endeavor really burdensome. Has anyone done this and successfully included this API into a wavemaker application? (examples with REST are of course also welcome).
Thank you very much!
The signing requirement does really complicate the whole thing.
Instead of importing the WSDL into WaveMaker and using the WaveMaker generated client, you can use the mularien example code as a java service.
Generate the client following the example and add the jars and classes to your project classpath.
Add a java service to your WaveMaker project.
In the java service, any/all public methods are exposed to the browser client.
So if you com.mularien.amazon.AmazonProductSearch is your java service class, getAmazonInfo(String) would be callable by the client.
Alternatively, instead of directly exposing the AmazonProductSearch functions, use your java service class as a manager. For example, you might want to return only a sub set of Item_type3. A wrapper/manager class as a your project service between the client and AmazonProductSearch can provide that.
I am new to web services. I have a requirement in my project. I have to consume the web services of our vendor in my project. All he has shared with me is a WSDL file and a document about the description of the the different operations.
Question:-
1: What do I need to do consume these web services in my java project? I have been advised to use axis2, eclipse with tomcat6.
2: Do I need to ask for some other files/information from WS vendor OR wsdl file is enough to consume these web services?
3: Do I need to write a java WS client (using axis2 plugin) or another webservice which will talk to vendor web service?
Please suggest the best possible way.
I am sorry if the question sounds like a naive..
Axis is a solid choice for such application.
You need to generate an axis client based on the provided WSDL. Then you import the generated client and use it's methods. You can see the details of this process here (read whole page or starting from the linked section): http://ws.apache.org/axis2/1_0/userguide3.html#Writing_Web_Service_Clients_using_Code_Generation_with_Data_Binding_Support
You could also need some entry-point (WebService URL).
You need to generate a client, not a webservice. See point 1.
Don't use Axis if you need ambient authentication in a Windows environment. I went down that path and ended up going with Apache CXF - which seems better to me anyhow.
You can use SOAP UI to test the web service. It'll read the WSDL, let you create requests by filling in values, and display the response that you get back. It might help you get a better understanding of what the service does before you start writing your classes.
You don't need to create a new web service in order to consume a web service, you need to write a web service client.
Similar question to this one:
Steps in creating a web service using Axis2 - The client code
All the standard web frameworks have a command (normally called wsdl2java) that will read the WSDL and then generate a java based client object.
I can recommend Axis2, but another popular choice is CXF