We have a server which exposes a set of REST APIs. Those APIs are meant to be exposed for clients on different platform so we want to provide SDKs in Java and .NET
The SDKs are using similiar interface definitions (we keep duplicating interface decration in both languages). Application build on top of Java SDK can be run as a servlet within tomcat container, and application build on top of .NET SDK con be run as an IIS app. It is quite a challenge to maintain multiple language version of SDKs to make sure they all work right. All testing effort becomes doubled.
We are thinking to write 2 'debugger' application, on both SDKs respectively. The applications then can load 'command scripts' which is implemented in Python. The 2 'debugger' application provides very thin API wrappers to make them accessible from Python. So we can use one piece of Python code to test both SDKs.
In detail:
Implement the Java 'debugger' app, and expose its low level API to be accessible from Jython code
Implement the .NET 'debugger' app, and expose its low level API to be accessible from IronPython code.
APIs from Java and .NET 'debugger' should be compatible
Implement all test cases in Python, using the common API.
When Java/.NET app runs, they load those Python scripts, and execute them to make sure functionalities works ok.
So my questions are
is this a feasible way to solve such kind of problem?
Is there any example of solution to similiar problem?
Is there any framework/library that I can leverage?
Thanks in advance for any comments/suggestions!
Related
I am building a web application for business management as a side project and i face an architecture problem.
My application will be an Angular web client communicating with a kotlin/java spring back-end via REST. One of the modules of the application will be time series forecasting of sales/orders, and because of the ease of development and the piles of documentation that exists online, i want to build that module in python. That module will generate dynamic html plots that i want to serve to the client. So my question is, it would be better if i do the python part as a stand alone rest micro service with Flask or it's ok to just put the python code inside the java project and call it using ProcessBuilder? Thanks in advance :)
My view will be to create a microservice with Python Flask with certain REST endpoints for obtaining the results and let java application interact with python based microservice for machine learning. The main advantage with this approach will be the separation of concern and deployment will be independent and you can leverage the benefits of microservice architecture.
Although it is also possible to bundle python code inside java or you can use jython, any changes in either in java code or in python code will add extra overhead for deployment. Bundling additional non java code will be another overhead for different OS systems like Windows, Mac and Linux.
You can check the following links for reference.
https://www.datacamp.com/community/tutorials/machine-learning-models-api-python
ok, So i searched net for the possible implementation but all that I managed to find is Django projects implementation on Java platform through Jython. But I want to do the reverse, i.e. implement/integrate java project ( which in my case is SAIKU server ) on Django platform.
The question being, is it possible, and if yes, then kindly point me to the solution.
Thanking in advance =)
For your specific requirement, I would suggest using RESTFul API to access the Saiku Server.
However if you need to run Java Classes from Python.
Here are the options available for you:
JCC -- a C++ code generator for calling Java from C++/Python. It produces producing Python extensions which communicate via JNI with a Java virtual machine. As it implies, this would require compilations of every possible call. However this project is backbone of PyLucene project.
CodeMesh. C++ code generator for Java.
Py4J Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine.
JPype allow python programs full access to java class libraries. It is done through interfacing at the native level in both Virtual Machines. However there are no recent development in this front.
In general, having an loosly coupled integration through REST or RCP would be easy to maintain than tightly coupled JNI based implementation.
There's no way to run Java within the Python runtime (which is what it sounds like you want). There are Java to Python "translators" available, but they're terrible. Honestly, if you need a Java server and Django to sit inside the same process for some reason, Jython is the way to go.
There are lots of options outside of that though, off the top of my head:
Implement Python bindings for your server (See PyLucene for an example)
Implement a socket server within your Java server that Python can talk to directly
I found that Android development can be done through Python from the link http://www.linuxplanet.com/linuxplanet/tutorials/7157/1. My question is whether all the libraries that are available in Java are also available in python.
Any of you already started with python on Android if so please indicate links to help get our group up to speed.
No, not all the libraries have been exposed. You can look at the SL4A project on google-code for more information regarding the support it has.
Is this a complete API bridge, or are there restrictions?
BeanShell, JRuby, and Rhino basically give you a complete API bridge (you can invoke Java calls directly). See the documentation for those interpreters for instruction on how to accomplish this. Cross compiled languages like Lua are more restricted. They only have access to the APIs exposed through the RPC layer. See the API reference for a list of currently supported APIs. The RPC layer is easy to extend.
Could anyone please suggest how to test whether WCF with wsHttpBinding you built is interoperable to PHP, Java and other tools?
Is there any tool that exist to test above
Thank you
No such tool exists for PHP because PHP doesn't have native support for WS-* standards. You always need some specific third party library / framework to make it work. These libraries are usually based on C++ or Java and exposing functionality to PHP. Different libraries can support different feature set. I have previously integrated with WSO2 for PHP and features demanded by customer required complete custom binding for WCF.
The same is theoretically true with Java. In contrast to .NET and its WCF, Java application servers provide different implementations of WS-* standards. WCF team recently published first preview of interoperable bindings which should provide only features available by targeted Java client.
Anyway if you want to test that it works you must indeed write a client on the targeted platform. Here you have very nice article about exposing the service with interoperable binding and consuming the service in Java.
The general tool for testing services is SoapUI but it test just functionality. You still have to understand if your target platform supports additional features required by the service or not.
I'm currently in the research phase of my dissertation project.
My project is a ticket booking system for a mobile device and I have chosen to target Android.
I anticipate the need for a client/server architecture with a central server, and so am currently looking at how Android could communicate with such a server. The server would grant the client access to ticketing information, and the client would send information about ticket bookings to the server. I'm looking at Java EE for the server as Java is the language I'm most experienced with.
I'm aware that Android comes with java.nio and java.net, as well as some org.apache packages, but am also looking for libraries/technologies that would be possible to use with Android.
So far I've not found anything massively helpful on the internet, so I'm seeing what SO can suggest.
Specifically I am interested in knowing:
What support is there for various middleware technologies in Android? e.g.
RPC based middleware
CORBA
Message based middleware
Web services such as XML-RPC, SOAP, REST
How well (or not) do existing Java libraries work when used on the Android platform? (e.g. If I wanted to use a library/API designed for Java SE rather than Android what problems might I encounter?)
Ideally, as the focus of my project isn't meant to be the communication between the server and client, I could use an existing middleware to handle the communication, but I am prepared for the worst case, which is having to write my own.
What support is there for various
middleware technologies in Android?
My personal opinion -- though I do not feel I am alone in thinking this way -- is that only protocols specifically designed to run over the Internet are remotely suitable for use with a mobile client. So, of your list, the only one that I would even entertain would be:
Web services such as XML-RPC, SOAP, REST
Some people have been maintaining an Android port of kSOAP2. However, I get the distinct impression that most Android developers working in this area have tended towards REST and REST-ish protocols. If nothing else, that's what all the fun Web sites and services are using for an API, particularly compared with XML-RPC (old) and SOAP (old and icky).
I have successfully used both the java.net.URLConnection and Apache HTTPClient libraries in Android for communicating with REST-style endpoints -- both directly and through third-party JARs -- with no real Android-specific issues.
How well (or not) do existing Java
libraries work when used on the
Android platform?
It is difficult to answer that in the abstract. Android implements a substantial subset of JavaSE, but not all of JavaSE, so there's a chance that any given JAR will expect something Android does not offer. Similarly, Android does not use environment variables, command-line switches, or a variety of other things that developers focused on the desktop might have introduced as semi-requirements. So, some things have worked for me with nothing more than a recompile (Beanshell), and some things have worked for me after removing redundant classs (JTwitter), and some things looked like they were going to be ghastly to get working (JavaMail).