You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by "Tomoloju, Ola" <ol...@atos.net> on 2014/04/25 18:46:58 UTC

Paramter parsing ....

Hello Dan,

Could please point me in the right direction here wrt string parameter parsing in Isis.

The parameter was sent from my angularjs controller client as follows:



var stopLocationCode= { locationGroupCode : JSON.stringify('09') };



StopsFactory.query(stopLocationCode, function(data) {

//  xxxxxxxxxxxxxxxxxxxx

}



My Isis service method definition is:



   @Bookmarkable

    @Named("Get Locations")

    @ActionSemantics(Of.SAFE)

    public final List<Location> fetchMatchingGroupLocations(@Named("Location Group Code") final String alternativeGroupCode) {



                  List<Location> locationsList = findCurrentLocations(alternativeGroupCode);

              return locationsList;

    }





After debugging, I found out that the alternativeGroupCode was printed out as "09" in the action method i.e. the stringify added the double quotes.



Do, I need a JSON Parser to convert the "09" to a normal POJO string 09?

I expected the string not to require any processing in the action i.e. trimming the quotes.

Remember the issue I had with passing nested object. But, this is a get method as against a create/put operation.



FYI:

Sending the param without stringify does not work :

var stopLocationCode= { locationGroupCode : '09' };

OR

var stopLocationCode= { locationGroupCode : "09") };



Resulted in this error:

{"locationGroupCode":{"value":1,"invalidReason":"Failed to parse representation as value of type 'String'"},"x-ro-invalidReason":"Location Group Code is mandatory"}

Re: Paramter parsing ....

Posted by Ged Byrne <ge...@gmail.com>.
Hi Ola,

Could you post the RAW http request being sent from the client?

You should be able to get it from the browser's developer tools.

Regards,


Ged


On 2 May 2014 12:40, Tomoloju, Ola <ol...@atos.net> wrote:

> Good day Dan,
>   Trust you are doing well.
> I have just come back to this issue, and thanks so much for your reply.
>
> I did try the parameter passing using the format you suggested before
> posting the question,
> And I have tried it again for sanity checking.
> The issue remains.
>
> There is no exception raised in the service action, but the string
> parameter retrieved in the invoked method in Isis is : {"value":"09"}
>
> Also, the query string parameter sent in the http  header is:
> locationGroupCode:{"value":"09"}
>
> So, it's not extracting the value 09.
>
> I think something is not right.
>
> Any ideas ..
>
> Ola Tomoloju
>
>
> -----Original Message-----
> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
> Sent: Tuesday, April 29, 2014 7:44 AM
> To: users
> Subject: Re: Paramter parsing ....
>
> Hi Ola,
> I think your issue is something different, namely that you are missing the
> "value" node.
>
> that is, you are sending JSON in the form:
>
> {
>   "locationGroupCode": "09"
> }
>
> when it should be:
>
> {
>   "locationGroupCode": {
>       "value": "09"
>    }
> }
>
> See sect 2.9.2.3 of the RO spec v1.0.
>
> Dan
>
>
>
>
> On 25 April 2014 17:46, Tomoloju, Ola <ol...@atos.net> wrote:
>
> > Hello Dan,
> >
> > Could please point me in the right direction here wrt string parameter
> > parsing in Isis.
> >
> > The parameter was sent from my angularjs controller client as follows:
> >
> >
> >
> > var stopLocationCode= { locationGroupCode : JSON.stringify('09') };
> >
> >
> >
> > StopsFactory.query(stopLocationCode, function(data) {
> >
> > //  xxxxxxxxxxxxxxxxxxxx
> >
> > }
> >
> >
> >
> > My Isis service method definition is:
> >
> >
> >
> >    @Bookmarkable
> >
> >     @Named("Get Locations")
> >
> >     @ActionSemantics(Of.SAFE)
> >
> >     public final List<Location>
> > fetchMatchingGroupLocations(@Named("Location Group Code") final String
> > alternativeGroupCode) {
> >
> >
> >
> >                   List<Location> locationsList =
> > findCurrentLocations(alternativeGroupCode);
> >
> >               return locationsList;
> >
> >     }
> >
> >
> >
> >
> >
> > After debugging, I found out that the alternativeGroupCode was printed
> > out as "09" in the action method i.e. the stringify added the double
> quotes.
> >
> >
> >
> > Do, I need a JSON Parser to convert the "09" to a normal POJO string 09?
> >
> > I expected the string not to require any processing in the action i.e.
> > trimming the quotes.
> >
> > Remember the issue I had with passing nested object. But, this is a
> > get method as against a create/put operation.
> >
> >
> >
> > FYI:
> >
> > Sending the param without stringify does not work :
> >
> > var stopLocationCode= { locationGroupCode : '09' };
> >
> > OR
> >
> > var stopLocationCode= { locationGroupCode : "09") };
> >
> >
> >
> > Resulted in this error:
> >
> > {"locationGroupCode":{"value":1,"invalidReason":"Failed to parse
> > representation as value of type
> > 'String'"},"x-ro-invalidReason":"Location
> > Group Code is mandatory"}
> >
>

Re: Paramter parsing ....

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Ola,

I think I either need a test case, or we could do a remote desktop session
one evening.

Contact me offline if you want to do the latter.

Cheers
Dan


On Friday, 2 May 2014, Tomoloju, Ola <ol...@atos.net> wrote:

> Good day Dan,
>   Trust you are doing well.
> I have just come back to this issue, and thanks so much for your reply.
>
> I did try the parameter passing using the format you suggested before
> posting the question,
> And I have tried it again for sanity checking.
> The issue remains.
>
> There is no exception raised in the service action, but the string
> parameter retrieved in the invoked method in Isis is : {"value":"09"}
>
> Also, the query string parameter sent in the http  header is:
> locationGroupCode:{"value":"09"}
>
> So, it's not extracting the value 09.
>
> I think something is not right.
>
> Any ideas ..
>
> Ola Tomoloju
>
>
> -----Original Message-----
> From: Dan Haywood [mailto:dan@haywood-associates.co.uk <javascript:;>]
> Sent: Tuesday, April 29, 2014 7:44 AM
> To: users
> Subject: Re: Paramter parsing ....
>
> Hi Ola,
> I think your issue is something different, namely that you are missing the
> "value" node.
>
> that is, you are sending JSON in the form:
>
> {
>   "locationGroupCode": "09"
> }
>
> when it should be:
>
> {
>   "locationGroupCode": {
>       "value": "09"
>    }
> }
>
> See sect 2.9.2.3 of the RO spec v1.0.
>
> Dan
>
>
>
>
> On 25 April 2014 17:46, Tomoloju, Ola <olakunle.tomoloju@atos.net<javascript:;>>
> wrote:
>
> > Hello Dan,
> >
> > Could please point me in the right direction here wrt string parameter
> > parsing in Isis.
> >
> > The parameter was sent from my angularjs controller client as follows:
> >
> >
> >
> > var stopLocationCode= { locationGroupCode : JSON.stringify('09') };
> >
> >
> >
> > StopsFactory.query(stopLocationCode, function(data) {
> >
> > //  xxxxxxxxxxxxxxxxxxxx
> >
> > }
> >
> >
> >
> > My Isis service method definition is:
> >
> >
> >
> >    @Bookmarkable
> >
> >     @Named("Get Locations")
> >
> >     @ActionSemantics(Of.SAFE)
> >
> >     public final List<Location>
> > fetchMatchingGroupLocations(@Named("Location Group Code") final String
> > alternativeGroupCode) {
> >
> >
> >
> >                   List<Location> locationsList =
> > findCurrentLocations(alternativeGroupCode);
> >
> >               return locationsList;
> >
> >     }
> >
> >
> >
> >
> >
> > After debugging, I found out that the alternativeGroupCode was printed
> > out as "09" in the action method i.e. the stringify added the double
> quotes.
> >
> >
> >
> > Do, I need a JSON Parser to convert the "09" to a normal POJO string 09?
> >
> > I expected the string not to require any processing in the action i.e.
> > trimming the quotes.
> >
> > Remember the issue I had with passing nested object. But, this is a
> > get method as against a create/put operation.
> >
> >
> >
> > FYI:
> >
> > Sending the param without stringify does not work :
> >
> > var stopLocationCode= { locationGroupCode : '09' };
> >
> > OR
> >
> > var stopLocationCode= { locationGroupCode : "09") };
> >
> >
> >
> > Resulted in this error:
> >
> > {"locationGroupCode":{"value":1,"invalidReason":"Failed to parse
> > representation as value of type
> > 'String'"},"x-ro-invalidReason":"Location
> > Group Code is mandatory"}
> >
>

RE: Paramter parsing ....

Posted by "Tomoloju, Ola" <ol...@atos.net>.
Good day Dan,
  Trust you are doing well.
I have just come back to this issue, and thanks so much for your reply.

I did try the parameter passing using the format you suggested before posting the question,
And I have tried it again for sanity checking.
The issue remains.

There is no exception raised in the service action, but the string parameter retrieved in the invoked method in Isis is : {"value":"09"}

Also, the query string parameter sent in the http  header is:
locationGroupCode:{"value":"09"}

So, it's not extracting the value 09.

I think something is not right.

Any ideas ..

Ola Tomoloju 


-----Original Message-----
From: Dan Haywood [mailto:dan@haywood-associates.co.uk] 
Sent: Tuesday, April 29, 2014 7:44 AM
To: users
Subject: Re: Paramter parsing ....

Hi Ola,
I think your issue is something different, namely that you are missing the "value" node.

that is, you are sending JSON in the form:

{
  "locationGroupCode": "09"
}

when it should be:

{
  "locationGroupCode": {
      "value": "09"
   }
}

See sect 2.9.2.3 of the RO spec v1.0.

Dan




On 25 April 2014 17:46, Tomoloju, Ola <ol...@atos.net> wrote:

> Hello Dan,
>
> Could please point me in the right direction here wrt string parameter 
> parsing in Isis.
>
> The parameter was sent from my angularjs controller client as follows:
>
>
>
> var stopLocationCode= { locationGroupCode : JSON.stringify('09') };
>
>
>
> StopsFactory.query(stopLocationCode, function(data) {
>
> //  xxxxxxxxxxxxxxxxxxxx
>
> }
>
>
>
> My Isis service method definition is:
>
>
>
>    @Bookmarkable
>
>     @Named("Get Locations")
>
>     @ActionSemantics(Of.SAFE)
>
>     public final List<Location>
> fetchMatchingGroupLocations(@Named("Location Group Code") final String
> alternativeGroupCode) {
>
>
>
>                   List<Location> locationsList = 
> findCurrentLocations(alternativeGroupCode);
>
>               return locationsList;
>
>     }
>
>
>
>
>
> After debugging, I found out that the alternativeGroupCode was printed 
> out as "09" in the action method i.e. the stringify added the double quotes.
>
>
>
> Do, I need a JSON Parser to convert the "09" to a normal POJO string 09?
>
> I expected the string not to require any processing in the action i.e.
> trimming the quotes.
>
> Remember the issue I had with passing nested object. But, this is a 
> get method as against a create/put operation.
>
>
>
> FYI:
>
> Sending the param without stringify does not work :
>
> var stopLocationCode= { locationGroupCode : '09' };
>
> OR
>
> var stopLocationCode= { locationGroupCode : "09") };
>
>
>
> Resulted in this error:
>
> {"locationGroupCode":{"value":1,"invalidReason":"Failed to parse 
> representation as value of type 
> 'String'"},"x-ro-invalidReason":"Location
> Group Code is mandatory"}
>

Re: Paramter parsing ....

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Ola,
I think your issue is something different, namely that you are missing the
"value" node.

that is, you are sending JSON in the form:

{
  "locationGroupCode": "09"
}

when it should be:

{
  "locationGroupCode": {
      "value": "09"
   }
}

See sect 2.9.2.3 of the RO spec v1.0.

Dan




On 25 April 2014 17:46, Tomoloju, Ola <ol...@atos.net> wrote:

> Hello Dan,
>
> Could please point me in the right direction here wrt string parameter
> parsing in Isis.
>
> The parameter was sent from my angularjs controller client as follows:
>
>
>
> var stopLocationCode= { locationGroupCode : JSON.stringify('09') };
>
>
>
> StopsFactory.query(stopLocationCode, function(data) {
>
> //  xxxxxxxxxxxxxxxxxxxx
>
> }
>
>
>
> My Isis service method definition is:
>
>
>
>    @Bookmarkable
>
>     @Named("Get Locations")
>
>     @ActionSemantics(Of.SAFE)
>
>     public final List<Location>
> fetchMatchingGroupLocations(@Named("Location Group Code") final String
> alternativeGroupCode) {
>
>
>
>                   List<Location> locationsList =
> findCurrentLocations(alternativeGroupCode);
>
>               return locationsList;
>
>     }
>
>
>
>
>
> After debugging, I found out that the alternativeGroupCode was printed out
> as "09" in the action method i.e. the stringify added the double quotes.
>
>
>
> Do, I need a JSON Parser to convert the "09" to a normal POJO string 09?
>
> I expected the string not to require any processing in the action i.e.
> trimming the quotes.
>
> Remember the issue I had with passing nested object. But, this is a get
> method as against a create/put operation.
>
>
>
> FYI:
>
> Sending the param without stringify does not work :
>
> var stopLocationCode= { locationGroupCode : '09' };
>
> OR
>
> var stopLocationCode= { locationGroupCode : "09") };
>
>
>
> Resulted in this error:
>
> {"locationGroupCode":{"value":1,"invalidReason":"Failed to parse
> representation as value of type 'String'"},"x-ro-invalidReason":"Location
> Group Code is mandatory"}
>