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!
-- Only needs a button with this code and a text field called 'consola'
local arrayListado
on mouseUp
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"
---
end Listado
Last edited by juanjo on Wed Sep 11, 2013 5:36 pm, edited 1 time in total.
Hi juanjo,
This may be an httpHeaders issue.
If it works in the IDE (for you) but not on the device, one of the differences is mobile sends out a "mobile" header during a post.
After the post use "answer libURLLastRHHeaders" to see the differences.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
I tried to use answer libURLLastRHHeaders() but it stops the app.
It works in the IDE, but not in the iOS simulator.
In the dictionary page for 'post' they say The Android and iOS engines do not support 'libUrl', so maybe I'll need another way to analyze the headers, or documentation source to compose the right ones.
on mouseUp
put url "http://www.google.com" into temp
answer temp
end mouseUp
Make sure that your app is connected to the web.
From the sim either a restart or going to Safari first and actually watching a page load (not cache). Both seemed to work here I'll let you figure it out.
With just your code I was able to get the same response from IDE and sim.
The tip off was "it" was coming back way too fast in the sim.
If anyone knows actually why this happens then please pitch-in.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Perhaps we are approaching.
Although previously I've made sure that both are connected to internet, I can not do any reading, not in the simulator nor in the iPad (it's still working in the IDE).
I think LiveCode is somehow caching the connection, or the request is missformated only for iOS, and does not reach out.
I added a "Cache-Control: no-cache" line to the header, and I have verified "cachedURLs" (which is empty) and I really do not know what else to try.
Yes, I tried with the User-Agent and Cache-Control headers and I also think the problem may be there.
Either that, or the Post command on LiveCode for iOS is broken…
The problem is that libURLLastHTTPHeaders belongs to libURL, and this library don't works on iOS, so no way to see the headers actually sent from the simulator or device.
In fact, I think, as Simon said too, that is not having any communication.
"The Android and iOS engines do not support 'libUrl' but allow you to use post in the background."
If it can run in the background, there should be an asynchronous way to pick up the Post status and response.
I've verified that width can not be used to declare a callback message, and now I'm testing with urlProgress that although is specific for mobile, does not seem to do anything.