NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - patrick de laet

Pages: [1] 2
1
Web Server - Ask For Help / How to get the complete HTTP data stream?
« on: October 14, 2015, 02:46:48 AM »
(Using NetTalk 5,45 (sorry  :-[ ) is used in an old Clarion 6.3 app.)

A JSON string is passed to my NetWebpage procedure.

JSON request:

{
"Login": "xxxx",
"Password": "yyyy",
"FiliaalID": "3"
}


How do I get the JSON string?

The following does the job for an XML string:
    pweb:DataJson         = p_web.GetValue('xml')

But how to I get the JSON string?

And if not possible in 5.45, how do I get the complete HTTP stream (headers and data)?

regards

Patrick De Laet



2
(NetTalk 6 - handcoded NetWebPage procedure)

I have to return a SOAP WSDL definition to everyone who requests www.xxxxx.com?wsdl.

How do I test in my netWebpage for the presence of the ?wsdl parameter?

I tried ...

    If p_web.IfExistsValue('wsdl')
        message('yes')
    Else
        message('no')
    End      

But it doesn't work for www.xxxxx.com?wsdl

It does work for www.xxxxx.com?wsdl=1

but this is not an option.

(and going to NetTalk 8 is also not an option, because my program is still in C6)
(and going to C9 is not an option, because I don't have the time for the moment :-) )

regards

patrick de laet



3
In a WebSource procedure, I assign some value to a v:PDL variable.
(not a SESSION variable, just an ordinary, short living variable).
After this, I include some HTML with the net:f include file directive and terminate my WebSource procedure.


p_web.SetValue('PDL', 'test')

 _('<!-- Net:f:/htm/navbar.htm -->')
 _('<!-- Net:f:/htm/logon.htm -->')

RETURN ! terminates my WebSource procedure

PS: the underscore is a home written procedure and just a shortcut for a Do SendPacket.
It keeps the html that I send to the browser clean and readable in my source code.

In my logon.htm I display the v.PDL variable as follows...

<!-- Net:v:PDL -->

It does display the correct contents of my PDL variable, but am I just lucky that my calling NetwebSource hasn't terminate in the meantime and my v:PDL variable is still valid?

Or remains my NetwebSource in memory until my complete page is send to the browser?

regards

Patrick De Laet


PS: the underscore procedure ...

_    Procedure(prmString)

  Code

    packet = clip(packet) & '<13,10>' & prmString

    Do SendPacket

!---
!---
!---
    Return




4
Web Server - Ask For Help / A SendPacket for every line: is this OK?
« on: March 18, 2012, 11:24:28 AM »
Bruce,

In order to make my source a little bit readable, I created a procedure (named _ yes, underscore). Just like the "echo()" in PHP.
Why underscore? It is less "polution" in my source and makes the HTML very readable.

To send some HTML, I have the following in my source:

_('<OL>')
    _('<LI>This line one</LI>')
    _('<LI>This line two</LI>')
    _('<LI>This line three</LI>')
_('</OL>')

The procedure is as follows:
_    Procedure(prmString)
  Code
    packet = clip(packet) & '<13,10>' & prmString
    Do SendPacket
    Return

Is this good practice?
Or does frequently calling the "Do SendPacket" generates extra overhead?

regards

Patrick De Laet


5
(Using NetTalk 5.45)
I load a Javascript file via the normal <script tag in the HEAD of my page.
I'd like to replace some variables in my Javascript.
eg: to specify the open tab in my JQuery accordion.
But, apparently, my <!-- Net:v:xxxx --> tags are not parsed for my Javascript files.
Anybody an idea how to do this?

regards

Patrick De Laet


<!-- NetWebServer -->

var jQueryAccordion1Opts = {
   active: <!-- Net:v:level3 -->,
   autoHeight:   true,
   clearStyle: false,
   event: 'click',
   animated: 'slide',
   header: 'h3',
   fillSpace: false,
   navigation: false
};

6
(Nettalk 5.45.)
I have problems with French characters (like "bébé" or "garçon").
A GET of a normal HTML page works OK.
But my Ajax calls translate the é, ç, ... to some weird characters.
When I change NetWeb.clw as follows, it works.
But of course, I don't want to change the NetWeb.clw source.
I tried several overrides in several embeds (eg CreateHeader, ParseHTML, ...), no result.

Anybody an idea.

ParseHTML

  If self.RequestAjax = 1
    self.ReplyContentType = 'text/xml; charset=iso-8859-1'
    ! this was the original ==> - self.ReplyContentType = 'text/xml'
  end

regards

Patrick De Laet

7
Another problem with Cookies.
I use a lot of AJAX POSTs.
In the ProcessRequest method, it is stated that AJAX needs a Cookie . . .
  ! Ajax requests must have a session ID set in a cookie, otherwise nothing is returned
  ! This is to prevent Javascript hacking as per http://www.fortifysoftware.com/advisory.jsp
  ! NOTE: NetTalk uses Rico which is not vunerable to Javascript Hacking, but
  If self.RequestAjax = 1 and self.SessionID = 0
    ! ignore ajax requests that do not include a SessionID in the cookie.
    return
  End


However, according to Wikepedia, Cookies are only be sent back to the server for the given domain and path.

When I enter my site via www.xprodin.be - a Cookie is created with path=/.
However, as I have 10000 SEO friendly pages (eg: www.xprodin.be/ladies/trousers/product1) Google has picked them up very nicely.
When I do a search in Google for "xprodin ladies trousers" it shows my page.
However, clicking to the Google URL for my page, brings me directly to www.xprodin.be/ladies/trousers/product1.
As this is the first visit to www.xprodin.be, a SetCookie is done for my new SESSIONID, BUT IN THE PATH=/ladies/trousers/.
That's why I have 5,6,7, ... SESSIONID Cookies.

However, when I go to my order page, www.xprodin.be/order and start an AJAX order request; my SESSIONID is not send to the server because of a different Cookie path.
No Cookie ==> AJAX does nothing. So my shopping cart doesn't work.
When I enter my site via www.xprodin.be - a cookie is created in the Path=/ - the same path as my order page ==> hence the SESSION ID cookie is send with the AJAX call and everything works.

My question: who is adding the page=/xxx/yyy stuff when creating my SESSIONID cookie? If all of my 10000 pages created a single cookie with path=/ - this would solve my problem.
But I can't find where to change this.

Maybe this behaviour has to do with my previous thread where SetCookie has 7 parameters in the prototype but use 8 parameters in the code?

regards

Patrick De Laet


8
My original thread is no longer readable??
I receive an empty page?

regards

Patrick De Laet

9
NetTalk 4.43.

I have problems Setting and Getting values from my SessionQueue.
When I check my cookies, I find out that I have 6,7, even 9 SESSIONID cookies for my website?
Everytime I refresh my page, I get a new SessionID.

I'm using File Name Redirection as explained in the NetTalk book.
I'm using the _SendFilemethod in the WebHandler procedure.
I only have 1 page: www.xprodin.be/index.html, but in the _SendFile embed I'll change the pagename to www.xprodin.be/trousers/ladies or www.xprodin.be/trousers/men, ...
It seems as a SessionID cookie is created for every page?

See screenshots here:
www.shopplus.be/clip12.png
www.shopplus.be/clip13.png
www.shopplus.be/clip14.png

regards

Patrick De Laet



10
Web Server - Ask For Help / HOW TO: unescape a URL part?
« on: December 07, 2011, 11:05:43 AM »
My URL contains my product categoriees in some part of the URL.
eg: http://81.83.9.39:88/nl/produkten/luchtwegen/a%C3%ABrosol/1 is in the URL but my productcategory is 'äerosol'.
In my webserver, I'll extract the productcategories from the URL in order to do a SQL SELECT * WHERE PRODUCTCATEGORIES = 'äerosol'
But this never returns any rows because my productcategory is encoded in the URL ('a%C3%ABrosol')
How do I decode 'a%C3%ABrosol' to 'äerosol'?

PS: I also have StringTheory - maybe there is a method to do it?

regards

Patrick De Laet


11
Web Server - Ask For Help / AJAX request doesn't work in Chrome
« on: June 22, 2011, 06:07:46 AM »
JQuery Form plugin
It works in FireFox but in Google Chrome my request keeps pending and I don't get any respone.
It is just a Netwebpage procedure that returns an XML response with "do sendpacket".
The XML is correct, as I can see in FireFox.
I tried async: false and async: true . . . still not working in Chrome.

      $("#form1").ajaxForm({
         url:         'doregistreren',
         type:         'get',
         data:         '{}',
         async:         false,
         target:         '#message1',
         dataType:      'xml',
         replaceTarget:   false,
         success:      showResponse,
         error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert('status:' + XMLHttpRequest.status);
            alert('responseText:' + XMLHttpRequest.responseText);
         }
      });

regards

Patrick De Laet

12
(handcoded NetWebPage)

In the Header routine the following code is what I see . . .

  p_web.ReplyContentType = 'text/html; charset=utf-8'
  p_web.ParseHTML(packet,1,0,Net:SendHeader+Net:DontCache)


But: text/xml is set in the response headers. . .

I just want to return 'OK' to the JQuery Form Plugin.
Just 2 letters 'OK' - no xml.
But it gives me the following error . . .

XML Parsing Error: syntax error Location: moz-nullprincipal:{5c54f1ad-9227-4ca9-8e06-27b87dfcb9f1} Line Number 1, Column 1:
OK
^


I think because of the text/xml in the response headers. . .

Anybody an idea?

regards

Patrick De Laet

13
Web Server - Ask For Help / Problem with international characters
« on: June 14, 2011, 05:15:26 AM »
In my HTML I have a link to "aërosol" - correctly written.
<a class="shopplus-accordion-content" href="/nl/produkten/luchtwegen/aërosol/1">Aërosol</a><br>

However, I want to split up the URL in p_web._SendFile in order to load another page as explained in the NetTalk handbook but p_FileName contains C:/web/nl/produkten/luchtwegen/aÃ<<rosol/1

I tried everything: UTF-8, ISO-xxxx, .... no solution.

Anybody an idea?
It must be NetTalk, as when I view my HTML page source, it is OK. It is just the name of the physical file in p_FileName that's wrong.

regards

Patrick De Laet




14
Web Server - Ask For Help / Error in site JavaScript - solved
« on: June 10, 2011, 03:45:29 AM »
Suddenly - after 3 days developing in the same procedure - I get above the message?
Stripped everything from my procedure - still the message ??
Installed latest version 5.27 - still the above message ??

What's going on?

Patrick De Laet

15
I have a lot of webpages, generated with a 3rd party product (Artisteer).
In the content area, I can add <!-- Net:f:xxxx.txt --> statements and they are generated by Artisteer in the resulting webpages.
That's OK.
But i'd like to insert extra <LINK>, <SCRIPT>, ... statements at the beginning and end of every <HEAD>, <BODY>, . . . in every webpage.
In which embed can I do that?

PS: I'm only using NetWebSource procedures (no NetWebPage, NetWebBrowse, ...)

I'd like to do it once for all my webpages, in the WebServer procedure.

regards

Patrick De Laet

Pages: [1] 2