More - Post Command Problem looks like a RunRev problem?

Mark Smith lists at futilism.com
Mon Nov 17 11:32:47 EST 2008


Sorry, I should have said, the library requires 2.9.

How big is the data you're sending? I've had trouble putting large  
amounts of data on the command line (maybe a limitation of rev's  
'shell' call, or something else). I was suggesting this mainly as a  
way fo see if it gave you any indication of what the problem might  
be, whether or not it would be useful in 'production'.
Anyway, you could certainly try passing the soap envelope on the  
command line (does writing it to a file really slow it down all that  
much?).
Anyway, you'll need to url encode the data, so something like

put "curl -s" into tCurlStr

repeat for each line L in myHttpHeaders -- if you're only setting one  
header, you don't need a repeat, of course.
   put " -H" && "'" & L & "'" after tCurlStr
end repeat

put " -d" && "-" && quote & urlencode(mySoapEnvelope) & quote && tUrl  
after tCurlStr
put shell(tCurlStr) into tResponse

I think libUrl only ever puts errors into the result. What the shell  
call returns will be either the returned data, or an error (though  
the result may contain something if there was an error in the shell  
call itself).

Also, I've just realised that if you do need to write to a tempfile,  
the line should be:
put " -d" && "@" & tFile && tUrl after tCurlStr


Best,

Mark

On 17 Nov 2008, at 16:10, Dave wrote:

> Hi,
>
> Thanks for this. I looked at your library and found that it won't  
> run under RunRev 2.8.1.472 which is what I am using.
>
> Writing to a file will slow it down, do I *have* to use a file? If  
> not, how would I format the command?
>
> Also there are two return variables using the post command and I  
> need to return both:
>
> post mySoapEnvelope to url mySoapURL
> put it into myReply
> put the result into myResult
>
> How can I do this using the shell command?
>
> Would it be worth replacing the internet library from the latest  
> version of RunRev? Will this work? Are they compatible?
>
> All the Best
> Dave
>
> On 17 Nov 2008, at 15:21, Mark Smith wrote:
>
>> Dave, you'll need something like this:
>>
>> put the tempname into tFile
>> put mySoapEnvelope into url("file:" & tFile) -- this is so we  
>> don't pass a load of data on the command line
>> put "curl -s" into tCurlStr
>>
>> repeat for each line L in myHttpHeaders -- if you're only setting  
>> one header, you don't need a repeat, of course.
>>   put " -H" && "'" & L & "'" after tCurlStr
>> end repeat
>>
>> put " -d" && tFile && tUrl after tCurlStr
>> put shell(tCurlStr) into tResponse
>> delete file tFile -- cleanup
>>
>>
>> If you want to see the whole exchange including headers and  
>> everything, then replace "-s" with "-v" in the third line.
>>
>> Alternatively, you could try my library (http:// 
>> futsoft.futilism.com/revolutionstuff.html),
>> in which case it would be
>>
>> put curl.new() into tCurl
>> curl.setUrl tCurl, tUrl
>> curl.setHeaders  tCurl, myHttpHeaders
>> curl.setPostData tCurl, mySoapEnvelope
>> put curl.runTilDone(tCurl) into tResponse
>>
>>
>> Best,
>>
>> Mark
>>
>>
>> On 17 Nov 2008, at 14:40, Dave wrote:
>>
>>> Hi Mark,
>>>
>>> I can't figure out the correct format for the "curl" command, or  
>>> how to call it from RunRev.
>>>
>>> Given that the current post command looks like this:
>>>
>>> set the httpHeaders to myHTTPHeader
>>> post mySoapEnvelope to url mySoapURL
>>> put it into myReply
>>> put the result into myResult
>>>
>>> How would I do this using curl? The function to send the command  
>>> is called from all over the place so I would have to change it in  
>>> the low level function, if so then the above is the only data I  
>>> can get at and I have to return myReply and myResult in the same  
>>> format as the post command would use.
>>>
>>> Is this possible using curl?
>>>
>>> Thanks a lot
>>> All the Best
>>> Dave
>>>
>>> On 17 Nov 2008, at 12:00, Mark Smith wrote:
>>>
>>>> Dave, I wonder if it would be worth trying to do the post using  
>>>> curl (or some other tool) to see if the problem still occurs?
>>>>
>>>> Also, have you looked at what actual bytes the truncated  
>>>> response ends with ie. is the server sending back something weird?
>>>>
>>>> Best,
>>>>
>>>> Mark
>>>>
>>>> On 17 Nov 2008, at 11:29, Dave wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> Please see below for the history of this problem. Since then I  
>>>>> have some more information:
>>>>>
>>>>> I installed WireShark and recreated the problem. When I look at  
>>>>> the captured information, it looks as if the response is being  
>>>>> sent and received by server/client ok. It shows a number of TCP  
>>>>> packets (TCP Segment of a reassembled PDU) and then one block  
>>>>> that shows as HTTP/XML. When I select this block it shows the  
>>>>> packet reassembled as 23782 bytes. However when the error  
>>>>> occurs, the response return by the RunRev post command only  
>>>>> shows the first 2736 bytes, e.g. the rest of the reassembled  
>>>>> block is truncated. I have the dumps as text files but they are  
>>>>> too big to post here.
>>>>>
>>>>> When I looked up the post command in RunRev it says it is part  
>>>>> of the internet library, however I can't find any source code  
>>>>> for this. Is it available? I'd like to add some trace  
>>>>> information so I can see if this library is being passed the  
>>>>> whole block and if so why is it going wrong on this block.
>>>>>
>>>>> Is there another way to do this in RunRev? e.g. A alternative  
>>>>> to the "post" command?
>>>>>
>>>>> Any ideas or suggestions on how to fix or even get a handle of  
>>>>> this problem would be greatly appreciated.
>>>>>
>>>>> All the Best
>>>>> Dave
>>>>>
>>>>> ------
>>>>>
>>>>> I read records from a database, format them, and add them to a  
>>>>> block of data. There is a blocking factor variable, it is set  
>>>>> to 200, so I read 200 records from the database, block them  
>>>>> into one big block and send it to the server via a "post"  
>>>>> command. The Server then sends a response which can be variable  
>>>>> in length, the response is in XML format. This process works  
>>>>> well 99% of the time, but sometimes, (and this can be  
>>>>> reproduced if the right data (or the wrong data in this case!)  
>>>>> is present in the database). When this happens the response  
>>>>> from the server is truncated in the middle of an XML node. As  
>>>>> far as I can tell the difference is that by chance, a group of  
>>>>> 200 records has caused the response to be over a certain size.
>>>>>
>>>>> If I set the BlockingFactor to 50, the problem goes away, but  
>>>>> this causes a major slowdown.
>>>>>
>>>>> ------
>>>>>
>>>>> It is sending one block at a time, each block contains N  
>>>>> records. There are around 10,500 records in the database.
>>>>>
>>>>> Each record has an XML node in the reply, depending on the  
>>>>> content of the record sent, it will return different data of  
>>>>> variable size. It appears if the block returned is greater than  
>>>>> a certain size, it is truncated.
>>>>>
>>>>> Basically the process is:
>>>>>
>>>>> repeat for all Records in Database
>>>>> Read Record From Database
>>>>> Encode as XML
>>>>> Add to end of SendDataBlock
>>>>>
>>>>> if the number of records in SendDataBloack > SendBlockingFactor  
>>>>> then
>>>>>   post SendDataBlock
>>>>>   get response
>>>>>   process response
>>>>>   put empty into SendDataBlock
>>>>> end if
>>>>>
>>>>> end repeat
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> use-revolution mailing list
>>>>> use-revolution at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your  
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>>
>>>> _______________________________________________
>>>> use-revolution mailing list
>>>> use-revolution at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your  
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your  
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list