Post information to a SOAP server

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
terryho
Posts: 126
Joined: Mon Nov 05, 2012 2:53 pm

Post information to a SOAP server

Post by terryho » Mon Nov 05, 2012 3:02 pm

Hi

How can I post the following to a SOAP server.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="val not allow to post"
xmlns:xsd="val not allow to post"
xmlns:soap="val not allow to post">
<soap:Body>
<data>
<group>
<ROLE>Student</ROLE>
<NUMBER>1</NUMBER>
<PASSWORD></PASSWORD>
</group>
</data>
</soap:Body>
</soap:Envelope>

I had try to use the LibSOAP, but I can not make it to work and change it to make my SOAP server to response it.

Can anyone to point me the right direction?

I had try to use the Post command, but I can not figure out how to put " in my live code script.

I'm a beginner of Live code. So it seem it is hard to me to make it.

Regards

Terry Ho

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Post information to a SOAP server

Post by bangkok » Mon Nov 05, 2012 9:29 pm

Disclaimer I dont use LiveCode with iOs.

So here is what i can tell you (on Windows).

-I've tried LibSOAP. No success.

-So I went the "classic" way.
You'll find one interesting stack here :

http://forums.runrev.com/phpBB2/viewtop ... =15#p55656

The important point is to set carefully.... you http header

Code: Select all

   libURLSetCustomHTTPHeaders field "Header"   ----put in this field your header
   post leMessage to url "http://wwwwwwwwwwwwwwwwww"     ----------- the URL of your webservice
put it into myResult           ------------ the answer of the webservice
In my case, the header i used :

Code: Select all

POST /adxwsvc/services/CAdxSubProgramXml HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 2351          -----here you calculate the number of chars of your XML message
Host: wwwwww:18980
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Hope this could help.

terryho
Posts: 126
Joined: Mon Nov 05, 2012 2:53 pm

Re: Post information to a SOAP server

Post by terryho » Tue Nov 06, 2012 6:24 am

Hi bangkok

Thanks your hints. I will take a look and try it.

Regards

Terry Ho

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Post information to a SOAP server

Post by Klaus » Tue Nov 06, 2012 11:55 am

Hi Terry,
terryho wrote:... but I can not figure out how to put " in my live code script.
You can use:
1. the keyword QUOTE
...
put "<?xml version=" & QUOTE & "1.0" & QUOTE & "encoding=" & QUOTE & "utf-8" & QUOTE & "?>" into Line_1_of_xml
## -> <?xml version="1.0" encoding="utf-8"?>
...

2. or create a little function in the stack script that will save you a LOT of typing like this:

Code: Select all

function q tString
  return QUOTE & tString & QUOTE
end q
...
put "<?xml version=" & q("1.0") & "encoding=" & q("utf-8") & "?>" into Line_1_of_xml
## -> <?xml version="1.0" encoding="utf-8"?>
...
:D


Best

Klaus

Post Reply