Thank you Dan.

It's actually quite weird. If I use:
        ionic run android
it does not connect to the Isis RO services.

But if I use:
        ionic run android -l -c
so I can see the logs, then it does connect to the Isis RO services, then I 
can't see the error.

Probably I need to run it without live reload (-l) and use some other tool to 
monitor the log withon the device. I am reading about Xcode, might help. I'll 
let you know.

Cesar.


-----Original Message-----
From: Dan Haywood [mailto:[email protected]]
Sent: Thursday, December 17, 2015 8:40 AM
To: users
Subject: Re: Web service call

According to ionic [1], CORS will be an issue if using "ionic serve" or "ionic 
run -l", but shouldn't be an issue if using just "ionic run".

It might be worth dumping all the response headers coming back to see if the 
401 is from CORS or from a genuine rejection by Apache Isis.  You could also 
put a break point in the IsisSessionFilter to see if it is Isis that is 
rejecting the request, or whether it was denied earlier on by the web 
server/CORS.

HTH
Dan

[1] http://blog.ionic.io/handling-cors-issues-in-ionic/


On 16 December 2015 at 19:40, Cesar Lugo <[email protected]> wrote:

> I was thinking it might be CORS too, I will check that way. Thank you!
> Cesar.
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> Sent: Wednesday, December 16, 2015 1:39 PM
> To: [email protected]
> Subject: Re: Web service call
>
> hi Cesar,
>
>
>
> Sounds like CORS issue to me..
>
>
>
> grtz Johan
>
>
>
>
> ----- Original Message ----
>
> From: Cesar Lugo
>
> To:
>
> Sent: Din, 15 Dec 2015 19:47
>
> Subject: Web service call
>
>
>
>
>
>
> (function(){(window.hostMIF =
> parent.document.getElementById("ext-gen605").ownerCt)._windowContext={
> eval:function(s){return new Function("return ("+s+")")();}};})()
>
> Hello,
>
>
>
> I am calling Isis RO services from within my Ionic app, works great
> when calling from a local Ionic app (i.e.  ionic serve --lab). When I
> deploy it to the phone device, I need it to call the service using the
> IP address, the client is no longer in localhost. So this works:
>
>
>
> .factory('Business', function ($resource) {
>
>     return
> $resource('/restful/objects/simple.Business/:businessInstanceId',
> {}, {
>
>                get: {
>
>                                  method: 'GET',
>
>                                  headers: { 'Accept':
> 'application/json' }
>
>                              }
>
>            });
>
>
>
>
>
> But this does not, the RO service issues an 401 Unauthorized
>
>
>
> .factory('Business', function ($resource) {
>
>     return
> $resource('
> http://192.xxx.xxx.xxx:8080/restful/objects/simple.Business/:busi
> nessInstanceId', {}, {
>
>                get: {
>
>                                  method: 'GET',
>
>                                  headers: { 'Accept':
> 'application/json' }
>
>                              }
>
>            });
>
>
>
>
>
> Any ideas?
>
>
>
> Cesar.
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Reply via email to