Hi dan, updating

I could resolve my problem,I had wrong mi JSON sintax:

{
    shoppingCart: {
        value: { href: 
"192.168.0.20:8080/restful/objects/simple.ShoppingCart/100"}
    },
    item: {
        value: { href: "192.168.0.20:8080/restful/objects/simple.Item/3" }
    },
    businessLocation: {
        value: { href: 
"192.168.0.20:8080/restful/objects/simple.BusinessLocation/1" }
    },
    quantity: 1
    }

in quantity parameter has been the mistake, should be:

quantity: {
        value: 1
}

thanks for all...
________________________________________
De: Dan Haywood <d...@haywood-associates.co.uk>
Enviado: miércoles, 2 de marzo de 2016 01:27 a. m.
Para: users
Asunto: Re: "invalidReason":"Expected a link (because this object's type is not 
a value)

It does look correct to me, what you are doing.

Dia it written on when you use Postman or similar from Chrome?

If you could provide a test app on github demonstrating the problem, then
I'll take a deeper look.

I'll also record a screencast tomorrow to show how to use the API from
chrome, at least, for actions that take object ref. args.
On 2 Mar 2016 00:42, "Arturo Ulises Castañeda Estrada" <
arturo.castan...@sisorg.com.mx> wrote:

> Hi, Dan
>
> when i consuming the WS the format header is right (section: Query String
> Parameters) but the server response is wrong and i get the error: "Expected
> a link (because this object's type is not a value) but found no 'href'", i
> understand that is because expects an 'href' but the sever response is not
> recognising JSON notation
>
>
> --------------------------------------------------------------------------------------------------------------
> Params send with post AngularJS
>
> --------------------------------------------------------------------------------------------------------------
> params: {
>         shoppingCart: {
>             value: { href: "
> 192.168.0.20:8080/restful/objects/simple.ShoppingCart/100"}
>           },
>         item: {
>             value: { href: "
> 192.168.0.20:8080/restful/objects/simple.Item/3" }
>           },
>         businessLocation: {
>             value: { href: "
> 192.168.0.20:8080/restful/objects/simple.BusinessLocation/1" }
>           },
>         quantity: 1
>       }
>
>
> --------------------------------------------------------------------------------------------------------------
> Headers
>
> --------------------------------------------------------------------------------------------------------------
> Remote Address:192.168.0.20:8080
> Request URL:
> http://192.168.0.20:8080/restful/services/ShoppingCartItemContributions/actions/addAnItemToCart/invoke?businessLocation=%7B%22value%22:%7B%22href%22:%22192.168.0.20:8080%2Frestful%2Fobjects%2Fsimple.BusinessLocation%2F1%22%7D%7D&item=%7B%22value%22:%7B%22href%22:%22192.168.0.20:8080%2Frestful%2Fobjects%2Fsimple.Item%2F3%22%7D%7D&quantity=1&shoppingCart=%7B%22value%22:%7B%22href%22:%22192.168.0.20:8080%2Frestful%2Fobjects%2Fsimple.ShoppingCart%2F100%22%7D%7D
> Request Method:POST
> Status Code:422 Unprocessable Entity
> Request Headersview source
> Accept:application/json, text/plain, */*
> Accept-Encoding:gzip, deflate
> Accept-Language:en-US
> Authorization:Basic c3ZlbjpwYXNz
> Connection:keep-alive
> Content-Length:0
> Host:192.168.0.20:8080
> Origin:file://
> User-Agent:Mozilla/5.0 (Linux; Android 5.1.1; Android SDK built for x86_64
> Build/LMY48X) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/
> 39.0.0.0 Mobile Safari/537.36
>
> X-DevTools-Emulate-Network-Conditions-Client-Id:BC62CDDC-B522-4AAF-810D-B18898505A94
> X-Requested-With:com.ionicframework.yomiprot450452
> Query String Parametersview sourceview URL encoded
> businessLocation:{"value":{"href":"
> 192.168.0.20:8080/restful/objects/simple.BusinessLocation/1"}}
> item:{"value":{"href":"192.168.0.20:8080/restful/objects/simple.Item/3"}}
> quantity:1
> shoppingCart:{"value":{"href":"
> 192.168.0.20:8080/restful/objects/simple.ShoppingCart/100"}}
> Response Headersview source
> Content-Length:694
> Content-Type:application/json
> Date:Wed, 02 Mar 2016 00:15:26 GMT
> Server:Jetty(9.3.2.v20150730)
> Warning:199 RestfulObjects Validation failed, see body for details
>
>
> ----------------------------------------------------------------------------------------------------------------
> Preview
>
> ----------------------------------------------------------------------------------------------------------------
> businessLocation: {value: "{"value":{"href":"
> 192.168.0.20:8080/restful/objects/simple.BusinessLocation/1"}}",…}
> item: {value: "{"value":{"href":"
> 192.168.0.20:8080/restful/objects/simple.Item/3"}}",…}
> quantity: {value: 1}
> shoppingCart: {value: "{"value":{"href":"
> 192.168.0.20:8080/restful/objects/simple.ShoppingCart/100"}}",…}
> x-ro-invalidReason: "'Shopping Cart' is mandatory"
>
>
> ----------------------------------------------------------------------------------------------------------------
> Response
>
> ----------------------------------------------------------------------------------------------------------------
> {"shoppingCart":{"value":"{\"value\":{\"href\":\"
> 192.168.0.20:8080/restful/objects/simple.ShoppingCart/100\"}}","invalidReason":"Expected
> a link (because this object's type is not a value) but found no
> 'href'"},"item":{"value":"{\"value\":{\"href\":\"
> 192.168.0.20:8080/restful/objects/simple.Item/3\"}}","invalidReason":"Expected
> a link (because this object's type is not a value) but found no
> 'href'"},"quantity":{"value":1},"businessLocation":{"value":"{\"value\":{\"href\":\"
> 192.168.0.20:8080/restful/objects/simple.BusinessLocation/1\"}}","invalidReason":"Expected
> a link (because this object's type is not a value) but found no
> 'href'"},"x-ro-invalidReason":"'Shopping Cart' is mandatory"}
>
>

Reply via email to