Re: Container and Lines objects
New problem with containers
The code to add this object is
ThisForm.D1.clearApps ThisForm.D1.AddObject("A1","_appointment")With ThisForm.D1.A1 .Height = 200 .Tag = "APP" .Top = 250 .Left = 1 ._Label1.Caption = "Demo COGEN" .Visible = .T.EndWith ThisForm.D1.wlContentChanged = .T. ThisForm.Refresh
Where clearApp is a method that clean all the objects already contained in D1 that is the container
When i open the form the first time it appears as in this image
after i click the button to add objects it changes, but the object is not added where i ask (the object has top=250 while in the form it seems at 0 and also the height is not correct. Iy has the properties i defined in the object class)
If i close the form (with the button we found in awcmdok) and the i open the form again i see the form without object in the container (even if in the debug it has still the object)
and when i add newly the object with my button (as i do the first time) the object is added in the correct position
What do i need to do to add the object without problems. This form must show user's appointment in week view....
Thanks
POSTing XML in HTTP Request?
I need to submit an XML string to a vendor's website. I need to confirm I am doing this correctly.
Here's what I am doing:
1) Create Object using wwIPStuff > Success
2) Connect to server using HTTPConnect() > Success
3) Build XML String > XML Validator indicates No errors when I validate the string
4) Issue lcXML = STRCONV(lcXML, 9)
5) Set Headers to include: Content-Type: text/xml
6) Issue AddPostKey() to clear POST Buffer
7) Set nHttpPostMode = 4
8) Issue AddPostKey(lcXML)
9) Issue HTTPGetEx(lcPage,@lcResponse,@lnSize,lcHeaders) > Error 500.00 Internal Server Error
The vendor says the problem is either bad XML or invalid content type header.
The vendor also says the XML String should be posted as body of http request.
Question: Does AddPostKey(lcXML) place the XML string into the body of the http request?
If not, how would I place the XML string into the body of the http request?
Finally, once I get this working correctly, the vendor will send a zipped file in the response. The file size will be approximately 6Meg. Am I using the correct approach with HTTPGetEx shown above? Ultimately, I need to save the zipped file to disk for further processing.
Thanks!
TIA,
Steve
Re: POSTing XML in HTTP Request?
Re: POSTing XML in HTTP Request?
Yes, I saw where HTTPGet is easier, and I may end up using it as I get further down the road.
I also re-looked at the lcOutputFile option and probably need to use that to capture the zip file.
It also appears that AddPostKey(lcXML) does add the XML file after the headers, essentially as body, right?
This is a new service on the vendor's webserver, so the issue may be on their end. We are in test mode.
Thanks for the feedback! Hope it's warmer where you are then Kentucky!
TIA,
Steve
Detecting disabled cookies
Re: POSTing XML in HTTP Request?
Success!
Worked flawlessly.
Re: Success!
Re: POSTing XML in HTTP Request?
Re: Container and Lines objects
You can use their classes (such as .xxxlin{your style directives}) - reminder: in FoxinCloud, Lower(VFP classes) == CSS classes
and/or, if needed, add some custom CSS classes to these objects using xxxLin.wCSSclassAdd = 'yourAdditionalCSSclass(es)'; then you will have in xxx.css: .yourAdditionalCSSclass(es) {your style directives}
-- thn (FoxInCloud)
Re: New problem with containers
Can you confirm
ThisForm.D1.wlContentDynamic = .T.
?
I ask you this because it looks like the appointment style is added to dynamic CSS instead of in-line style="" attribute, as of normal awHTML.prg behavior.
If possible, can you post the server xml response when you add this appointment container?
You can get it from the server form inside IDE, click the 'show status' button, then 'last HTML output'.
-- thn (FoxInCloud)
Re: Container and Lines objects
Re: Container and Lines objects
e.g.
.myClass1.myClass2 {border: 2px inset #FFF; }
second parameter is 'border style' - you can choose between: dotted | dashed | solid | double | groove | ridge | inset | outset
-- thn (FoxInCloud)
Re: Container and Lines objects
-- thn (FoxInCloud)
Re: New problem with containers
The HTML output of the first request /(hen the buttons are not in the correct position) is this:
HTTP/1.1 200 OK Content-type: text/xml Set-Cookie: mob=3OS0MM1B6; path=/; expires=Fri, 2 Aug 2013 23:00:00 GMT<?xml version='1.0' encoding='UTF-8' standalone='yes'?>true boolean $('agenda_scx-d1').update('<!-- Rendered in 036 ms --><!-- Rendered in 015 ms --><div id="agenda_scx-d1-_appointment1" class="container awcnt mobcnt _container _appointment" style="display:block;"><!-- Rendered in 007 ms --><label id="agenda_scx-d1-_appointment1-_label1" class="label awlbl moblbl _label" style="text-align:center;background:transparent;color:#0000FF;cursor:pointer;width:131px;height:59px;display:block;font:16pt \'Trebuchet MS\';left:-8px;top:1px;">Lunedì</label><!-- agenda_scx-d1-_appointment1 --></div><!-- Rendered in 007 ms --><button id="agenda_scx-d1-a1" class="commandbutton awcmd mobcmd _commandbutton _appointment1" style="display:block;" tabindex="542" onclick="FoxInCloud.DOMEvent(event)" type="button" autocomplete="off">Demo COGEN</button><!-- Rendered in 007 ms --><button id="agenda_scx-d1-a2" class="commandbutton awcmd mobcmd _commandbutton _appointment1" style="display:block;" tabindex="543" onclick="FoxInCloud.DOMEvent(event)" type="button" autocomplete="off">Corso SAP</button>'); $('agenda_scx-d2').update('<!-- Rendered in 035 ms --><!-- Rendered in 034 ms --><div id="agenda_scx-d2-_appointment1" class="container awcnt mobcnt _container _appointment" style="display:block;"><!-- Rendered in 007 ms --><label id="agenda_scx-d2-_appointment1-_label1" class="label awlbl moblbl _label" style="text-align:center;background:transparent;color:#0000FF;cursor:pointer;width:131px;height:59px;display:block;font:16pt \'Trebuchet MS\';left:-8px;top:1px;">Martedì</label><!-- agenda_scx-d2-_appointment1 --></div>'); $('agenda_scx-d3').update('<!-- Rendered in 017 ms --><!-- Rendered in 015 ms --><div id="agenda_scx-d3-_appointment1" class="container awcnt mobcnt _container _appointment" style="display:block;"><!-- Rendered in 007 ms --><label id="agenda_scx-d3-_appointment1-_label1" class="label awlbl moblbl _label" style="text-align:center;background:transparent;color:#0000FF;cursor:pointer;width:131px;height:59px;display:block;font:16pt \'Trebuchet MS\';left:-8px;top:1px;">Mercoledì</label><!-- agenda_scx-d3-_appointment1 --></div>'); $('agenda_scx-d4').update('<!-- Rendered in 016 ms --><!-- Rendered in 015 ms --><div id="agenda_scx-d4-_appointment1" class="container awcnt mobcnt _container _appointment" style="display:block;"><!-- Rendered in 007 ms --><label id="agenda_scx-d4-_appointment1-_label1" class="label awlbl moblbl _label" style="text-align:center;background:transparent;color:#0000FF;cursor:pointer;width:131px;height:59px;display:block;font:16pt \'Trebuchet MS\';left:-8px;top:1px;">Giovedì</label><!-- agenda_scx-d4-_appointment1 --></div>'); $('agenda_scx-d5').update('<!-- Rendered in 017 ms --><!-- Rendered in 016 ms --><div id="agenda_scx-d5-_appointment1" class="container awcnt mobcnt _container _appointment" style="display:block;"><!-- Rendered in 007 ms --><label id="agenda_scx-d5-_appointment1-_label1" class="label awlbl moblbl _label" style="text-align:center;background:transparent;color:#0000FF;cursor:pointer;width:131px;height:59px;display:block;font:16pt \'Trebuchet MS\';left:-8px;top:1px;">Venerdì</label><!-- agenda_scx-d5-_appointment1 --></div>'); $('agenda_scx-d6').update('<!-- Rendered in 016 ms --><!-- Rendered in 015 ms --><div id="agenda_scx-d6-_appointment1" class="container awcnt mobcnt _container _appointment" style="display:block;"><!-- Rendered in 007 ms --><label id="agenda_scx-d6-_appointment1-_label1" class="label awlbl moblbl _label" style="text-align:center;background:transparent;color:#0000FF;cursor:pointer;width:131px;height:59px;display:block;font:16pt \'Trebuchet MS\';left:-8px;top:1px;">Sabato</label><!-- agenda_scx-d6-_appointment1 --></div>'); $('agenda_scx-d7').update('<!-- Rendered in 017 ms --><!-- Rendered in 015 ms --><div id="agenda_scx-d7-_appointment1" class="container awcnt mobcnt _container _appointment" style="display:block;"><!-- Rendered in 007 ms --><label id="agenda_scx-d7-_appointment1-_label1" class="label awlbl moblbl _label" style="text-align:center;background:transparent;color:#0000FF;cursor:pointer;width:131px;height:59px;display:block;font:16pt \'Trebuchet MS\';left:-8px;top:1px;">Domenica</label><!-- agenda_scx-d7-_appointment1 --></div>'); var oForm = $('agenda_scx'); if(oForm && oForm.oWindow) oForm.oWindow.setTitle(oForm.oWindow.getTitle().sub(/ - <a title=.+/i, '') + '&nbsp;- <a title="In case of trouble, click to send a support request by email FoxInCloud App" href="mailto:FoxInCloud App Admin<appAdmin@yourDomain.com>?subject=FoxInCloud App - trouble with form agenda_scx at Server: 09:02:19 PM">Server: 09:02:19 PM&nbsp;<img src="Images/email_error.png" style="vertical-align:text-top;" /></a>'); 3OS0MM1B6 0.013 1.265 0.5347
FTP Passive Transfers
Our client has recently changed the network location of their servers to within their major firewall. We’re having some problems getting our FTP transfers to work.
I’ve modified the code to enable Passive FTP by setting the lPassiveFTP attribute on the FTP object. I’ve modified one of our applications to run an FTP upload with much more logging enabled. I’ve attached a few examples below to show the sort of things that I’ve thought of and tried.
Our application generates the output files that are to be transferred, so we’ve been able to transfer them to the remote FTP servers directly from the machine where we run our application using an ftp:// URL in Windows Explorer. It doesn’t work using the FTP client from the command line, which doesn’t support Passive mode. We’re running on Windows Server 2003 R2 SP1 (as a virtual machine) which has a direct outgoing FTP firewall rule, so no proxy server is required. Internet Explorer is configured to make only direct connections (and the proxy server would require a username/password). What all that waffle boils down to is that the FTP transfers do work, just not using our utility.
Latest build, run on-site:
<samp>
FTP via West Wind Web Connection 5.51
Connecting to janus.cnetdata.com as C04156
FTP Passive mode is On
Proxy Server is disabled
Connection Type : Direct
Connection Timeout : 25
Current folder : /
Changing current folder to Upload\
FTP Remote Folder change : Successful
Current folder : /Upload
Binary transfer is On
Failed to transfer D:\MFC04156.766 to Upload\, Error Code : 12002
FTP Message : The operation timed out
</samp>
This version of the application connects to the remote FTP server, checks a few of the setup properties, attempts to reset the lPassiveFTP property, set the remote directory and then uses FTPSendFileEx() to put the file on the remote server. Below I’ve also included a log file showing a successful transfer (on our test server) and the basic code (although you’ll just have to guess about some of the extra function calls). We’ve tried turning Passive mode off and it didn’t improve matters (I just wanted to make sure I hadn’t stuffed up the logic). Originally I was simply using FTPPutFile() but that didn’t work any better.
Latest build, run on test system:
<samp>
01/02/13 16:47:28 FTP via West Wind Web Connection 5.51
01/02/13 16:47:28 Connecting to qttest.ntl.quids.com.au as Quids\Web_Console
01/02/13 16:47:34 FTP Passive mode is On
01/02/13 16:47:34 Proxy Server is disabled
01/02/13 16:47:34 Connection Type : Direct
01/02/13 16:47:34 Connection Timeout : 25
01/02/13 16:47:34 Current folder : /
01/02/13 16:47:34 Changing current folder to incoming\
01/02/13 16:47:34 FTP Remote Folder change : Successful
01/02/13 16:47:34 Current folder : /incoming
01/02/13 16:47:34 Binary transfer is On
01/02/13 16:47:35 Uploaded 4096 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 8192 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 12288 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 16384 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 20480 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 24576 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 28672 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 32768 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 36864 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 40960 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 45056 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 49152 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 53248 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 57344 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 61440 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 65536 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 69632 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 73114 bytes of 73114 bytes
01/02/13 16:47:35 Uploaded 0 bytes of 73114 bytes
01/02/13 16:47:35 Transferred r:\dilbert\173028.strip.print.gif to incoming\
</samp>
Main Code :
defineclass FTPAction as action_q of ds_action.prg nResult= 0function process () as integer*: Overwritten to allow a numeric result to be passed backlocal nResult, cFileList, ii, oFTP, cFile, nFiles, lConnected, ; cFTPServer, cFTPUser, cFTPPwd, cFTPRemoteDir, nFileResult nResult= 0 lConnected= .f. oFTP= newoFTP() withthis .cStatus = "FTP via West Wind Web Connection " + transform(oFTP.cVersion)* Find the files to send cFileList= .Args("Files")* First check that each file exists nFiles= iif(empty(m.cFileList), 0, getwordcount(m.cFileList, ","))if m.nFiles = 0 .cStatus= "No files specified in FILES parameter" nResult= 1elsefor ii= 1 to m.nFiles cFile= alltrim(getwordnum(m.cFileList, m.ii, ","))if ! file(m.cFile) .cStatus= "Cannot locate file " + ltrim(str(m.ii)) + " <" + m.cFile + ">" nResult= 1endifendforendifif m.nResult = 0* Ok, all the files exist. Connect to the remote FTP server. cFTPServer= .Args("Server")ifempty(m.cFTPServer) cFTPServer= oG.iniRead("FTP Server")endif cFTPUser= .Args("Username")ifempty(m.cFTPUser) cFTPUser= oG.iniRead("FTP Username")endif cFTPPwd= .Args("Password")ifempty(m.cFTPPwd) cFTPPwd= oG.iniRead("FTP Password")endif cFTPRemoteDir= addbs(.Args("RemoteDir")) oFTP.cErrorMsg= "" .cStatus= "Connecting to " + m.cFTPServer + " as " + m.cFTPUser nResult= oFTP.ftpconnect(m.cFTPServer, m.cFTPUser, m.cFTPPwd)if m.nResult # 0 .cStatus= "Could not connect to server " + m.cServer ; + ", Error Code : " + ltrim(str(m.nResult))else lConnected= .t. .cStatus= "FTP Passive mode is " + iif(oFTP.lPassiveFtp, "On", "Off")if oFTP.lPassiveFtp* jic the connection has to be open first oFTP.lPassiveFtp= .t.endififempty(oFTP.cHTTPProxyName) .cStatus= "Proxy Server is disabled"else .cStatus= "Proxy Server is set to <" + oFTP.cHTTPProxyName + ">" .cStatus= "Proxy Username is set to <" + oFTP.cHTTPProxyUsername + ">"endif .cStatus= "Connection Type : " + icase(oFTP.nHTTPConnectType = 0, "IE Settings", ; oFTP.nHTTPConnectType = 1, "Direct", "Proxy") .cStatus= "Connection Timeout : " + ltrim(str(oFTP.nConnectTimeout))endifif !empty(oFTP.cErrorMsg) .cStatus= "FTP Message : " + oFTP.cErrorMsgendifendifif m.nResult = 0 .cStatus= "Current folder : " + oFTP.FTPGetCurrDir() .cStatus= "Changing current folder to " + m.cFTPRemoteDir .cStatus= "FTP Remote Folder change : " + iif(oFTP.FTPSetCurrDir(m.cFTPRemoteDir), "Successful", "Failed") .cStatus= "Current folder : " + oFTP.FTPGetCurrDir() .cStatus= "Binary transfer is " + iif(oFTP.nFTPBinary = 1, "On", "Off")bindevent(oFTP, "OnFTPBufferUpdate", this, "OnFTPBufferUpdate", 1)for ii= 1 to m.nFiles cFile= alltrim(getwordnum(m.cFileList, m.ii, ",")) oFTP.cErrorMsg= "" nFileResult= oFTP.FTPSendFileEx(m.cFile, justfname(m.cFile))if m.nFileResult = 0 .cStatus= "Transferred " + m.cFile + " to " + m.cFTPRemoteDirelse .cStatus= "Failed to transfer " + m.cFile + " to " + m.cFTPRemoteDir ; + ", Error Code : " + ltrim(str(m.nFileResult))* Returns the first non-zero error code - that's where the rot starts! nResult= evl(m.nResult, m.nFileResult)endifif !empty(oFTP.cErrorMsg) .cStatus= "FTP Message : " + oFTP.cErrorMsgendifendforendifif m.lConnected oFTP.ftpclose()endifendwithreturn m.nResultendfunc&& process()procedure OnFTPBufferUpdate (lnbytesdownloaded,lnbufferreads,lccurrentchunk, lnTotalBytes)withthis .cStatus= "Uploaded " + ltrim(str(m.lnbytesdownloaded)) + " bytes of " + ltrim(str(lnTotalBytes)) + " bytes"endwithendproc&& OnFTPBufferUpdate()enddefine
Do you have any suggestions? Are there any other utilities that I can use to check why it isn’t working? Do I need to wait until the connection is open to set the value of lPassiveFTP? As I said, I’ve tried resetting it once the connection is open but I am actually setting it in the init() of the FTP object already. Does it need to change from .f. to .t.? I’m clutching at straws there I think but I’ve run out of ideas. We run numerous FTP transfers to a variety of other businesses and none of them are working. We have monitored the other end of the transfers and the remote file is initially created (0 bytes) but no data seems to actually be transferred.
Hoping you have more idea than I do. Thanks,
Rob Spencer
Re: New problem with containers
Can you make sure of this?
ThisForm.D?.wlContentDynamic = .T. && at design time
Thanks,
Thierry Nivelet (FoxInCloud)
Never explain, never complain (Queen Elizabeth II)
Re: Screen with Modal form
Could you please try to add this in xxx.css:
#overlay_modal {height:100%!important;}
Thanks,
Thierry Nivelet (FoxInCloud)
Never explain, never complain (Queen Elizabeth II)
Re: FTP Passive Transfers
Error 12002 is a WinInet timeout error. I'm not sure what would cause that exactly since it appears (from the logs you sent) that the upload is proceeding properly, but the final save of the data seems to fail.
Is it possible there's a permissions problem on the server that doesn't allow the final file to be written? Are you logging in properly to access the upload folder and does that folder have write permissions to accept files? Does the file you're writing to exist on the server already - if so maybe delete it first with FTP commands.
My guess it's permissions of some sort...
You can also try using FtpSendFileEx2() with the same signature - it uses another, simpler WinInet API to send the file, which sometimes produces different behavior. In Help Builder's FTP upload which can send thousands of files that's what I use and it works well.
If you still have problems I suggest you use a simpler repro scenario. Just create a simple step by step program that configures the FTP connection and sends a single (or two files) to see whether you can connect and upload a file. It'll be easier to debug and trace than the full app code you posted.
Note there's not a lot of debugging that can be done of the WinInet connection. FtpConnect() doesn't actually connect - the connection doesn't occur until you perform a task (like sending a file or changing a directory) that uses the connection.
+++ Rick ----