Multiple input parameters in invoke statement

nzblue_fish
nzblue_fish's picture
User offline. Last seen 2 weeks 4 days ago. Offline
Joined: 09/30/2009
Points: 1165

Hi mashers,

I'm sure someone is just going to tell me to go away very soon!

I have some questions about passing multiple parameters as part of the invoke statement.

First, here are the parameters from a mashup that I'm calling during the invoke statement as taken from the Service Inpector:

<params>
    <dappName>    </dappName>
    <RSStitle>    </RSStitle>
    <channelSource>    </channelSource>
    <channelDesc>    </channelDesc>
    <pubDateFormat>    </pubDateFormat>
    <expiredDays>    </expiredDays>
</params>

In the called mashup, I have set defaults for all of the input parameters, but expect to change some when I call the mashup through the invoke.

1) Can I create a variable of a "document type" to pass during the invoke or does it have to be of a "string" type?

2) If I pass the literal values in the "inputvariables" attribute of the invoke, is the order of the parameters based on the order defined in the called mashup, i.e. you specify in the order of the <input> tags in the called mashup? Seems obvious now that I ask the question!

3) When I pass the parameters as literals in the inputvariables attribute, if I leave a parameter empty, it doesn't appear to pick up the default value, rather it sets the input value to null. How do you pass only some parameters and have those not specified default, as defined in the input statement? For example, with this call:

                <invoke service="dapperRSSGetFeed" operation="getFeed"
                    inputvariables="'AgResearchCurrentNews',,,,'EEEE, dd MMMM yyyy',"
                    outputvariable="$AgResearchRSSItems" />

the values of  <RSStitle>, <channelSource>, <channelDesc> and  <expiredDays> are all empty rather than the default value I set.

As always, I appreciate all the help that I'm getting from the community.

Cheers, Innes (NZ)

 

0
Your rating: None
smitchell
smitchell's picture
User offline. Last seen 18 hours 32 min ago. Offline
Joined: 08/29/2008
Points: 34

No one is going to tell you to go away. I would say, however, that some of your questions have answers in the documentation which is available here in the MDC from the Resources menu or from http://www.jackbe.com/prestodocs/v2.7.0/

I have some answers, but not all:

1. Yes. Input parameters can be complex (type="document"). They must be well-formed -- having a single root element. So things like arrays or lists would have to be wrapped in a root node.

One thing to think of, if you have any control over this, is how this complex input is going to be populated. If the mashup is called by another mashup, you use <constructor> or other statements that build variable content to create the input parameter. If you expect users to supply some of the values within this complex parameter, though, you need a UI that accepts that and then builds the parameter correctly.

2. Exactly. The order in which you list input parameters for <invoke> when the service is a mashup service is the order in which they are listed within the called mashup.

3. This one I don't have a definitive answer, we are doing some research on this. I suspect that the answer is no, Presto doesn't support this yet. But we will get back to you.

 

Sara, technical writer/jackbe

 

nzblue_fish
nzblue_fish's picture
User offline. Last seen 2 weeks 4 days ago. Offline
Joined: 09/30/2009
Points: 1165

Hi Sara,

Thanks for your reply.

Sorry ... my initial comment was a bit cheeky :) ... and I do always try to search the forums and documentation before posting any questions. It's just that the documentation assumes some knowledge already and it's not always clear ... at least to me anyway ... how somethings can be done.

On 1) I did understand that you can pass a complex variable as input, but what I actually meant to ask was whether all the parameters can be passed in a single complex form. i.e, can I do something like this:

  <variable name="inputMyParms" type="document" />

  <constructor outputvariable="$inputMyParms>

     <input1>value1</input1>

    <input2>value2</input2>

  </constructor>  

  <invoke service="..." operation="..." inputvariables="$inputMyParms" ...

as opposed to:

 <invoke  service="..." operation="..." inputvariables="'value1','value2'" ...

Thanks for your other answers.

Cheers, Innes (NZ)

 

 

 

smitchell
smitchell's picture
User offline. Last seen 18 hours 32 min ago. Offline
Joined: 08/29/2008
Points: 34

It depends solely on what form the service is expecting the input parameter(s) in.

If the service is expecting a single parameter that is a complex object with properties, then yes, you can build a variable with that object using <constructor> or any other EMML statement that builds a variable (even <variable> itself). And then pass that single parameter to the service.

 

 

Sara, technical writer/jackbe

 

smitchell
smitchell's picture
User offline. Last seen 18 hours 32 min ago. Offline
Joined: 08/29/2008
Points: 34

In answer to question #3 "is there a way to skip input parameters in the inputparams attribute for <invoke> when the service is a mashup to allow default values to be used", you can omit parameters at the end of the list, but you cannot skip parameters.

So take a mashup named "defaultParamTest" that has these three input parameters: 

<input name="one" type="string" default="first default"/>
<input name="two" type="number" default="2"/>
<input name="three" type="boolean" default="false"/>

This invoke statement would replace the default value for one, but leave the defaults for two and three:

<invoke service="defaultParamTest" operation="Invoke" inputparams=" 'a different value' " .../>

Both of the next two statements would remove the default value for one and replace the default value for two, leaving the default value for three:

<invoke service="defaultParamTest" operation="Invoke" inputparams=" '', '5' " .../>

<invoke service="defaultParamTest" operation="Invoke" inputparams=", '5' " .../>

 

Sara, technical writer/jackbe