POST SOAP Webservice issue.

I’ve struggled a bit trying to connect my corona app to a Webservice written in C#.

I keep getting “The server cannot service the request because the media type is unsupported.”
This happens when I switch access from “GET” to “POST” in the network.request call.

Obvious the error is from the IIS that I’m communicating with but after a few hours of digging this
fault can apparently also be due to faulty header parameters. I’ve checked the configuration file on
the iis to accept HTTPPost, and HTTPGet.

First I thought the error was due to the fact that the WS was using complex objects as parameter
input but after throwing together a simple “helloworld” I still get the same issue. Anyone got experience
with issues like this?

I basically do:
header[“Content-Type”] = “application/x-www-form-urlencoded”
(tried with other content-type such as text/xml etc - same result)

params.header = header
params.body = [[







]]

network.request( “http://127.0.0.1:1234/WebserviceTest/Service1.asmx?op=HelloWorld”, “POST”, networkListener, params)

Also, I’ve tried this from SoapUI and it works flawlessly from that application. It uses POST in that
call with no issues at all. Since the webservice is not mine I can’t change it internally so I’m rather
stuck atm. Any ideas would be most appriciated.

Thank you for your time
//Anders
[import]uid: 134273 topic_id: 29561 reply_id: 329561[/import]

Seems like the param line vanished somehow in my post.

params.body = [[ <envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"><br> <header></header><br> <br> <helloworld></helloworld><br> <br></envelope>]] [import]uid: 134273 topic_id: 29561 reply_id: 118674[/import]

+1 - just found a big client for business app build on SOAP webservice. Now have to check if Corona can handle this job. [import]uid: 12704 topic_id: 29561 reply_id: 118762[/import]

+1 - just found a big client for business app build on SOAP webservice. Now have to check if Corona can handle this job. [import]uid: 12704 topic_id: 29561 reply_id: 118763[/import]

Hello, I am successfully calling my C# web services.

Here is what I do…

Copy your soap request from SOAPUI and pack it into a string like this…

local xmlRequest = ‘<?xml version="1.0" encoding="utf-8"?>’
xmlRequest = xmlRequest … ‘’
xmlRequest = xmlRequest … ‘’
xmlRequest = xmlRequest … ‘’ --this is how it picks up the operation
xmlRequest = xmlRequest … ‘’ … “bob” … ‘’
xmlRequest = xmlRequest … ‘’
xmlRequest = xmlRequest … ‘’
xmlRequest = xmlRequest … ‘’

I was receiving a similar error to yours and it was because I did not have the ‘<?xml version="1.0" encoding="utf-8"?>’ as part of my request.

Next send the request to your server using the following:

local header = {}
local params = {}

header[“Content-Type”] = “text/xml” --this is key

params.headers = header
params.body = xmlRequest

network.request( _G.tblSettings.server … “/myService.asmx”, “POST”, networkListener, params)

This works for me. Hope it helps you.

Cheers [import]uid: 161448 topic_id: 29561 reply_id: 120169[/import]

Yeeep men it’s works fine and I even find way to deal with SOAP services with basic autentication but what about NTLM? You can use native.webpopup to login but you don’t have access to autentication cookie. [import]uid: 12704 topic_id: 29561 reply_id: 120171[/import]

Hello, I am successfully calling my C# web services.

Here is what I do…

Copy your soap request from SOAPUI and pack it into a string like this…

local xmlRequest = ‘<?xml version="1.0" encoding="utf-8"?>’
xmlRequest = xmlRequest … ‘’
xmlRequest = xmlRequest … ‘’
xmlRequest = xmlRequest … ‘’ --this is how it picks up the operation
xmlRequest = xmlRequest … ‘’ … “bob” … ‘’
xmlRequest = xmlRequest … ‘’
xmlRequest = xmlRequest … ‘’
xmlRequest = xmlRequest … ‘’

I was receiving a similar error to yours and it was because I did not have the ‘<?xml version="1.0" encoding="utf-8"?>’ as part of my request.

Next send the request to your server using the following:

local header = {}
local params = {}

header[“Content-Type”] = “text/xml” --this is key

params.headers = header
params.body = xmlRequest

network.request( _G.tblSettings.server … “/myService.asmx”, “POST”, networkListener, params)

This works for me. Hope it helps you.

Cheers [import]uid: 161448 topic_id: 29561 reply_id: 120169[/import]

Yeeep men it’s works fine and I even find way to deal with SOAP services with basic autentication but what about NTLM? You can use native.webpopup to login but you don’t have access to autentication cookie. [import]uid: 12704 topic_id: 29561 reply_id: 120171[/import]

I too found that a SOAP call “almost” works… While my soap calls work fine in other places such as soapui, it fails in Corona. I strongly believe the problem is that Corona is dropping the SOAPAction header parameter in my code.

headers = {}  
local params = {}  
  
headers["Host"] = "opentrackcert.arkona.com"  
headers["Content-Type"] = "text/xml; charset=utf-8"  
headers["Content-Length"] = "length"  
headers["SOAPAction"] = "http://www.starstandards.org/webservices/2005/10/transport/operations/ProcessMessage"  
  
params.header = headers  

Has anyone been able to get this to work? I’ve really gotta get this working ASAP for a very large client of mine. Thanks! [import]uid: 64538 topic_id: 29561 reply_id: 132244[/import]

Hey, I actually solved my issue just two days ago, been busy with work. And even though I don’t fully understand what I did wrong in the first place here is my code:

Two things though. I don’t pass length. I tried for the longest to do so but I couldn’t get it to work. However leaving it out seemed to be fine to me. Secondly, my webservice takes an object (playercreateinput) as parameter hence the “complexity” with the soapenv:body tag. The input consists of an access token and an parameters object where the parameters object contains the raw data.

[code]
– SOAP
header[“SOAPAction”] = “http://somecompany.se/PlayerCreate
header[“Content-Type”] = “text/xml”

params.headers = header

params.body = [[

<?xml version="1.0" encoding="utf-8"?>

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:sol=“http://somecompany.se/
xmlns:xsd=“http://www.w3.org/2001/XMLSchema
xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/”>






blahblehbluehj@bljre.se
efefefe
efefefefe





]]

network.request( “http://urltohost:port/wsname.asmx”,“POST”,networkListener,params);
[/code] [import]uid: 134273 topic_id: 29561 reply_id: 132256[/import]

I too found that a SOAP call “almost” works… While my soap calls work fine in other places such as soapui, it fails in Corona. I strongly believe the problem is that Corona is dropping the SOAPAction header parameter in my code.

headers = {}  
local params = {}  
  
headers["Host"] = "opentrackcert.arkona.com"  
headers["Content-Type"] = "text/xml; charset=utf-8"  
headers["Content-Length"] = "length"  
headers["SOAPAction"] = "http://www.starstandards.org/webservices/2005/10/transport/operations/ProcessMessage"  
  
params.header = headers  

Has anyone been able to get this to work? I’ve really gotta get this working ASAP for a very large client of mine. Thanks! [import]uid: 64538 topic_id: 29561 reply_id: 132244[/import]

Hey, I actually solved my issue just two days ago, been busy with work. And even though I don’t fully understand what I did wrong in the first place here is my code:

Two things though. I don’t pass length. I tried for the longest to do so but I couldn’t get it to work. However leaving it out seemed to be fine to me. Secondly, my webservice takes an object (playercreateinput) as parameter hence the “complexity” with the soapenv:body tag. The input consists of an access token and an parameters object where the parameters object contains the raw data.

[code]
– SOAP
header[“SOAPAction”] = “http://somecompany.se/PlayerCreate
header[“Content-Type”] = “text/xml”

params.headers = header

params.body = [[

<?xml version="1.0" encoding="utf-8"?>

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:sol=“http://somecompany.se/
xmlns:xsd=“http://www.w3.org/2001/XMLSchema
xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/”>






blahblehbluehj@bljre.se
efefefe
efefefefe





]]

network.request( “http://urltohost:port/wsname.asmx”,“POST”,networkListener,params);
[/code] [import]uid: 134273 topic_id: 29561 reply_id: 132256[/import]

Hey guys, hoping someone can quickly reply. I am attempting to use your examples from above, however when I try to run my program corona says “nesting of [[…]] is deprecated near ‘[’”. Any idea why I am getting this syntax error? [import]uid: 19620 topic_id: 29561 reply_id: 143218[/import]

The code I posted was quite some time ago. Anyway, I haven’t encountered a problem such as the one you describe. The only double ‘[[’ is the ones surrounding the params.body part. They stretch from params.body = [[......]]

Perhaps something has changed in the later corona versions that makes that usage deprecated, although that does sound odd. [import]uid: 134273 topic_id: 29561 reply_id: 143220[/import]

I’m sorry, I just realized that my issue was with doing bracket comments of --[[, turns out I had something screwed up with that. Sorry! and thanks for the reply [import]uid: 19620 topic_id: 29561 reply_id: 143222[/import]

@tfassette

Can you explain in more detail what you mean by packing the soapUI request into a string? I got my request from SoapUI, but am unsure on how it should be setup. should each line of my soapui request be inside its own set of ""s? [import]uid: 19620 topic_id: 29561 reply_id: 143372[/import]

Nevermind, I got it working! Finally realized that each line was in single ’ 's [import]uid: 19620 topic_id: 29561 reply_id: 143384[/import]

Hey guys, hoping someone can quickly reply. I am attempting to use your examples from above, however when I try to run my program corona says “nesting of [[…]] is deprecated near ‘[’”. Any idea why I am getting this syntax error? [import]uid: 19620 topic_id: 29561 reply_id: 143218[/import]

The code I posted was quite some time ago. Anyway, I haven’t encountered a problem such as the one you describe. The only double ‘[[’ is the ones surrounding the params.body part. They stretch from params.body = [[......]]

Perhaps something has changed in the later corona versions that makes that usage deprecated, although that does sound odd. [import]uid: 134273 topic_id: 29561 reply_id: 143220[/import]

I’m sorry, I just realized that my issue was with doing bracket comments of --[[, turns out I had something screwed up with that. Sorry! and thanks for the reply [import]uid: 19620 topic_id: 29561 reply_id: 143222[/import]