PDA

View Full Version : SubActionComponent



spmva
05-27-2006, 02:51 AM
I find it interesting that a search of this forum for "SubActionComponent" did not return any results. I guess that changes now.

I'm having some trouble with this one. As I understand it the SubActionComponent allows you to call another .xaction and utilize the results in the calling .xaction.

I'm having trouble with the second half of that...getting the results back to the calling .xaction.

I decided that there were certain SQLLookupRule components that were very reusable. I created a simple .xaction that contains the following output:



<outputs>
<query-result type="result-set"/>
</outputs>


and in the SQLLookupRule i added the following action-output;



<action-outputs>
<query-result type="result-set"/>
</action-outputs>


Running this .xaction on it's own is quite successful.

I defined my SubActionComponent as follows in a separate .xaction:



<action-definition>
<component-name>SubActionComponent</component-name>
<action-inputs>
<campaignId type="long"/>
<geoSetId type="long"/>
<providerId type="long"/>
</action-inputs>
<action-outputs>
<query-result type="result-set"/>
</action-outputs>
<component-definition>
<solution>mip-default</solution>
<path>common</path>
<action>service-provider-pn-geo-distribution.xaction</action>
</component-definition>
<action-type>Get PN DataSet from Service</action-type>
</action-definition>


then referenced that data in the <action-inputs> ChartComponent (that is the next action in the action-sequence) as follows:



<chart-data type="result-set" mapping="query-result"/>


In the end, this .xaction returns the URL of the chart that was created as the final output.

When I execute this.xaction with ViewAction, the following shows up in the console:


java.lang.ClassCastException
at org.pentaho.plugin.jfreechart.ChartComponent.executeAction(ChartComponent.java:117)

and I get a blank browser window. If I call it with ServiceAction, the query-result value appears. with the same failure in the console.

I've had similar failures with an even more simplistic data type. I was just trying to pass back a string value from a SubActionComponent. Of course, that was in my early moments of working with pentaho...I thought I had a better handle now.

Any thoughts on my problem would be appreciated.

Best regards,

Steve

Post edited by: spmva, at: 05/27/2006 06:53

spmva
05-27-2006, 02:56 AM
Execuse my edit. The board stripped my XML again, despite it being wrapped in "code" tags. Had to cutnpaste the post to notepad and findreplace the offending chars.

steve

jcorn
05-28-2006, 08:02 AM
Hi Steve,

In the output of the called action sequence you will need to send the query-result to the session:





QUERY_RESULT




Then, in the calling action sequence, create an input that looks for that QUERY_RESULT on the session:





QUERY_RESULT




I attached an example of an action sequence that uses the output of another. Hope this helps,

- Jared http://forums.pentaho.org/archived_att/files/example.zip

spmva
05-28-2006, 11:16 AM
Jared,

Thanks for your response. Your XML got stripped, but the example you provided as a download told me what I needed to know. That <destinations> was definitely missing.

Now things run without error, but I'm still having problems. All I want to do right now is return the URL of the image created by my ChartComponent.

When I run the .xaction, with ViewAction I get a blank page and when I run with ServiceAction, I interestingly get the results from the SubActionComponent. I'm still doing something wrong. I've attached my .xaction files. I'm probably doing something stupid...

Thanks again!

Best regards,

Steve http://forums.pentaho.org/archived_att/files/common.zip

spmva
05-30-2006, 03:48 AM
interesting...i upgraded to 1.1.6 and now an error is displaying:


07:40:29,637 WARN [RuntimeContext] 180b7c13-efd1-11da-8003-ff20843e1c1c:RUNTIME
:context-9056338-1148989229146:chart-provider-profile-pn-geo-distribution.xaction The requested parameter provider session for parameter chart-data is not available
07:40:29,637 ERROR [RuntimeContext] 180b7c13-efd1-11da-8003-ff20843e1c1c:RUNTIME:context-9056338-1148989229146:chart-provider-profile-pn-geo-distribution.xaction RuntimeContext.ERROR_0018 - The requested parameter chart-data has a NULL value
07:40:29,637 ERROR [RuntimeContext] 180b7c13-efd1-11da-8003-ff20843e1c1c:RUNTIME:context-9056338-1148989229146:chart-provider-profile-pn-geo-distribution.xaction RuntimeContext.ERROR_0013 - Parameters could not be resolved
07:40:29,637 ERROR [RuntimeContext] 180b7c13-efd1-11da-8003-ff20843e1c1c:RUNTIME:context-9056338-1148989229146:chart-provider-profile-pn-geo-distribution.xaction RuntimeContext.ERROR_0012 - ActionDefinition for ChartComponent did not execute successfully
07:40:29,657 ERROR [SolutionEngine] 180d02b4-efd1-11da-8003-ff20843e1c1c:«»SOLUTION-ENGINE: service-provider-pn-geo-distribution.xactionSolutionEngine.ERROR_0007- Action sequence execution failed

As I said before...I'm still missing something. Clearly, I still don't have the tag set properly between these two files. I'm also interested in knowing what the final error is about. The service-provider-pn-geo-distribution.xaction didn't fail, because the results are returned to the browser window when I call this as an ServiceAction. However, if it was failing, that would certainly explain the reason why chart-data would be null.

I'm reviewing my .xaction files now, in light of these error messages, but if anyone spots my problem I'd appreciate a shortcut to my problem. I'm getting a little dizzy having studies these two files all weekend.

Thanks,

Steve

Post edited by: spmva, at: 05/30/2006 07:55

spmva
05-31-2006, 01:47 PM
ok...I gave it a rest and came back to it. I came up with new information which I hope I can lead to an answer.

I've noticed than when doing a ServiceAction I get that error I posted above and the browser fills with the results of the SubActionComponent. If I call it with a ViewAction, I get no error, the browser window is blank and a chart image is generated as expected. I found the temp directory and realized that those charts were generating despite the lack of output in the browser.

Can anyone shed some light on this issue for me? I'll keep messing with it...maybe build a simpler test.

Thanks,

Steve

jcorn
06-02-2006, 11:21 AM
Hey Steve,

Sorry, I'm a little confused about the state you are in now. It sounds like the subAction call is working and a chart is being generated...does it have data?

If you're just looking to output the chart to the browser you don't need the JavaScript rule to generate the url...comment that out and remove the two outputs from the ChartComponent. When no outputs are specified for the ChartComponent the default behavior is to send it to the browser (this is assuming the chart is getting the data).

Give that a shot and let me know how it goes.

spmva
06-03-2006, 03:06 AM
Jared,

I tried what you suggested and the chart displayed. That was a good forward step. Thanks.

I actually do want this .xaction to return the chart url...in fact, I also want it to return the .map url (something I've already made work without issue by removing the SubActionComponent). I intend to call this as a web service from another portal then seamlessly display the results on that side.

I seem to be having a problem with JavascriptRules and SubActionComponents. After getting tired of looking at this issue, I tried to make a more simplistic example. The example basically accepted a string, sent it to a SubActionComponent, which had a JavascriptRule that added a few letters to the string, then once returned back to the calling .xaction, a few more letters were added to it for final output. I received the same result. I'd get no response when calling it from ViewAction and ServiceAction would return the string as manipulated by the SubActionComponent.

I clearly have something incorrect in my final JavascriptRule configurations in both my example and my real world test. I just don't know what it is. I'll start looking at the issue from this new perspective you've given me. If you have any suggestions, I'd be happy to hear them.

The new perspective does beg for some explanation, though. Can you please explain why a call to ViewAction returns a chart and a call to the same .xaction through ServiceAction returns the data from the SubActionComponent? Is that expected behavior? Intuitively, I would expect the chart in ViewAction and simply a confirmation of execution of ServiceAction...but perhaps there is a reason for this that I don't understand yet.

Thanks again,

Steve

spmva
06-14-2006, 02:36 PM
Well, I tried to develop a very simple example to see if I could figure this thing out.

No luck.

I've attached my example. All I did was create a simple string manipulator. A Javascript in the first .xaction creates a string, then passes it to a SubActionComponent containing a second Javascript that mods that string and then passes it back for a final Javascript manipulation before returning the final value.

Well that's the idea...it still doesn't work.

If someone could have a look, I'd really appreciate it. I've been trying to work this for some time now and just can't get it to behave as it should.

Best regards,

Steve

Post edited by: spmva, at: 06/14/2006 18:37

spmva
06-14-2006, 02:40 PM
Sorry for the follow-on post. The last post rejected my upload because it had the same name as another attachment in this thread. When I tried to upload the second time after renaming the file, it gave me another error, stating that I could only use alphanumeric characters. When I tried to edit a third time the option to upload a file was no longer there.

So...long story short...I had to create a new post. http://forums.pentaho.org/archived_att/files/testagain.zip

guzaldon
06-14-2006, 03:47 PM
I did a lil magic on it and got things working.

one thing you need to do was add some inputs as well as some other stuff like the action-output of the first JS rule needed to goto session.

See the attachted working files.

I hope it helps.

if you need some details let me know,

Nic http://forums.pentaho.org/archived_att/files/fixedAnotherTest.tar.gz

spmva
06-15-2006, 02:25 AM
Thanks for the fast reply.

It works, but I still don't know if I'm getting the results I should expect. I would expect the results of ViewAction and the results of ServiceAction to be the same.

ViewAction gives me the desired return value: "third:second:first"

ServiceAction returns the results of the SubActionComponent: "third:"

Is that what I should expect? Why don't the two return the same values?

guzaldon
06-15-2006, 08:09 AM
I must admit this is a bit past my knowledge. I haven't done much with ServiceAction

though if you add this to you xaction-outpurs

<action-outputs>
<zzz type="string" mapping="yyy"/>
</action-outputs>
you will see that it returnes what it has for yyy = second:first but if you map it back to zzz you only get thrid:

so it seems that the subaction is passing back results, but the next javascript rule isn't getting them in the service action. I almost think this might be a bug but there's only one way to tell that's to see if one of the pentaho people can help and even then I would probably give a low chance of even being a bug.

The main reason I think it might be a bug is b/c the below is being displayed for yyy not zzz so I would guess there isn't something quite right here.

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ExecuteActivityResponse>
<yyy>third:</yyy>
</ExecuteActivityResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

but keep in mind I'm not a guru and I might be jumping to collosions w/o a matt but we'll see. Like I said it's a bit out side my knowledge.

you could also try playing with tha abolute path of the component. IE:
org.pentaho.plugin.core.SubActionComponent
but when I tried it things got even a bit more hairier.

Sorry I couldn't help more. Lets hope the bright pentaho staff might have something insightful to say.

Nic

dmoran
06-15-2006, 09:13 AM
Looks like a bug to me - I'll check it out.

Doug

guzaldon
06-15-2006, 11:19 AM
awesome thanks Doug

Let us know what you find out.

Thanks,

Nic

spmva
06-29-2006, 03:20 AM
I just downloaded and starting working with 1.1.7.

I just posting to keep this thread current. I'm now seeing a different behavior when running the test on SubActionComponent that I described above.

ViewAction still behaves in the same manner as usual. The difference is in ServiceAction. ServiceAction no longer returns the results of the SubActionComponent. ServiceAction now returns the standard SOAP response:


<SOAP-ENV:Envelope xmlns:«»SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ExecuteActivityResponse xmlns:m="http://pentaho.org" />
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Steve

dmoran
06-29-2006, 12:58 PM
Steve,

I have been meaning to get back to this post - it's been a very long week. There were 3 different strange bugs affecting the subactions and I couldn't figure out how you even got ViewAction to work. The bugs have been fixed in 1.1.7. The strange behavior you are seeing now is due to errors in the action sequences. I have attached new ones to this post.

The change in test-subaction-subactioncomponent is:

Remove the destination of <session>, outputting to session will cause the current value to be saved in your browser session. All that is required for the action being called is to specify an output.

The changes in test-subaction are:

Don't use the ContentOutputComponent it is semi evil (This needs to be documented - I know). Instead, add zzz to the outputs and give a destination of response and content.
Remove yyy from the inputs
Add yyy to the action-outputs for the sub action component

I think the reason that the ViewAction call was working is because the subcomponent call was setting yyy in the session so it would be there for the next run.

Phew - that was a good one, thanks for your help,
Doug

dmoran
06-29-2006, 12:58 PM
Steve,

I have been meaning to get back to this post - it's been a very long week. There were 3 different strange bugs affecting the subactions and I couldn't figure out how you even got ViewAction to work. The bugs have been fixed in 1.1.7. The strange behavior you are seeing now is due to errors in the action sequences. I have attached new ones to this post.

The change in test-subaction-subactioncomponent is:

Remove the destination of <session>, outputting to session will cause the current value to be saved in your browser session. All that is required for the action being called is to specify an output.

The changes in test-subaction are:

Don't use the ContentOutputComponent it is semi evil (This needs to be documented - I know). Instead, add zzz to the outputs and give a destination of response and content.
Remove yyy from the inputs
Add yyy to the action-outputs for the sub action component

I think the reason that the ViewAction call was working is because the subcomponent call was setting yyy in the session so it would be there for the next run.

Phew - that was a good one, thanks for your help,
Doug

spmva
06-29-2006, 02:06 PM
Thanks, Doug. Glad to help, though I wish my help could come in the form of solutions more often than challenging puzzles. :-)

I've now got the expected return from ServiceAction. I've attached the final working files, in case anyone is interested. There seems to be a good number of views on this thread, so perhaps this will do someone some good.

Best regards,

Steve http://forums.pentaho.org/archived_att/files/WorkingNow.zip

dmoran
06-29-2006, 02:14 PM
Did I mention it was a long week? Here are the attachments that I meant to attach to my last post :)

Doug http://forums.pentaho.org/archived_att/files/subactions.zip

Post edited by: dmoran, at: 06/29/2006 18:15