Techniques for Calling into a WCF Service from Java - java

Besides using Web Services, or POX (or custom HTTP), are there some other techniques that I could utilize for calling services exposed from WCF via ___________ to the Java world? These requests will be in the same machine. Maybe RAW TCP/IP?
I'm just inquiring for a project that we need to possible provide some method of calling synchronous code in the .NET world and return results to our Java world.
Thanks for suggestions.

To talk with a Java client you'll have to use one of the interoperable protocols which limits you to going across HTTP or HTTPS. TCP can only be used between clients running Windows on an intranet. Even on the same machine you won't be able to use Named Pipes either for the same reason.
The interoperable protocols are covered in Chapter 1 of "Programming WCF Services" by Juval Lowy.

You can try following project http://iiop-net.sourceforge.net/

Related

rmi and webservice

currently i have an web app build with Strus2 and Spring (IoC, Transactions), and i want to split this into 2 apps; one client which will contain only the web part and one core services that will be accessed via webservices and/or rmi.
I have a dilemma in what technology should i use for "glue", because i like the fact that webservices can be accessed by any clients (php,.net,...,mobile), but as i understand java rmi is faster then webservices.
I was thinking to expose the functionality via webservices and rmi in the same time... but i do not know how to do that.
Also in my current app i have a ajax action that is executed each second from the client to the server, and in this new configuration i think that there will be some performance penalties due to this.
How should i "attack" this situation ?
Thanks,
but as i understand java rmi is faster then webservices.
Why do you think this? Do you have a citation to bolster this claim?
Both RMI and webservices are using TCP/IP; both incur similar network latency. The former uses Java or CORBA serialization to send messages over the wire; the latter uses either HTTP (for REST) or XML over HTTP (for SOAP or RPC-XML).
The relative speed is far more dependent on what those services are doing and how you code them.
I would prefer a web service because simple and open win. You are restricted to RMI/CORBA clients if you use RMI.
Nice. You are running Spring and you already have all you need. Just throw in a few jars (spring webservices and related jars) and you should be good to go.
Please refer :
http://static.springsource.org/spring/docs/2.5.4/reference/ejb.html
http://static.springsource.org/spring/docs/2.5.4/reference/remoting.html

Java client for AppFabric Cache?

Is there any java library available to use Windows Azure AppFabric Caching features?
I want to put some string in the AppFabric cache from a java application and retrieve it from a .Net application (and the other way around too).
AppFabric SDK for Java Developers provides classes to access AppFabric Access Control and Service Bus, but it doesn't provide classes to access Caching features.
Thanks in advance
I think you've got two options here:-
Reproduce in java, from a client perspective the mechanism that the appfabric client uses to interact with the cache cluster. You'll need to sniff out the tcp messages that the appfabric client wcf creates and reproduce them.
Expose a mechanism from your ASP.NET app that wraps the call to the .net AppFabric client and make your Java app call the wrapper. The wrapper could expose a SOAP or restful interface - you could provide CRUD cache methods.
If I were you I'd, do the latter. I think it'd be faster to implement and easier to test.
Seems to be impossible to have a native client because of tcp transport and serialization (deserializing in java ...). A WCF service using a basicHttpBinding can solve your problem. The problem is that is will need a separate hosting and it will not as fast as AppFabric native client.

Exposing C++ program as a Web Service

How to expose a C++ program as a Web Service?
Or is it a better idea to invoke C++ from Java and expose the resultant Java as a Web Service.
In any case, the C++ program should not undergo any changes.
Consume C++ program in Java WebService end point and expose java webservice
Use JNI to consume C++ program
Nice article from JavaWorld
Interestingly, webservices work on http protocol, which means that you can't "host" a webservice written in C++ without having an http server. Since each web server will have it's own mechanism of writing "hooks" or extensions, the next obvious question is which web server would you like to chose.
Let's say you want IIS on Windows. It's possible to use ISAPI extensions; so you need to know how to write one, which complies with web services standards. Or, alternatively, it's better to learn how to do it in C++ with Visual Studio, which will have lots of built-in stuff to help you get started.
In short, there is no "standard" way of exposing a web service in C++ and you have to be "platform" specific. Windows with IIS has one way of doing it. Apache Axis C++ has another.
You can try c-sevice-interface https://github.com/Taymindis/c-service-interface.
It create a C/C++ program as a service port and listening to NGINX fcgi.
This is a small bridge engine which can handle high load of request, any segfault will not break the engine, it will catch and free the thread, it is built on top NGINX, FCGI. You can setup the proxy, load balance, authentication via NGINX before reach to your interface.
The link shown as below is a wiki to Guide you how to startup from scratch.
https://github.com/Taymindis/backcurl/wiki/How-to-build-BackCurl-for-cpp-Android-development

Java and .NET application communication

I don't think this is quite possible or if it is recommended to do... but is there a way to connect or comunicate or deploy Java and .NET application for method beside Web Services. I mean I understand there are Messaging server that allows Java application communicate to each other but I dont know if this can cross development environment, any suggestion about it or thoughts about this?
I'm limited to web and desktop environments.
Apache Thrift is a way to go. You will need to write a service definition like this:
serivce helloworld{
string sayHello(1:string name)
}
Thrift then will generate RPC interface with network layer already implemented, It support many others language such as Java, C#, PHP, Python. Thrift support binary protocol over TCP/IP, so it's very fast.
for more, go to its wiki page http://wiki.apache.org/thrift/
You can use something like Apache ActiveMQ which uses JMS on the Java side and the .NET Messaging API on the .NET side.
We ended up writing our own implementation of Java-.Net communication protocol based on Hessian (later added JSON as well), but Thrift is a valid option.
The virtual machines (JVM vs CLR) are not going to talk to each other except through some OS level open standard. Shared Files (yuck), Sockets and Web Services come to mind. There is nothing that would allow you to call a .net subroutine from java or vice-versa.

How to connect .Net app to JMX agent?

I need to connect my .Net application to somebody else's JMX agent. I've read that this is simply not the done thing and I should use soap or practically anything else. As this is just not going to happen, are there any libraries or interop techniques out there that can help me? I'm only interested in the simple things like invoking a remote operation or returning a string result.
.NET is really not the technology to use to talk to JMX. JMX is a builtin standard that is part of Java but is pretty specific to running in Java. I would assume that you cannot control the application you are trying to consume since you indicate you are trying to use someone else's JMX agent.
In that case, you might want to consider writing your application or part of it in Java. That is the best way to get access to the JMX. If that is not an option you do have a few things you could look into:
1) Check to see if the application you are connecting to can expose the data as something other than JMX. It is usually not hard to allow access via web services to the same data.
2) Write a small Java wrapper that talks to the JMX server and exposes web services. This allows you to query the web services which in turn go over JMX.
3) There are other agents that JMX has to allow it to talk with different technologies. You could use something like the SNMP agent and use SNMP traps from .NET. More information on that can be found here: http://java.sun.com/javase/6/docs/technotes/guides/management/snmp.html
If you start up an HtmlAdaptorServer - you could just use the URLs to invoke JMX methods using standard HTTP calls.
I've done this in the past from Perl as part of a system administration task. Its not pretty and its unmaintainable if the JMX interfaces are changing a lot. But.. if you need a quick and dirty hack - this is it!
The Web Services Connector for Java Management Extensions (JMX) Agents and the reference implementation ws-jmx-connector would be my choice. JSR 262 will provide a new opportunity for cross-platform/cross-language enterprise integration projects, but development unfortunately has slowed down.
It would only require some SOAP calls to invoke all operations of the JMX management interface, IIRC even including callbacks/notifications.
You can do this with IKVM. It is a Java Byte Code to .Net CLR compiler and works just fine with JMX.

Categories