Get data from web services

Have you tried printing your “body” variable and making sure it’s what your expecting?

I don’t have experience with WCF and I’m not sure any one else does.  We make sure our routines talk to web servers supporting the HTTP protocol but what the webserver does after it gets the data is beyond the scope of what we can possibly support.

Your WCF service might be looking for something like a key-value pair in the body and you’re just shoving a JSON string in there. It might need to be:

body = “data=” … yourjsondata

but I have no clue what your service is actually looking for, so I can only speculate.

Thank you Rob, I will check this. Regards,

Dear sir,

I have problems with my WCF Service method POST.

It is working fine when calling from other clients, but it is not work when calling from Corona.

When calling from Corona, the service is fired, but its parameter is always NULL.

This is the Corona code:

    local dados = {}

    dados.esc_codigo = codigo

    local body = json.encode(dados)

    local url = “http://192.168.0.28:81/wcfEscola.svc/consultaCodigo

    

    local headers = {}

    headers[“Content-Type”] = “application/json”

    headers[“Accept-Language”] = “en-US”

    local params = {}

    params.headers = headers

    params.body = body

    network.request(url, “POST”, onRequestComplete, params)

What do you mean “Its parameter is always NULL”?

Can you post your onRequestComplete function?

Make sure to read today’s blog post on Facebook:

http://coronalabs.com/blog/2013/07/30/understanding-facebook-authentication/

I mean that the WCF Web Service receives null as parameter.

The data I would like to pass to WCF Service “params.body = body” does not reach the WCF WebService.

The problem is not in my OnRequestComplete. The problem is in communication between Corona and .NET.

Do you understand ?

Thank you !!!

I forgot to say that if I call the same WCF Web Service from another client, like a Java program, everything work well.

In other words, the data I pass via POST is received by the WCF Web Service.

But if I call from Corona, do not.

Thank You.

Have you tried printing your “body” variable and making sure it’s what your expecting?

I don’t have experience with WCF and I’m not sure any one else does.  We make sure our routines talk to web servers supporting the HTTP protocol but what the webserver does after it gets the data is beyond the scope of what we can possibly support.

Your WCF service might be looking for something like a key-value pair in the body and you’re just shoving a JSON string in there. It might need to be:

body = “data=” … yourjsondata

but I have no clue what your service is actually looking for, so I can only speculate.

Thank you Rob, I will check this. Regards,