On 22 December 2015 at 17:51, Cesar Lugo <[email protected]> wrote:

> Hello Dan,
>
> Thank you for the reference about whitelists. I was already using it, and
> it works fine when using either:
>
> (A)
> ionic serve
> ionic serve –l –c –s
> ionic run –l –c –s android
> ionic emulate –l –c –s android
>
> but not when using
>
> (B)
> ionic run android
>
> I just found what the issue is: when running ionic run android, is when I
> get the 401 unauthorized response from the Isis server. When I use any of
> (A) authentication works, but not when using (B).
>
> Any ideas?
>
>
Huh

If it's a 401 then I can only presume that the HTTP basic auth request
header isn't getting sent through somehow.  What do you see in adb
debugging, and do if you put a breakpoint on the server do you get as far
as IsisSessionFilter?

-- Dan



> I was not able to monitor the console before, didn’t know how, now I know
> how:
>
>
> https://developers.google.com/web/tools/chrome-devtools/debug/remote-debugging/remote-debugging?hl=en
>
> This is a very useful tool to see the console and other information when
> running an application in an android device or emulator, when using:
>
> ionic run android
>
> (without -l -c -s) options
>
> This is useful because when you use (without -l -c -s) options, the
> services and other external calls are done differently by the ionic
> monitoring tools, so external services calls might work with cordova plugin
> whitelist differenty on each of those options.
>
>
^ useful to know, thanks!


> Cesar
>
> 1
>
> -----Original Message-----
> From: Dan Haywood [mailto:[email protected]]
> Sent: Monday, December 21, 2015 4:36 PM
> To: users
> Subject: Re: Web service call
>
> Hi Cesar,
>
> Just following up on this... I hit a similar 404 issue with my ionic app
> [1]; the solution was to use the cordova whitelist plugin [2].
>
> HTH
> Dan
>
> [1] https://github.com/incodehq/contactapp
> [2] http://docs.ionic.io/docs/cordova-whitelist
>
>
>
> On 17 December 2015 at 15:46, Cesar Lugo <[email protected]> wrote:
>
> > 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
> >
> >
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>

Reply via email to