Netbeans and .NET web services - java

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.

Related

PHP Soap / Java

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.

Providing a Java Programm as (D)COM Service

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.

Transform any ActionScript class in XML

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).

Communication model: C++ and Java

Pals,
I have a requirement to establish a communication channel between C++ and Java layer of my application for the exchange of objects and their properties.
I have got the following options:
XML / SOAP
Postgre SQL
Can you please advice me the Pros & Cons on these. Please share your experiences on the implementation complexities.
Thanks,
Gtk
If the option is between those I would choose XML
Object <=> XML
Java side Simple, C++ side XML Objects
Reason, its simpler for what you want, i.e. pass language objects and not Data Base
Ah, could you specify the communication channel between the apps ?
UPDATE
If you can use JSON I would recommend it instead of XML, here is why.
Another option would be JMS. There are C++ clients out there.
Every time I see XML I think RESTful web service. Both platforms you mentioned have some form of tooling to marshal & unmarshal XML. There are plenty of working examples out in the wild, so a Google/Bing search is good. A nice side-effect is once you have those interfaces built, anything can connect to them.
If you really want to bother with generating a WSDL, then feel free to go the SOAP route. However, speaking with several years of web service integration experience, RESTful is so gosh darned simple compared to anything else.
I would like to suggest a third option : YAML
You have parsing library in YAML for both java and C++. In my experience, it's easier to debug exchange in YAML that in XML (especially if you got full text field or cyclic data structure).
I depends of the kind of message you transfer.
If your message are individual entity that have a short live, I would go for XML, YAML or something similar.
If your message contains information that is going to be used later on and refer to information in previous messages, I would use a database.

Are there different methods to call Java from Oracle Application Express

Friends,
I'm working on a requirement where I need to call a Java API from Apex.
The solution I put forward was to create a Java class, store it the database and add a PL/SQL wrapper and then use it. Which is pretty much what is described here.
Whilst I am happy with this, I am interested to know if this is the only method? are there other options that I could explore?
Thanks in advance
From what I've seen, APEX doesn't have anything special for calling Java Stored Procedures.
So it's the same thing as calling a Java SP from within PL/SQL.
As can be seen here there is no other way of doing it beside the one you use now.
I would just add that what you actually call a wrapper is in fact the way a Java SP is published to the data dictionary(it makes it available to the SQL/PLSQL contexts). In your case you do it by defining a top-level call specification. Alternatively you can publish it by defining either a package or an object type call specification. For more details see this link.

Categories