NetTalk Central

Author Topic: Trying to GEt and POST to a web page failed  (Read 2382 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Trying to GEt and POST to a web page failed
« on: April 30, 2015, 09:49:41 AM »
Hi,
I'm trying to read some values from a web page.
I have a program that does that reading ok.
I intalled Fiddler ang catch all the trafic.

Then I try to do the same with NetTalk using the NetDemo app.

1) I can GET the first page like Fiddler shows without problem.
http://www.bolsar.com/VistasDL/PaginaPrincipal.aspx

GET http://www.bolsar.com/VistasDL/PaginaPrincipal.aspx HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Cookie: ASP.NET_SessionId=jtc4p2ebhy01qwa11f4xg23c

It gives a cookie, ok.

2) The next is to send a POST to a webservice :

http://www.bolsar.com/WebServices/AcreditadorWS.asmx/Refresh

In Fiddler it seams not to contain any data, the post is :

POST http://www.bolsar.com/WebServices/AcreditadorWS.asmx/Refresh HTTP/1.1
Origin: http://www.bolsar.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
Content-Type: application/json; charset=UTF-8
Referer: http://www.bolsar.com/VistasDL/PaginaPrincipal.aspx
Accept: */*
Content-Length: 0
Cookie: ASP.NET_SessionId=jtc4p2ebhy01qwa11f4xg23c; ckLng=ESP; __utmt=1; __utma=133838749.1219680072.1430413640.1430413640.1430413640.1; __utmb=133838749.1.10.1430413640; __utmc=133838749; __utmz=133838749.1430413640.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Connection: Keep-Alive
Accept-Encoding: gzip
Accept-Language: es-ES,en,*
Host: www.bolsar.com

The Response is:

HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Thu, 30 Apr 2015 17:06:52 GMT
Content-Length: 9
{"d":"0"}



But if I try to POST it from a NetDemo app I allways get a:

<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>


How can I do it with NetDemo app?

Thanks

pd: Atached goes the Fiddler Session.


[attachment deleted by admin]
-----------
Regards
Alberto

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Trying to GEt and POST to a web page failed
« Reply #1 on: April 30, 2015, 10:18:35 AM »
Michelis,

For me works, in the URL in the Generic post i put

http://www.bolsar.com/WebServices/AcreditadorWS.asmx?op=Refresh

post data i put

<?xml version="1.0" encoding="utf-8"?>
<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/">
  <soap:Body>
    <Refresh xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>

and in the header tab in the Web Client demo i set the content type to

text/xml


Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Trying to GEt and POST to a web page failed
« Reply #2 on: April 30, 2015, 11:19:19 AM »
Ok, Thank you very much! it works.

Now I have a weird thing.

if I get this page in an explorer:

http://www.bolsar.com/VistasDL/PaginaLideres.aspx/GetDataPack

I get a pge full of prices,
Especie         Vto.   Cant. Nominal   Precio Compra   Precio Venta   Cant. Nominal   Último   Variación %   Máximo   Mínimo   Cierre Ant.   Vol. Nominal   Monto Operado ($)   Cant. Ope.   Hora Cotización
ALUA      72 hs.   1,242   10,850   10,900   4,548   10,900   -1,36    11,100   10,850   11,050   530,602   5,843,577   216   15:47:35
APBR      72 hs.   415   55,250   55,400   848   55,400   -0,36    56,500   54,600   55,600   297,674   16,411,003   452   15:46:27

Prices I need to read but if I get it with a GEt or a POST with NetDemo app I don get the prices at all.

It comes with many characters from the page but nothig like I see in an explorer.

How can I get it?

Thanks again!!!!
-----------
Regards
Alberto