Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


HTTP POST error message


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-11-2008, 12:15 PM
Junior Member
 
Join Date: Apr 2008
Location: France
Posts: 16
Default HTTP POST error message

Hi,
My program on the device display error during the request http :
"An error message cannot
be displayed because an
optional resource assembly
containing it cannot be
found
Continue?"


(On the desktop it's OK no display error).

My device under framework 2
My project included objects ->
Request:Webrequest
Response:Webresponse

my code :

Response.new1
Request.new1("http://wwwmyserver.com/upload.php?lat="&lat)
Response.value=Request.Getresponse
Res=Response.GetString
Response.close

thanks for help !
stef
Reply With Quote
  #2 (permalink)  
Old 06-11-2008, 12:41 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,756
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

You are getting that error because the error messages are not installed on your device. See this thread error messages on device
Reply With Quote
  #3 (permalink)  
Old 06-11-2008, 01:12 PM
Junior Member
 
Join Date: Apr 2008
Location: France
Posts: 16
Default

thanks Agraham

my code for request http does not work :

error An unexpected error occurred on a send
continue?

i'm checking....
Reply With Quote
  #4 (permalink)  
Old 06-11-2008, 02:02 PM
Junior Member
 
Join Date: Apr 2008
Location: France
Posts: 16
Default

always this error ! I don't understand
Reply With Quote
  #5 (permalink)  
Old 06-11-2008, 02:51 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,756
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

From Googling around I think this means that the server closed the TCP connection.

Engels Rajangam : The underlying connection was closed... This article suggests that setting WebRequest.KeepAlive to false might help with this sort of error - it defaults to true.
Reply With Quote
  #6 (permalink)  
Old 06-12-2008, 07:55 AM
Knows the basics
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 71
Default

Quote:
From Googling around I think this means that the server closed the TCP connection.
- He might wanna try a different server to exclude issues with a particular server.

- different headers might be used for troubleshooting ( TRACE header for example would instruct the server to return the packets you sent to it).
In case of issues with the http i would not start with POST, because that's the most difficult.Instead he should try a GET first to see how the server answers.

- a network sniffer like WireShark might be used to figure out where the problem is very quickly - if one is familar with the usage of these tools.
For me a sniffer is the first choice because i can see what's going on there immediatly.


Quote:
Engels Rajangam : The underlying connection was closed... This article suggests that setting WebRequest.KeepAlive to false might help with this sort of error - it defaults to true.
KeepAlive is integral part of the HTTP1.1 protocol.Therefore it is always enabled with HTTP 1.1, in contrast to 1.0, where the KeepAlive had to be enabled explicitly.Most servers support 1.1, so this is certainly not the cause of the issue.

As i already said above, POST is not a good point to start with.Once a GET is working, this would be the proof that the routines work in general and the internet connection is ok.One could then proceed to test with POST headers.

From my personal experience ( i also do a lot with these POSTs on the device)
i would say, the error message mean, there is either a problem with the internet connection itself, the server connection ( does not accept the connection) or the DNS name resolution.

I also use an errorhandler in my http send routine and whenever the errorhandler traps an error this means i do not have established an internet connection.Therefore i use this as indicator whether the connection is there or not ( due to lack of description of the error - i do not use your new library yet which returns descriptions ...;-) )


kind regards

TWELVE

Last edited by TWELVE : 06-12-2008 at 01:17 PM.
Reply With Quote
  #7 (permalink)  
Old 07-04-2008, 08:28 AM
Newbie
 
Join Date: Jan 2008
Posts: 4
Default

Hi, TWELVE,

Can you share some routine of using POST method? I want to submit some data to the web server, and the string is very large and cannot use the GET method (it works).

I am looking for code snippet for doing this using http.dll.

For example, i want to submit two set of text with name a and b. In the server side, I have a php script which use $_POST['a'] and $_POST['b'] to read these 2 data. I am now have problem of how to pass these two parameter in basic4ppc.

Tks in advance.

Cheers.
Kawawong
Reply With Quote
  #8 (permalink)  
Old 07-04-2008, 11:02 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,186
Default

You will need something like:
Code:
Sub Globals
Dim buffer(0) As byte
End Sub
Sub App_Start
    bit.New1 'bit is a Bitwise object
    postdate
End Sub
Sub PostDate
    Response.New1
    Request.New1("http://www...")
    request.ContentType = "application/x-www-form-urlencoded"
    request.Method = "POST"
    writer.New1(request.GetStream,false)
    s = "a=value1&b=23"
    buffer() = bit.StringToBytes(s,0,StrLength(s))
    writer.WriteBytes(buffer())
    response.Value = request.GetResponse
    Msgbox(response.GetString)
    response.Close
End Sub
Reply With Quote
  #9 (permalink)  
Old 07-04-2008, 01:11 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Quote:
Originally Posted by miataman View Post
my code :

Response.new1
Request.new1("http://wwwmyserver.com/upload.php?lat="&lat)
Response.value=Request.Getresponse
Res=Response.GetString
Response.close


If this code is correct, the then error is a simple dot(.) missing after www....
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #10 (permalink)  
Old 07-11-2008, 09:34 AM
Newbie
 
Join Date: Jan 2008
Posts: 4
Default

Tks.

Since I have a large text required to post to the server, is there any function like

urlencode

to encode the text first before POSTing it?

^_^
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP POST error Elrick Bug Reports 3 05-24-2008 03:06 PM
HTTP Post fails if Umlauts sent and UTF-8 is used TWELVE Questions & Help Needed 11 04-29-2008 11:13 AM
HTTP POST on Device - error message TWELVE Questions & Help Needed 6 04-26-2008 10:35 AM
HTTP Post nsidney Questions & Help Needed 4 01-30-2008 10:52 AM
HTTP Post ohkovar Questions & Help Needed 3 07-07-2007 05:36 PM


All times are GMT. The time now is 02:08 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0