how can I talk to a blazeds endpoint without flash - java

i would like to reuse my existing blazeds/java/spring apps to write some html 5 clients. Is anyone aware of a pure js (no swf bridge allowed) client that has pub/sub capability
so far my googling has found 2 projects - jsasmf (which uses a tiny swf) and amf.js which is missing pub/sub, but no other projects besides these 2
any ideas (crazy is fine) on how to do this appreciated
cheers

Why not annotate your blazeds service object implementation with jersey annotations to expose it as a rest service. It should be possible to expose the same service through blazeds and rest at the same time. You could use Atmosphere to implement pub/sub

This may be possible with another server. You would consume the service with flash on that server and expose its api with web sockets (for example) to other clients. Your clients would not need flash installed.

Extending on Erik Martino's answer... you could try compiling a Java AMF client to JavaScript yourself using GWT.

Late to the party but is seems Adobe has a JS Client too. I you download the trail of Dataservices ES 4.6 its in the resource folder. A tutorial can be found here

Related

communication between jruby app and java app that are on different servers

Anyone has expirience on having Jruby project running on Jboss (using torquebox or whatever) with an ability to communicate with another "japps" not on the same jboss where jruby app is, i.e. some java project on another jboss?
I know there is an torque-messanging but dunno if it's possible to communicate with external(out of jruby-app's jboss) app?
Best practices are welcomed.
Thanks in advance.
P.S. placing that other app on the jboss where jruby app is not acceptible solution.
I can recommend you to use Thrift and build communication via them.
Thrift have generator for both your needed languages (Java and JRuby) and provide good and fast communication.
UPDATED:
Thrift is RPC (remote procedure call) framework developed at Facebook. In detail you can read about it in Wiki.
In few word to save you time, what it is and how to use it:
You describe you data structures and service interface in .thrift file(files). And generate from this file all needed source files(with all need serialization) for one or few languages(what you need). Than you can simple create server and client in few lines
Using it inside client will be looks like you just use simple class.
With Thrift you can use what protocol and transport used.
In most cases uses Binary or Compact protocol via Blocked or Not-blocked transport. So network communication will be light and fast + with fast serialization.
SOAP(based on XML on HTTP) packages, its in few times bigger, and inappropriate for sending binary data, but not only this. Also XML-serialization is very slow. So with SOAP you receive big overhead. Also with soap you need to write (or use third-party) lib for calling server(tiny network layer), thrift already made it for you.
SMTP and basically JMS is inappropriate for realtime and question-answer communication.
I mean if you need just to put some message in queue and someone sometime give this message and process it — you can (and should) use JMS or any other MQ services(Thrift can do this to, but MQ architecture is better for this issue).
But if you need realtime query-answer calls, you should use RPC, as protocol it can be HTTP(REST, SOAP), binary(Thrift, ProtoBuf, JDBC, etc) or any other.
Thrift (and ProtoBuf) provide framework for generate client and server, so it incapsulate you from low level issues.
P.S:
I made some example in past https://github.com/imysak/using-thrift (communication via Thrift Java server + Java Client or node.js client), maybe it will be useful for someone . But you can found more simple and better examples.
Torquebox supports JMS. The gem you specified torquebox-messaging allows for publishing and processing of HornetQ messages on the local JBoss AS server/cluster that the JRuby app is running in. I don't think it currently supports connecting to remote servers.
Using this functionality in your JRuby app you could then configure your Java app on another server to communicate with HornetQ running in the JBoss AS that the JRuby app is running on.
Alternatively you could always implement your own communication protocol or use another Java library - you have access to anything Java you want to run from JRuby.
You can use Web Services or JMS for that

How to connect WSDL file in my application using SOAP service?

I am doing a project using Java and BPEL. I successfully created webservices in Java and integrated them using BPEL. All i generated a single output WSDL file. Now, I have to use this output WSDL file in my application using SOAP communication. How can i do that? Is there any help out side for such scenarios? Walkthroughs are really appreciated..
Depending on the architecture of your application (Standard Java, Spring-based, ...) there might or not be a documented procedure to consume a SOAP-based webservice.
On the other hand, you're always free to pick a webservice development framework to handle that. For instance, you could pick either CXF or AXIS2 (I believe these are the two most popular frameworks for Java WebServices). Each of these frameworks provides a tool called "wsdl2java" that helps you generate client-side/server-side/both Java classes. Then, you can easily add those classes and the requireds libraries to your application.
Having used CXF in the past, It even does provide several way to consume a webservice
Generating the client-side classes
Using CXF dynamic client factory : basically, you'll retrieve an endpoint proxy from a factory object.
Hope that'll help
I start with SoapUI (or downloadable from sourceforge), that will let you consume the WSDL and fire off requests against your server. Typically I'm hitting someone else's webservice, and trying to figure out what the data looks like before I start wiring my code together, but in your case its just a verification that the services would be/are working.
Then, as #KHY said, you can automatically convert the wsdl into java with a wsdl2java and start coding (look under the Related list on the right panel of this SO screen)
If it is a Java application, then the easiest way to consume a service is using JAX-WS. It's really easy to create a Web service client from WSDL.
See this link
Once you deploy the BPEL project on server, then refer the WSDL with http://server:port/application/YourBPELProjectService?WSDL in the consuming application. You will need to write different client code based on the BPEL type - Synchronous, Asynchronous etc.

Integration JS and Java

I have two systems to integrate: 1)desktop application (Java6) and 2)web-application (HTML,JS). I want first application to share some services to the second one. How could simply I do that ? I want some simple solution.
Thanks!
Expose them as standards Web Services or RESTful web-services
For an application to serve services, it should start server socket on port and listening on it. Or it should be using webservices. JDK6 comes with WebServices support. May be you can look at it.

java: basic web service interface without a web server

how hard is adding a basic web services interface to an existing java server application without having to turn it into a .war, or embedding a small web server like jetty?
say, xml-rpc instead of more modern approaches, if it helps.
if not too hard, can you suggest a starting point?
thank you in advance :)
It sounds like you're asking for the impossible: expose an HTTP service without plugging into or embedding an HTTP server!
Unless you want to reimplement what Jetty already does, I'd reccommend using Jetty as a library. That way you don't need to conform to the more awkward aspects of the Servlet spec. E.g. your servlets can have real constructors with parameters.
There is also a simple HTTP server implementation in JDK 6, but it's in the com.sun namespace so I'd avoid it for production code.
Check out the Restlet API which provides a painless way to implement RESTful web services that can run inside a web container or standalone.
I don't know what you are doing, but what about rmi?
RMI # stackoverflow
Spring-WS has the facility for using JRE 1.6's embedded web server, if that's an option for you. Spring-WS gives you a very nice SOAP server layer, if that's what you're after.
If not, then an embedded Jetty instance is probably the best idea.

Communicating between Java and Flash without a Flash-specific server

I have Java and Flash client applications. What is the best way for the two to communicate without special Flash-specific servers such as BlazeDS or Red5? I am looking for a light client-only solution.
Well, you can make http requests from flash to any url... so if your java server has a point where it can listen to incoming requests and process XML or JSON, your flash client can just make the request to that url. BlazeDS and Red5 just aim to make it simpler by handling the translation for you making it possible to call the server-side functions transparently.
Are they running in a browser (applet and SWF), or are they standalone apps?
If they're running in a browser then you can use javascript. Both Flash and Java are can access javascript. It's fragile, but it works.
If they're running as actual applications then you can have Java open a socket connection on some port. Then Flash can connect to that and they can send XML data back and forth.
I've done both of these, so I know they both work. The javascript thing is fragile, but the socket stuff has worked great.
WebORB for Java may be of some help to you. It integrates with your J2EE code.
For more info:
http://www.themidnightcoders.com/weborb/java/
I'm sorry, I reread your question that you are only looking for a client side solution. In this case, WebORB will not help you. Sorry for the misunderstanding.
There's a Flash implementation of Caucho's Hessian web service protocol. This approach would be similar to using JSon or XML, but is more performant, since Hessian is a binary protocol. If you happen to be using Spring on your server, you can use the Spring/Hessian binding to call you Spring services directly from your Flash application with minimal work.
Merapi Bridge API
Merapi allows developers to connect Adobe AIR applications, written in Adobe Flex to Java applications running on the user's local computer.

Categories

Resources