SOLVED - Post to web service on iOS

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Post to web service on iOS

Post by Simon » Sun Sep 01, 2013 9:02 pm

Ok I have a workaround that consistently returns the correct information:

Code: Select all

-- Only needs a button with this code and a text field called 'consola'

local arrayListado
on mouseUp
put url "http://www.google.com" into temp --NEW LINE
   put "borrado" into cd fld "consola"
   Listado
end mouseUp

private command Listado
   put "" into datosPeticion
   put "<?xml version='1.0' encoding='utf-8'?>" \
         & return & "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" \
         & return & tab & "<soap:Body>" \
         & return & tab & tab & "<Listado xmlns=" & quote & "http://ws.escrol.es/" & quote & " />" \
         & return & tab & "</soap:Body>" \
         & return & "</soap:Envelope>" \
         into datosPeticion   
   set the httpHeaders to "POST /WebService.asmx HTTP/1.1" \
         & return & "Host: ws.escrol.es" \
         & return & "Content-Type: text/xml; charset=utf-8" \
         & return & "Content-Length: " & the length of datosPeticion \
         & return & "SOAPAction: http://ws.escrol.es/Listado"
   
   
   put "petición iniciada" &cr&cr into field "consola"
   
   
   post datosPeticion to url "http://ws.escrol.es/WebService.asmx"
   put the result into resultado
   put it into datosRespuesta
   
   
   put "the result: " & resultado &cr&cr after field "consola"
   put "it: " & datosRespuesta &cr&cr after field "consola"
   put "petición terminada"&cr&cr after field "consola"
   
set the httpHeaders to empty --NEW LINE
   ---
end Listado
That first "put url..." stinks! I don't understand why that would be needed. :x
Setting the httpHeaders to empty makes some sense.

All I can say is that with those two additional lines the code does work consistently in the sim.

Simon :x
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

viro
Posts: 52
Joined: Fri Jul 05, 2013 6:59 pm
Location: Germany, Hesse

Re: Post to web service on iOS

Post by viro » Sun Sep 01, 2013 9:29 pm

And if nothings works for you try to download a restclient for your ipad and figure the post step by step. transfer your results into lv and bäm!
the funniest thing about this particular signature is that by the time you realize it doesn't say anything it's too late to stop reading it

juanjo
Posts: 35
Joined: Wed Jul 31, 2013 10:31 am

Re: Post to web service on iOS

Post by juanjo » Mon Sep 02, 2013 12:02 am

Hi Simon,

I tried similar things too.
I tried as you say… and I obtain the contents of Google, instead of mine ?!

Seems that my Post is ignored.
I'll try more tomorrow. Is late here.


Viro:
Thanks, good idea: I'll search for some soap client for iPad.
 

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Post to web service on iOS

Post by Simon » Mon Sep 02, 2013 12:27 am

Yeah, my bad!
I screwed up in the above code :x

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Post to web service on iOS

Post by LCNeil » Mon Sep 02, 2013 1:06 pm

Hi JuanJo et al.

This issue seems to be a bug in iOS deployment. I have tested your supplied code on desktop and Android environments without any issues and can constantly replicate the empty results on iOS.

As this is the case, I would recommend filing a bug report on the issue with RunRev Quality Control.

Filing a report with Quality Control is the best way to allow our team to investigate the issues further and implement a fix if needed. As you are filing the report you will automatically receive status updates on it via email.

Our quality control centre is available here-

http://quality.runrev.com

You will need to log-in with a RunRev Quality Control Account before you can submit a report. If you do not already have one, you will be able to create an account via the "New Account" option shown on the Quality Control homepage.

Kind Regards,

Neil Roger

--
RunRev Support Team ~ http://www.runrev.com
--

juanjo
Posts: 35
Joined: Wed Jul 31, 2013 10:31 am

Re: Post to web service on iOS

Post by juanjo » Mon Sep 02, 2013 1:44 pm

Hi Neil.

I'll do as you said.
Thanks to you, Simon and Viro for your kind attention and help.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Post to web service on iOS

Post by Simon » Mon Sep 02, 2013 7:13 pm

Oh Good!
I thought I was going crazy. I tried it on Android as well and saw it was working.

juanjo, when you file the report could you post the bug report number here so I can follow it?

Thanks,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

juanjo
Posts: 35
Joined: Wed Jul 31, 2013 10:31 am

Re: Post to web service on iOS

Post by juanjo » Mon Sep 02, 2013 8:31 pm

Simon wrote:juanjo, when you file the report could you post the bug report number here so I can follow it?
Sure!

Now I'm with the plan B…
I'll do it soon.

juanjo
Posts: 35
Joined: Wed Jul 31, 2013 10:31 am

Re: Post to web service on iOS

Post by juanjo » Wed Sep 11, 2013 5:35 pm

I filed the bug and I have responded:
(…)
The post command is failing on iOS due to the unexpected inclusion of "POST ..." in the first line of httpheaders.

I recommend you remove this line from httpheaders as it will be automatically generated when a request is sent using the post command. Removing this line will fix the issue of post not working on iOS.

There is a bug here, as obviously the behavior on the desktop is different from that on mobile. It should be possible to set the http command used in this way on iOS.

Ian.
I tested it and works well!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: SOLVED - Post to web service on iOS

Post by Simon » Wed Sep 11, 2013 8:04 pm

Great News!

Now how am I going to remember this?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

juanjo
Posts: 35
Joined: Wed Jul 31, 2013 10:31 am

Re: SOLVED - Post to web service on iOS

Post by juanjo » Wed Sep 11, 2013 8:13 pm

Mm… don't post 'post' in the post?

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”