Calling a Sonic Service from a Progress program

Posted by Admin on 26-Sep-2008 18:56

Hello!

We are just starting to incorporate the sonic technology into our system.

We basically want to write progress programs (.p) which would receive inputs from our users.

From these programs, we would like to call a sonic service/process to process (i.e. validate, etc) these inputs.

We are looking for the best way to do this.

Basically, how can we call a sonic service/process from within our progress abl code such that our programs can reliably execute those sonic instances as well as reliably receive return values from these processes?

Example behavior:

1. Progress program receives inputs from users

2. Progress program calls sonic service

3. Progress program receives return value from the sonic service

4. Progress program continues execution.

Any help would be very much appreciated.

Thanks.

If this is impossible, please let me know too.

All Replies

Posted by rstanciu on 29-Sep-2008 04:09

here you have some examples for SonicMQ Adaper.

You dont can call a sonic ESB service directely, you have to deploy a ESB Process instead.

The deployed ESB Process has a Entry point like dev.Entry and an exit point like dev.Exit.

From 4GL you have to just send a JMS message to the dev.Entry point to start the ESB process.

Another way to start a ESB process is to deploy the ESB process as Web-Service on Sonic side and

call this service in 4GL as:

/*******************************************************************/

/* client_sonic1.p */

/*******************************************************************/

DEFINE VARIABLE hWebService AS HANDLE NO-UNDO.

DEFINE VARIABLE hPortType AS HANDLE NO-UNDO.

DEFINE VARIABLE cResponse AS CHARACTER NO-UNDO.

DEFINE VARIABLE li AS INTEGER NO-UNDO.

DEFINE VARIABLE retValue AS CHARACTER INITIAL "OK" NO-UNDO.

DEFINE VARIABLE err AS LOGICAL NO-UNDO.

DEFINE VARIABLE result AS CHARACTER NO-UNDO.

/*******************************************************************/

CREATE SERVER hWebService.

ETIME(true).

li = MTIME.

hWebService:CONNECT("-WSDL 'http://localhost:2580/process/testESBServiceWS?wsdl'").

IF NOT hWebService:CONNECTED() THEN DO:

MESSAGE "SERVER NOT CONNECTED" VIEW-AS ALERT-BOX.

retValue = "ERROR".

END.

RUN testESBServiceWSPortType SET hPortType ON SERVER hWebService NO-ERROR.

IF ERROR-STATUS:ERROR THEN DO:

MESSAGE "Failed to create hPortType" VIEW-AS ALERT-BOX.

retValue = "ERROR".

END.

RUN testESBServiceWS IN hPortType(

INPUT '

0 THEN DO:

errorfound = TRUE.

DO i = 1 TO ERROR-STATUS:NUM-MESSAGES:

MESSAGE ERROR-STATUS:GET-MESSAGE(i) VIEW-AS ALERT-BOX.

END.

/2/

IF VALID-HANDLE(ERROR-STATUS:ERROR-OBJECT-DETAIL) THEN DO:

hSOAPFault = ERROR-STATUS:ERROR-OBJECT-DETAIL.

MESSAGE

"Fault Code: " hSOAPFault:SOAP-FAULT-CODE SKIP

"Fault String: " hSOAPFault:SOAP-FAULT-STRING SKIP

"Fault Actor: " hSOAPFault:SOAP-FAULT-ACTOR SKIP

"Error Type: " hSOAPFault:TYPE VIEW-AS ALERT-BOX.

/3/

IF VALID-HANDLE(hSOAPFault:SOAP-FAULT-DETAIL) THEN DO:

hSOAPFaultDetail = hSOAPFault:SOAP-FAULT-DETAIL.

MESSAGE "Error Type: " hSOAPFaultDetail:TYPE

VIEW-AS ALERT-BOX.

HeaderXML = hSOAPFaultDetail:GET-SERIALIZED().

DISPLAY HeaderXML LABEL "Serialized SOAP fault detail"

WITH FRAME a.

END.

END.

END.

END PROCEDURE.

/*******************************************************************/


Sonic_Router2.zip

Posted by jtownsen on 29-Sep-2008 05:16

As Rares said, you can achieve what you're wanting either by sending a JMS to the process's Entry Endpoint or by calling the process as a Web Service. The Web Service approach will add extra overhead at runtime (the AVM has to package the request in SOAP and unpackage the result) and you may not get the Quality of Service that you might be expecting. For those reasons, it's usually better to take the JMS approach.

Just another point on the samples that Rares attached, they're the standard samples from the OpenEdge documentation distribution, which (unfortunately) haven't been updated for quite a while. Newer versions of Sonic enable security by default and you may notice that sample1.p has been updated to correctly authenticate with the Sonic Broker. To try the other samples, you'll need to add the setUser and setPassword statements. The setClientID statement is only necessary if you're using clientPersistence (which sample1.p does not).

Some alternate samples can be found here: http://www.psdn.com/library/entry.jspa?externalID=5279


Sonic_Router2.zip

Posted by rstanciu on 29-Sep-2008 06:36

Note:

1) the "web-services" approach is basicaly a syncron communication (request-now/response-now)

2) the "JMS" approach is basicaly a an "asyncron" communication

(request now / response later).

You can change the default behaviour by using a request/replay

implementation: example20.p example21.p


Sonic_Router2.zip

Posted by Admin on 03-Oct-2008 10:29

thanks a lot!

i'm guessing these are the only ways to do it: (jms adapter and web service)?

Also, does anyone know if calling web service from abl code in OE10.1C is supported in HP-UX Itanium. We still have OE10.1B and web service call is not supported.


Sonic_Router2.zip

Posted by rstanciu on 06-Oct-2008 10:01

As I known the web-services call is supported in 10.1C/Itanium


Sonic_Router2.zip

Posted by Admin on 09-Oct-2008 16:27

thanks Rares!

But do you know if there's some patch/service pack for OE10.1b that would make web services working for Itanium?


Sonic_Router2.zip

Posted by rstanciu on 10-Oct-2008 06:47

beter ideea is to ask the Technical Support:

https://www.progress.com/cgi-bin/techweb-emea.cgi/qtm51/quicklog/usrqklog.w


Sonic_Router2.zip

This thread is closed