How to invoke web services method in lua

Hi

how to invoke asp.net web services method in Lua language.Please share me sample code if
possible. [import]uid: 209400 topic_id: 34451 reply_id: 334451[/import]

:slight_smile: Forget it. Dealing with SOAP in lua… nah.

Create a RESTful service instead, use json for everything. There’s just one caveat; Corona SDK networking is poorly written and you cannot make the web service truly RESTful. Here are 2 examples that should work, but the Corona team seem to not really have a grip on this:

• Returning anything but 200 OK or 302 Redirect from the server leads to event.isError = false in iOS (expected) but true in Android (not expected - that’s definately a bug). Disclaimer: Might have been fixed in a Daily Build.

• Using DELETE and PUT as http verbs works partly on iOS and not at all on Android, but including a body with data is not being correctly transferred to the server. This should work as well to make Corona fully REST compatible. You can work around this by including all necessary data as part of the URL.

For exampe, this will work:
network.request(“http://someservice.com/some_id/delete”, “DELETE”, listener)

This does not work:
• network.request(“http://someservice.com/delete”, “DELETE”, listener, {body = “id=some_id”})

Now, the second network.request is not the correct way to deal with a RESTful API, the first one is the correct way. However, passing a body to DELETE and PUT is an integral part of network communications and, according the http spec, should work.

Good luck! :slight_smile: [import]uid: 21746 topic_id: 34451 reply_id: 136976[/import]

Thanks for your reply.If you have any sample code please share me. [import]uid: 209400 topic_id: 34451 reply_id: 136979[/import]

:slight_smile: Forget it. Dealing with SOAP in lua… nah.

Create a RESTful service instead, use json for everything. There’s just one caveat; Corona SDK networking is poorly written and you cannot make the web service truly RESTful. Here are 2 examples that should work, but the Corona team seem to not really have a grip on this:

• Returning anything but 200 OK or 302 Redirect from the server leads to event.isError = false in iOS (expected) but true in Android (not expected - that’s definately a bug). Disclaimer: Might have been fixed in a Daily Build.

• Using DELETE and PUT as http verbs works partly on iOS and not at all on Android, but including a body with data is not being correctly transferred to the server. This should work as well to make Corona fully REST compatible. You can work around this by including all necessary data as part of the URL.

For exampe, this will work:
network.request(“http://someservice.com/some_id/delete”, “DELETE”, listener)

This does not work:
• network.request(“http://someservice.com/delete”, “DELETE”, listener, {body = “id=some_id”})

Now, the second network.request is not the correct way to deal with a RESTful API, the first one is the correct way. However, passing a body to DELETE and PUT is an integral part of network communications and, according the http spec, should work.

Good luck! :slight_smile: [import]uid: 21746 topic_id: 34451 reply_id: 136976[/import]

Thanks for your reply.If you have any sample code please share me. [import]uid: 209400 topic_id: 34451 reply_id: 136979[/import]