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:d...@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 <olakunle.tomol...@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"}
>

Reply via email to