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.
Related
As I have understood we use Web services(Rest/Soap) so that a piece of code with some functionality written in one language(say Java) can be used by other programmer no matter the language(say Python) he is developing the application over the internet.
One of the projects I came across uses EWS web services to create,delete appointments on our Outlook 365. The application is developed in Java and a JAVA EWSAPI.jar file is included in the library path(which contains class files like appointment.class,Meeting.class etc) to connect to EWS server and create meetings .
My confusion is suppose we were developing the application in Python, so for that do we have another API (say EWSPython.pythonextension). So then how developing a web service helped us.
I understand API defines the set the methods available and how can they be called with argument.
Please clear my doubts.
I think that you have misunderstood the aim of webservices. We need webservices to make their calls (clients) a platform independent interface which means that once you have created your webservice using any technology (java for your case here) now anyone can call this service by creating a client using any language like python, C#, C++, Ruby, ........... in that case a service which was built by Java will be consumed or called by an application or client created using python and vice versa.
JAVA EWSAPI.jar file is a API Client Library.
What is a client library?
A client library, sometimes called a helper library, is a set of code that application developers can add to their development projects. It provides chunks of code that do the basic things an application needs to do in order to interact with the API. For example, a client library may:
Provide boiler-plate code needed to create an HTTP request and to process the HTTP response from the API.
Include classes that correspond with the elements or data types that the API expects. For example, a Java client library can return native Java objects in the response from the API.
Handle user authentication and authorisation.
How is that useful?
Looking at the developer who’s using the API: With a REST API or any web service API, the developer could be using any of a number of programming languages to make the API calls.
Wouldn’t it be great if we could give them some code in their own language, to help them get started with the API? That’s what a client library does. It helps to reduce the amount of code the application developers have to write, and ensures they’re using the API in the best supported manner.
For more information:
https://ffeathers.wordpress.com/2015/10/25/what-is-an-api-client-library/
I have wsdl
http://www.webservicex.net/genericbarcode.asmx?WSDL .
I am trying to create a client, looking for logic in wsdl.
I think it should start from this:
BarCode barCode=new BarCode();
BarCodeSoap barCodeSoap=barCode.getBarCodeSoap();
Do I need to input any parameters there?
Executable code is generated from WSDL of the Webservice. The client then uses this code to access the Webservice.
For example, GlassFish includes vsimport utility to generate Java code from WSDL.
This utility generates a lot of compiled Java classes that allows client applications to access to Webservices. These classes are further to be added to classpath of the client.
In addition, GlassFish includes custom Ant task (also there are Maven plugin for that).
Then you need to use #WebServiceRef annotation that inject the instance of the Webservice to you client.
#WebServiceRef(wsdlLocation="...?wsdl")
private static NameOfYouServiceService nameOfYouServiceService;
...
NameOfYouService - this is convention, the name of Webservice that you develop.
Then this call nameOfYouServiceService.getNameOfYouServicePort() return you instance of the Webservice. Then you can free use methods of the instance.
Here, the name NameOfYouService - also convention.
In short, something like that.
Your Webservice is written in .NET technology, but you can also using Java client (or PHP or something else) to access it. In fact, a web service created with one technology can be accessed by clients in any other technology.
Here is a good article for your case: Java Client for WebServiceX.Net Web Service (NetBeans IDE)
I would like to add a Web User Interface for an existing Java project I did time ago. I learned basics of AngularJS on codeschool.com courses and now I know how to send an http or REST request to get data for my web UI.
My Java project has a set of methods that elaborate some data from a local database and return integers or integers arrays.
The goal of the interface would be to show a bunch of charts and data directly from that Java project.
What would be the most appropriate way to do this? I heard of implementing REST services on my Java project but it seems overkill for the purpose and i'm totally confused by all the frameworks for this. What would you use?
Thanks everyone for your answers!
I would use SprinvMVC to provide data from server to client side.
Here is my project from which you can start and learn basics :
https://github.com/xwid/thaimaster
Basicly you should create spring controllers mapped to urls, by doing it this way, you will be able to retrive server data using angular js.
http://www.javabeat.net/spring-mvc-angularjs-integration/
If you don't want to use a full REST framework such as Jersey, another possibility would be to use an embeddable HTTP server (there are several) and handle the requests yourself. This would mean that requests to something like /myapp/ would return your AngularJS filled HTML page, and requests to /resources/* would provide with REST functionality.
This would give you a standalone Java program that doesn't need a servlet container, but it would be a somewhat hacky solution. Not production grade, but you'd probably learn something from having to handle the HTTP traffic yourself.
With the Spring Framework's SprigBoot, it's quite easy to implement a REST service and have a runnable java application. You can follow this Building a RESTful Web Service guide from spring.io. They are clear and quickly understandable.
Also if you are not already familiar, through these guides you can have a glimpse of gradle and maven as well.
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
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.