Call a Business Operation Directly (programmatically)

223 views
Skip to first unread message

Michael Lundberg

unread,
Apr 24, 2015, 4:36:47 AM4/24/15
to Ensemble-in...@googlegroups.com
Hi

I have build production included a business-operation (EnsLib.SOAP.OutboundAdapter) which send requests to a webservice. This production works well with data incoming from a business-service. However, i also have a csp-frontend to users in same namespace who sometimes need to send a request directly from the csp-page.

I have made a class in backend which receives data from a csp-form and building up a request of that kind the business-operation demands. But i struggle to call/invoke that business-operation with my request in varying ways from that class, but always failed so far.

Is it any way that i can call a business operation (of type EnsLib.SOAP.OutboundAdapter) from a regular class programmatically? Or build some virtual instance of the same and send through that?

I would be grateful for answers.

Regards, Michael


Michael Braam

unread,
Apr 24, 2015, 4:54:18 AM4/24/15
to Ensemble-in...@googlegroups.com

Hi Michael,

 

you have to create a business service that receives the request from your CSP page. This business service then invokes the business operation.

 

You can invoke the business service from within your CSP code like this:

 

Set tSc = ##class(Ens.Director).CreateBusinessService(<MyBServiceName>, .tSrv)

 

This returns in case of a successful execution a reference to your service instance in the variable tSrv.

 

You then invoke your service with tSrv.ProcessInput(<Your Input data>)

 

Hope this helps.

 

Michael Braam

Senior Sales Engineer

 

InterSystems GmbH

Hilpertstr. 20a

D-64295 Darmstadt

Tel.: +49 (0)6151 / 1747-0

Fax: +49 (0)6151 / 1747-11

Michae...@intersystems.com

www.intersystems.de

 

Geschäftsführer: Jörg Klingler, John Macheras, Lawrence Bradley
Eingetragen beim AG Darmstadt unter HRB 4966

 

cid:79CD1ACB-420E-4592-AF6E-D631F500FA77

Treffen Sie uns vom 10. bis 12. Juni 2015 beim ehealth summit germany

im Rahmen des Hauptstadtkongress 2015, Medizin und Gesundheit, Berlin!

--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to
Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Lundberg

unread,
Apr 24, 2015, 5:36:13 AM4/24/15
to Ensemble-in...@googlegroups.com

Thank you for your answer and i appreciates that. I will try that approach!

//Michael

To post to this group, send email to Ensemble-in-Healthcare@googlegroups.com
To unsubscribe from this group, send email to
Ensemble-in-Healthcare-unsub...@googlegroups.com


For more options, visit this group at
http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.

To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healthcare+unsub...@googlegroups.com.

Amir Samary

unread,
Apr 24, 2015, 7:08:36 AM4/24/15
to "Ensemble-in-Healthcare@googlegroups.com", "Ensemble-in-Healthcare@googlegroups.com"
Hi!

You can only call a Business Operation from another business component such as a Business Service or a Business Process. That is by design.

So, your only option is to create a Business Service with no adapter and add there an instance Method say “MyMethod” that would receive the parameters needed and would build a request of the type your BO needs and push it to the ProcessInput() instance method of the BS. Then, on OnProcessInput you would call SendRequestSync() or SendRequestAsync() depending on your needs to send the request to your BO.

Add your new BS to your production. 

From your page, you would have to use ##class(Ens.Director).CreateBusinessService() to create an instance of your business service and call your MyMethod on it.

Business Services are the way services are exposed to the world. 

Kind regards,
AS

Michael Lundberg

unread,
Apr 24, 2015, 7:22:49 AM4/24/15
to Ensemble-in...@googlegroups.com
Hi again

I did not work out very well. I succed to create the service : Set tSc = ##class(Ens.Director).CreateBusinessService(<MyServiceName>, .tSrv) (Adapterless)

And i also can execute the process:  Set tSc = tSrv.ProcessInput(tRequest,.tResponse)

I can se that the Business Service wake up and take the parameters i sent (I traced them out).  

So far all well

But as soon try to invoke:
Set tSC = ..SendRequestSync(..TargetConfigName,tRequest,.tResponse
the complete production hang every time and i have to terminate the processes manually to be able to continue.

From production in managerrportal  errormsg coming:

HyperEvent Error Details

HTTP Code: 504

Error: Unexpected status code, unable to process HyperEvent: Gateway Time-out (504)

Exception Details

A JavaScript exception was caught in function 'zenInvokeCallbackMethod'

TypeError: allChanges is null


====================================

Error invoking callback code. Code: "zenPage.refreshStatusHandler();" Source: <timer id="statusTimer">

====================================


So i'm stuck again

//Michael

Den fredag 24 april 2015 kl. 10:54:18 UTC+2 skrev Michael Braam:

To post to this group, send email to Ensemble-in-Healthcare@googlegroups.com
To unsubscribe from this group, send email to
Ensemble-in-Healthcare-unsub...@googlegroups.com


For more options, visit this group at
http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.

To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healthcare+unsub...@googlegroups.com.

Message has been deleted

Michael Lundberg

unread,
Apr 24, 2015, 8:08:38 AM4/24/15
to Ensemble-in...@googlegroups.com, ensemble-in...@googlegroups.com
Working! Thanks for all help. The problem was a validationerror in the request and the service/operation tried to sent it anyway and that got stuck. Thanks to Amir Samary and Michael Braam. You made my day. Have a nice weekend!

Michael Lundberg

unread,
Apr 24, 2015, 8:09:39 AM4/24/15
to Ensemble-in...@googlegroups.com

Working! Thanks for all help. The problem was a validationerror in the request and the service/operation tried to sent it anyway and that got stuck. Thanks to Amir Samary and Michael Braam. You made my day. Have a nice weekend!



Reply all
Reply to author
Forward
0 new messages