Mapping Presto Parameters to Service Parameters

hruiz
User offline. Last seen 3 weeks 5 days ago. Offline
Joined: 05/05/2009
Points: 10

Hi everybody:
Im trying to use session parameters to map Presto Parameters to Service Parameters with PC4JS but I can't get it working.
Here is my example:

1. First I created a mashup with a simple output and I published it as a service, the mashup:

<mashup xmlns="http://www.jackbe.com/2008-03-01/EMMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:macro="http://www.jackbe.com/2008-03-01/EMMLMacro"
xsi:schemaLocation="http://www.jackbe.com/2008-03-01/EMMLSchema ../src/schemas/EMMLSpec.xsd"
name="prueba_persistencia_parametros_sesion12">
      <operation name="invoke">   
            <output name="result" type="document" />
            <variables>            
                  <variable name="ValorInput" type="string"/>
            </variables>
             <input name="valorId" type="string"/>
             <assign fromexpr="concat($valorId,' Este era el valor inicial')" outputvariable="ValorInput"/>
             <constructor outputvariable="result">
                <prueba>
                    <ValorInput>{$ValorInput}</ValorInput>               
                </prueba>
            </constructor>
      </operation> 
</mashup>

2. I did the following test in JUMP:

{
            "version": "1.1",
            "sid": "prueba_persistencia_parametros_sesion11",
            "svcVersion": "0.1",
            "oid": "invoke",
            "header": {
                        "resultFormat": "xml",
                        "sessionbinding": ["@session.ValorId=/prueba/ValorInput"]                                           
            },
            "params": [
              {valorId: "5"}
            ]
}
With this I got the value without problems.

3. I created another simple mashup with a single input:

<mashup xmlns="http://www.jackbe.com/2008-03-01/EMMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:macro="http://www.jackbe.com/2008-03-01/EMMLMacro"
xsi:schemaLocation="http://www.jackbe.com/2008-03-01/EMMLSchema ../src/schemas/EMMLSpec.xsd"
name="Service2">
      <operation name="invoke">   
            <output name="result" type="document" />
             <input name="prueba" type="string" default="1202"/>
             <constructor outputvariable="result">
                <prueba>
                    <ValorInput>{$prueba}</ValorInput>
                </prueba>
            </constructor>
      </operation> 
</mashup>

4. The test in JUMP:

{
            "version": "1.1",
            "sid": "Service2",
            "svcVersion": "0.1",
            "oid": "invoke",
            "header": {
                        "resultFormat": "xml",                                         
            },
            "params": [
              {prueba: "$session/ValorId"}
            ]
}
With this test I passed the session’s value to the mashup’s input, but it seems the value is not the one I got with
the session binding.

If I declare a session variable in the mashup:
            <variables>
                  <variable name="session.ValorS" type="string"/>            
                  <variable name="ValorInput" type="string"/>
            </variables>

I get the following output:
Executing the Script in Run Mode...
2009-07-17 17:50:38,262 ERROR [com.jackbe.jbp.sas.common.JBPStateManager] - <ConfigMgr: setSessionAttribute : Cannot find HttpServletRequest object Unable to store session attribute : ValorS>
2009-07-17 17:50:38,263 ERROR [com.jackbe.jbp.sas.common.JBPStateManager] - <ConfigMgr: setSessionAttribute : Cannot find HttpServletRequest object Unable to store session attribute : ValorS>

This example was done based on the following links.
http://www.jackbe.com/prestodocs/v2.7.0/prestolibrary/wwhelp/wwhimpl/js/html/wwhelp.htm?context=prestolibrary&topic=mapPParams
http://www.jackbe.com/prestodocs/v2.7.0/prestolibrary/wwhelp/wwhimpl/js/html/wwhelp.htm?context=prestolibrary&topic=mashupPParams
http://www.jackbe.com/prestodocs/v2.6.1/prestoadmin/wwhelp/wwhimpl/js/html/wwhelp.htm

Can somebody help me?

5
Your rating: None Average: 5 (1 vote)
girish
girish's picture
User offline. Last seen 4 weeks 5 hours ago. Offline
Joined: 09/22/2008
Points: 70

two things:

(a) in sample (2) above, the parameter should be :

             "params":
              {"valorId": "5"}
  because "valorId" is the input of type String to your EMML.

(b) second part (second JUMP script where you are not getting the value) seem to be a bug. Looking into it.

- Girish@JackBe

girish
girish's picture
User offline. Last seen 4 weeks 5 hours ago. Offline
Joined: 09/22/2008
Points: 70

We have fixed this issue now and sent you email with the patch information.

- Girish@JackBe

girish
girish's picture
User offline. Last seen 4 weeks 5 hours ago. Offline
Joined: 09/22/2008
Points: 70

btw, the correct JUMP scripts are :

{
            "version": "1.1",
            "sid": "SB1",
            "svcVersion": "0.1",
            "oid": "invoke",
            "header": {
                        "resultFormat": "xml",
                        "sessionbinding": ["@session.ValorId=/prueba/ValorInput"]                                          
            },
            "params":
              {"valorId": "5"}
           
}
 

{
            "version": "1.1",
            "sid": "SB2",
            "svcVersion": "0.1",
            "oid": "invoke",
            "header": {
                        "resultFormat": "xml",                                        
            },
            "params":
              {"prueba": "$session/ValorId"}
           
}

 

see *parameter* section in both JUMP requests. In both cases (from your EMML), the inputs are simple/string types. So, you can pass the values using either map (named parameters) or array (indexed parameters). In your sample scripts, both methods were combined i.e. map inside array.

 

 

 

- Girish@JackBe