I have a co-worker who worked on Web Service with Java (I think it was with Axis).
My collegue created some java classes and for now we use them in a DOS windows and a .bat.
My boss asked me if it was possible to use these java classes with PHP Soap.
I know PHP but I never used Soap, so i'm kinda stuck.
For example, we have a java class to read some objects with 3 arguments.
We had imagine in PHP to create a form with 3 fields, retrieve those 3 fields then call the java class (example : readO($var1, $var2, $var3)).
Is this possible to do that with PHP Soap with minimum change from java class ?
Thanks in advance for your help.
This can be done with any changes of the classes, that's the idea of the WSs, the client just need to use the right namespaces and config.
Related
I have an embedded system using a python interface. Currently the system is using a (system-local) XML-file to persist data in case the system gets turned off. But normally the system is running the entire time. When the system starts, the XML-file is read in and information is stored in python-objects. The information then is used for processing. My aim is to edit this information remotely (over TCP/IP) even during process. I would like to use JAVA to get this done, and i have been thinking about something to share the objects. The problem is, that I'm missing some keywords to find the right technologies to get this done. What i found is SOAP, but i think it is not the right thing for this case, is that true? I'm grateful for any tips.
As I understand, you are using XML file to store start up configuration
And my assumptions on your interface between Java & Python apps
You want your Java application to retrieve objects over Python interface
And process them locally and send it back to Python interface to reload config ?
So, depending on your circumstances, you can workout something with the following
Jython
Pickle (if you have no restriction on startup config file format or can afford to do conversion)
https://pypi.python.org/pypi/Pyro4
Also you can get some ideas from here:
Sharing a complex object between Python processes?
You should ask your python application to open a XML-RPC socket which clients can connect on. This could let an outside application to execute an endpoint, which would manipulate your python object values in someway. There are several good choices for Java XML-RPC libraries, including the amazing org.apache.xmlrpc library.
I am looking for a solution (best example code) how to implement an register a Java Program as (D)COM Server/Service. More concise I have the following issue:
Initially situation is:
(a) I have a Java Webservice (Axis) pulling in Data from the Web.
(b) I have a 3rd Party service (written in Delphi) which wants the
data from a COM-Object and is periodically calling this (the
interface, which methods of the COM Object are called, is specified).
In order to get the data from (a) to (b), I need to implement a COM-Server which provids the needed methods for (b) to retrieve its data.
The main Question I have is:
How can I make and register the Java Service as a COM-Object and provide the needed methods so that (b) get its data when calling.
I know Java, but I am no expert to (D)COM. So, forgive me possible technical error concerning COM.
Searching the Web I found several tools/frameworks (e.g. JInterop) that allow a Java Program to interact with a COM-Object, but I did not found code etc. how to make a Java Program accessible via (D)COM.
First, take a look on using Java Servers and DCOM. An example is idl server. Also, you can see services tutorial.
For a program i'm writing I need to marshal ActionScript classes to a format that is later to be read by Java (and back again).
What solutions exists for such a need ?
Is there a way (like when using Java through XMLEncoder/XMLDecoder) to generate that XML using standard flex libraries (that would be compatible with later decoding using XMLDecoder) ?
Or is there a good existing library ?
EDIT Yes, this question is a duplicate of Are there any tool mapping of JavaBeans to ActionScript Class through xml serialization and deserialization?, but I will accept correct answers and eventually start a bounty if no answer satisfies my needs. (in other words, i plan to make the previous - unanswered - question a duplicate of mine).
EDIT 2 To be even more precise, I have an application divided in two parts : one Flex GUI and one Java core. They communicate over a non http layer which requires data to be sent in XML. In this context, I replicated my Java objects in Flex (using GAS3) and now want some of these objects to be sent from Flex to Java and back again.
For that purpose, I have to serialize objects (on the Flex end) in XML and deserialize them in Java (and all that back again).
We are using http://www.spicefactory.org/parsley/index.php which supports XML-to-object conversions back-and-forth. Their documentation is very decent: http://www.spicefactory.org/parsley/docs/2.4/manual/.
See describeType function if you really want XML. But I seriously recommend considering the other serializations formats too.
You can look into JSON. The classes needed for the actionscript serialization/deserialization are part of the as3corelib library.
You might also want to take a look at BlazeDS.
Solution used was to put XStream on the java side and FleXMLer (with some adaptations that can be found there : https://github.com/Riduidel/FleXMLer) on the Flex side. it works quite good (once FleXMLer is adapted to XStream architecture).
I am triying to get a variable from php file with using java code. How can I do that?
Thank u all...
I don't think you can do that (at least not easy).
You would have to call your java program from within your php program and supply all parameters you got from the database to the java program. Using a transfer language like SOAP could do that.
If it is possible in your environment I strongly suggest you quit using them both and instead settle on one of this two languages instead. Java has fine database support and most of the things you can do in java can be done in php as well.
If that’s not possible, using SOAP or (depending on the situation) HTTP Servlet calls or a command line call will give you the ability to transfer parameters from php to java and visa-verse.
Assuming you are talking about JavaScript instead of Java, the best way to do this is using AJAX. You need two pieces of code for this:
One piece in PHP that will print the variable (if it's a complex variable, a dataformat like JSON or XML is recommended)
One piece in Javascript that will call the .php script that prints the variable, and puts the variable into javascript (but don't use eval() for this).
Read more about AJAX and PHP at the w3schools intro or the more advanced example.
I'm not an experienced java developer so any comment will be welcomed ...
I've written a web service using c# and I wanted to consume this service from java - used Netbeans for this task.
All methods works well beside one: the method expecting a type called BusinessDataField2 - this type contains 2 fields: name(string) and value(object)
Those fields are filled using get,set methods - this works easily at the .NET environment.
However ...
I can see that Java requires different parameters for the get and set methods - the parameter is :
JAXBElement
JAXBElement
The question is: how do I instantiate this object? I tried many different ways but nothing worked...
Thanks,
ofer
You should not use the "object" type. It could be any actual type, but you're not telling the Java side what to expect. The best it can do, then, is process the actual XML of the value.
Consider: the object could be an int, or it could be some complex structure. How would the Java side know what to do with it? The Java side wouldn't even have a proxy classs for the complex structure, because you never told it that you could ever return the complex structure.
I'd recommend using the CXF web service framework to consume your web service. It can look at your wsdl file and generate java objects that correspond to your .net objects.
They have a HOWTO on their site as well.