Need help

Hi

I want to know how do I integrate webMethods with SUN IM

the requirement is,

I have webMethods getting data from Oracle database, which can be converted in xml or SOAP . But need to build a mechanism by which these messages can be converted in XMPP to send it to the particular user.

We are using JWChat as the client.

please help.

[372 byte] By [meomkar] at [2007-11-26 11:34:16]
# 1

Hi,

I dont really have enough knowledge of your deployment or design, but will take a shot at it anyway.

An easy way to achive this would be :

1) Have a xmpp user at your backend which opens an xmpp session to the server.

2) As of JES4 IFR, we support httpbind - so have your jwchat client talk to the httpbind gateway to open a XMPP over HTTP session.

Send the relevent data as 'message' to the jwchat user.

If you are using Sun's IM api to write the xmpp client at the backend, the api should tell you how to write a (custom) message and send it across.

Please do let me know in case you need more clarifications or specify your requirements more so that I can help you better.

Regards,

Mridul

mridulm80 at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 2

ok,

1. we have SUN Im as message server nad JW Chat as Message client. so do i need to enable httpbind on both

what do you mean by "have your jwchat client talk to the httpbind gateway to open a XMPP over HTTP session"

2. I need to send alerts as events to the users

as we will use WebMethods application to generate the message

can we do this by formating a simple XMPP message ? or do we have to go via SUN's IM api.

can we expose the SUn API as some service

meomkar at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 3

Which version of the Sun IM product are you using ?

1)

In JES4 IFR, we added support for JEP124 - which will allow any 124 compliant client to talk to the IM server over http (like jwchat).

You will need to install and configure the httpbind gateway which comes with the product and configure the jwchat client to talk to this gateway url.

Once everything works fine, the jwchat client will have an XMPP session with the IM server over HTTP using the httpbind gateway (not tunneling through proxies, but proper http).

2)

Alerts can essentially be considered as directed messages to the reciepent from the sender : but for this, you willl need to know the reciepents address (jid) at the sender's side.

What you can do is, write a small im client using the sun im api which uses some creds to create an xmpp session with the im server, and then use the Message related api to send a directed message to the jid of the jwchat user.

The actual contents of the message is up to you to define and use as.

The jwchat client will recieve a directed message from the sender, and will 'unpack' the message and retrieve the contents you sent it.

This could be a simple enough message, or can be a complex payload requiring other processing - that is up to the sender (your client) to define.

Ofcourse, at the backend side, you need not necessarily use the Sun IM api, but any other xmpp api available - and it will work fine too : the server and client api are standards compliant, so any valid xmpp stanzas will work.

If you want to look at the relevent api, you can take a look here :

1) com.sun.im.service.CollaborationSessionFactory on creating a xmpp session.

2) com.sun.im.service.CollaborationSession on what can be done with a session.

3) com.sun.im.service.Message , com.sun.im.service.NotificationService for sending a message.

For examples on how to use these in code, refer to com.sun.im.service.shells.Shell if you have the api.

Regards,

Mridul

MridulM at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 4

Hi,

So if I use webMethods to create the XML streams which can be sent to the SUN IM server, with details of the user to whom we need to send the message ?

In that case what will be the communication channel, do i need to create or define a session explicitly ?

Is there a standard xmpp format message for SUN IM ?

meomkar at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 5
We are using version 7 2006Q4but am not able to find the API documentation.
meomkar at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 6
If you have the client resources deployed, the javadoc api this will in http(s)://<yourserver>/<imdocroot>/apidoc : like, https://acme.com:8080/im/apidocRegards,Mridul
MridulM at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 7

Hi,

The IM api we bundle has a few requirements :

a) It spawns threads to handled async IO.

b) It opens sockets, and manages these directly directly for its operation.

c) It needs to load classes at runtime based on jar manifest configuration.

Some containers do not support these requirements from their managed apps - like a EJB hosted in a J2EE container.

I am not exposed to webMethods and what sort of container it exposes to clients : so if any of these are not supported, you cannot directly use our api.

That being said, there are simple workarounds to this (like write message a jms queue and author a standalone client which will read from this queue, and transfer that over the xmpp session which it has with the IM server).

If you are using the IM api from Sun, we do have abstraction layer which allows you to create complex message data which can be sent to a reciepent.

Please refer to com.sun.im.service.MessagePart, com.sun.im.service.Message, etc api.

Regards,

Mridul

MridulM at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 8

Hi,

I got confirmation from my webMethods team that it can send XML / HTTP streams.

considering the option of enabling xmpp/http gateway over sun IM for JWChat, we can use the same gateway to transport the XML message to the SUN Im server, which will then forward this to the required user via JWCHAT. We will put the clients JID information in the message.

so flow is,

Webmethods creats XML stanzas / streams - from the data captured from databse

Send it to SUN IM XMPP/HTTP gateway

will it work ?

meomkar at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 9

Hi,

Consider the following :

WMC : webMethods based client which fetches the relevent data (assumed JID webmethods@domain)

IMS : IM Server (server hosting 'domain')

HBG : HTTPBind Gateway for IMS

JWC : JWChat client. (assumed JID client@domain)

The most common way to model the requirement would be like this :

WMC <- xmpp --> IMS -- HBG <- http -> JWC

WMC will create a message like this :

"

<message from='webmethods@domain' to='client@domain'>

<Your custom message here />

</message>

"

and send it directly to IMS - the protocol between both would be a direct connection based XMPP session.

Irrespective of how the destination of this message (client@domain) has connected, the server will take care of routing it to the relevent client. however it is connected to the server.

That is, at the webmethods client you need not worry about how the reciepent client is connected to the server and how it can be reached, etc - it is the servers responsibility to route the message appropriately.

You can consider the entire IM server and HTTPBind combination as a bidirectional real time messaging bus.

This being said, to answer your question :

You can have your webmethods client directly talk XMPP to the server or XMPP over HTTP using the httpbind gateway - whichever is convinent for your implementation. This deployment would support both. The IM java API we expose as part of our product allows you author a client which can achieve both.

Ofcourse, you could always use any other standards compliant library in your language/platform of choice to get it to work too.

What you are proposing would essentially be :

WMC <- http -> HBG -- IMS -- HBG <- http -> JWC

Typically, httpbind gateway is used to allow access when direct socket connection to the server is not possible : like when user is connecting through a http proxy, constrained clients, j2me devices which can sustain a tcp/ip connection for long, etc.

In this particular deployment, if it was possible to open a direct xmpp stream to the im server from the webmethods client, that would be preferable to using httpbind gateway.

Ofcourse, the approach you describe (if I did not get it wrong above) will work perfectly fine too ... just that the other is slightly more preferreable.

I hope this clarifies a bit more.

Regards,

Mridul

MridulM at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 10

Thanks,

so if we take 2nd solution as the option. I can send message like below,

POST /webclient HTTP/1.1

Host: httpcm.jabber.org

Accept-Encoding: gzip, deflate

Content-Type: text/xml; charset=utf-8

Content-Length: 188

<body rid='1249243562'

sid='SomeSID'

xmlns='http://jabber.org/protocol/httpbind'>

<message to='contact@example.com'

xmlns='jabber:client'>

<body>Hi there!</body>

</message>

</body>

to SUN IM via HTTPBind Gateway for IMS

regards,

Omkar

meomkar at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...
# 11
Perfectly correct !Ofcourse, I am assuming that you have a negotiated httpbind session of session id (sid) SomeSID, and that the httpbind gateway is deployed under /webclient (default /httpbind/httpbind)Regards,Mridul
MridulM at 2007-7-7 3:50:08 > top of Java-index,E-Mail, Calendar, & Collaboration,Sun Java System Instant Messaging...