[Zoo-discuss] BufferPy problem

Farkas H farkas.dus at gmail.com
Wed Jan 30 11:47:15 PST 2013


Hi Gérald,

thank you for your response and for providing such feedback.
Any of your suggestions is working, my issue is solved.
This was a great help.

Thanks again.

Regards,
Farkas


On 22 January 2013 13:03, Gérald Fenoy <gerald.fenoy at geolabs.fr> wrote:
> Dear Farkas,
> sorry for so late answer but I was pretty sure that the solution I gave worked.
>
> Nevertheless, I took a deeper look into the code I gave to you and give it a try included in a simple HTML page. I get a similar issue than you get with the OPTION requests depending on the way I access the page which send the request.
>
> Indeed, when I accessed the page using an url containing http://127.0.0.1/ and set the request url to http://localhost/cgi-bin/zoo_loader.cgi I get a request sent using the OPTION method. Then if I accessed the page using an url containing http://localhost/ then it worked. This is similar to cross domain as 127.0.0.1 is not considered by our browser as localhost. So one simple solution to your problem is simply to replace the full URL to ZOO-Kernel by a relative one.
>
> For instance, if you used http://localhost/cgi-bin/zoo_loader.cgi then you may prefer /cgi-bin/zoo_loader.cgi this way whatever is the url you used to access the page it will work properly.
>
> You can download from here [1] the source code (including a simple WPS XML Request builder) which illustrate this and give you a simple example on how to use XML requests from JQuery using POST method.
>
> I guess that this will solve your issue.
>
> Hope to get confirmation from you that your issue was solved,
> Best regards,
>
> [1] http://zoo-project.org/dl/simple_ajax_request.zip
>
> Gérald Fenoy
> gerald.fenoy at geolabs.fr
>
>
> Le 17 janv. 2013 à 13:33, Farkas H <farkas.dus at gmail.com> a écrit :
>
>> Hi Gérald,
>>
>> I've done some additional tests.
>>
>> Http-Get requests are processed.
>> If WPS-caching is activated a cache file with the referenced data is
>> generated on the server. The content of the cache file is ok. Firebug
>> and Apache log report that a result was sent to the client. The
>> processing time is nearly the same as via curl. That's good news.
>> But the data cannot be fetched via JavaScript (status: error;
>> response: empty). That's an issue.
>> I found hints concerning the "XML Parsing Error" reported in Firebug
>> but I didn't manage to make it run.
>> Do you have any idea?
>>
>> Http-Post requests are obviously not processed. No cache file is
>> generated. The process ends after a few milliseconds, it should last
>> more time. (status: error; response: empty)
>> Do you have any idea?
>>
>> Hope to hear from you.
>>
>> Regards,
>> Farkas
>>
>>
>> ---------- Forwarded message ----------
>> From: Farkas H <farkas.dus at gmail.com>
>> Date: 16 January 2013 10:31
>> Subject: Fwd: [Zoo-discuss] BufferPy problem
>> To: OSGeo zoo-discuss OSGeo zoo-discuss <zoo-discuss at lists.osgeo.org>
>>
>>
>> Hi Gérald,
>>
>> with IE and Chrome I get the same errors.
>>
>> I've found the following.
>> Get requests are interpreted from Apache correctly in the log file.
>> The number of bytes sent int the log file is correctly, too. The
>> results of the function complete are status: error and
>> xml.responseText: empty.
>>
>> Post requests are interpreted as OPTIONS requests from Apache in the
>> log file. The number of bytes sent in the log file is too small. The
>> results of the function complete are status: error and
>> xml.responseText: empty.
>>
>> Do you have any idea?
>>
>> Hope to hear from you.
>>
>> Regards,
>> Farkas
>>
>>
>> ---------- Forwarded message ----------
>> From: Farkas H <farkas.dus at gmail.com>
>> Date: 15 January 2013 16:56
>> Subject: Re: [Zoo-discuss] BufferPy problem
>> To: OSGeo zoo-discuss OSGeo zoo-discuss <zoo-discuss at lists.osgeo.org>
>>
>>
>> Hi Gérald,
>>
>> it's strange to me, too.
>> I've seen your little typing mistake and have taken the correct variable name.
>> I don't understand why the status is OK in the apache log file.
>>
>> Could it be a browser issue?
>> I've used Firefox. I'll try IE and Chrome later and let you know.
>>
>> Regards,
>> Farkas
>>
>>
>> On 15 January 2013 16:24, Gérald Fenoy <gerald.fenoy at geolabs.fr> wrote:
>>> Hi Farkas,
>>> this sounds really strange to me as at this stage the ZOO-Kernel doesn't handle anything.
>>>
>>> I mean, the ZOO-Kernel is not the one which determine what is the request type and so on. It seems normal that the ZOO-Kernel is unable to handle the request if it was received using the OPTIONS method.
>>>
>>> I made a mistake in the .ajax call in my previous mail, I hope the issue doesn't come from this. Please check if you get "contenteType" (the error I made) or "contentType" (the proper value).
>>>
>>> Hope this helps.
>>> Best regards,
>>>
>>> Gérald Fenoy
>>> gerald.fenoy at geolabs.fr
>>>
>>>
>>> Le 14 janv. 2013 à 23:10, Farkas H <farkas.dus at gmail.com> a écrit :
>>>
>>>> Hi Gérald,
>>>>
>>>> the curl requests are working.
>>>> Even after the removal of the carriage returns from the xml file, the
>>>> result is the same.
>>>>
>>>> I've compiled the kernel using rev. 390. But I still don't get a
>>>> response if I send the http-Post request via Browser.
>>>> - status: 'error'
>>>> - xml.responseText: empty
>>>> - apache log - request method: OPTIONS
>>>> - apache log - sent bytes: 531 (curl 5539)
>>>>
>>>> There is still a problem on the kernel side.
>>>> I hope to hear from you.
>>>>
>>>> Regards,
>>>> Farkas
>>>>
>>>>
>>>> On 14 January 2013 13:53, Gérald Fenoy <gerald.fenoy at geolabs.fr> wrote:
>>>>> Farkas,
>>>>> I've committed a small change (rev. 390) which may explain why it is working from your curl request and not from a browser.
>>>>>
>>>>> Can you confirm that this rev. 390 solve your issue please ?
>>>>>
>>>>> Waiting for your answer,
>>>>> Best regards,
>>>>>
>>>>> Gérald Fenoy
>>>>> gerald.fenoy at geolabs.fr
>>>>>
>>>>>
>>>>> Le 14 janv. 2013 à 08:16, Gérald Fenoy <gerald.fenoy at geolabs.fr> a écrit :
>>>>>
>>>>>> Hi Farkas,
>>>>>> personally I think that it is a good point to get the curl request working as it means that your ZOO-Kernel is correctly working.
>>>>>>
>>>>>> I would like to make sure that you get also the XML response but as you said you get a correct response I guess it is the case.
>>>>>>
>>>>>> You said you removed the carriage returns, did you try without the carriage return with curl to make sure there is no issue on that side ?
>>>>>> I think that this should confirm or not that there is no problem on the ZOO-Kernel side but only on the way we are requesting it.
>>>>>>
>>>>>> Note that you should be able to use the $.ajax function without any issue, you should use it in the following way:
>>>>>>
>>>>>> $.ajax({
>>>>>>     type: "POST",
>>>>>>     url: "http://localhost/cgi-bin/zoo_loader.cgi",
>>>>>>     contenteType: "text/xml",
>>>>>>     data: data,
>>>>>>     complete: function(xml,status){
>>>>>>             alert(xml.reponseText);
>>>>>>     }
>>>>>> });
>>>>>>
>>>>>> This should not imply that you get OPTION request from apache error log. Please make sure you use well this Ajax request and not another one probably present in your application.
>>>>>>
>>>>>> I'm pretty sure this will work.
>>>>>>
>>>>>> Hope to hear back from you,
>>>>>> Best regards,
>>>>>>
>>>>>> Gérald Fenoy
>>>>>> gerald.fenoy at geolabs.fr
>>>>>>
>>>>>>
>>>>>> Le 13 janv. 2013 à 23:37, Farkas H <farkas.dus at gmail.com> a écrit :
>>>>>>
>>>>>>> Hi Gérald,
>>>>>>>
>>>>>>> thanks for your answer.
>>>>>>> With changeset 389 all mentioned Python requests are ok. Thank you very much.
>>>>>>>
>>>>>>>
>>>>>>> Concerning the Post request I do the following.
>>>>>>> I have a xml file containing a http-Post request [1]. I send this Post
>>>>>>> request via curl to the server and get a correct response.
>>>>>>> Please find the log file here [2] and the apache log file here [3].
>>>>>>>
>>>>>>> Than I simply assign the content of the xml file with the Post request
>>>>>>> to the data variable in the JavaScript file (I've removed the carriage
>>>>>>> returns).
>>>>>>> ...
>>>>>>> data: 'content of the xml file with the Post request from above',
>>>>>>> ...
>>>>>>>
>>>>>>> Than I send the Post request embedded in the JavaScript file to the server.
>>>>>>>
>>>>>>> The status in the apache log file is OK, 200 [4].
>>>>>>> However the request method in the apache log file is OPTIONS and the
>>>>>>> number of bytes sent to the client is less (531 vs. 1390).
>>>>>>>
>>>>>>> Do you have any idea?
>>>>>>> Hope to hear from you.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Farkas
>>>>>>>
>>>>>>>
>>>>>>> [1] ======
>>>>>>> <wps:Execute service="WPS" version="1.0.0"
>>>>>>> xmlns:wps="http://www.opengis.net/wps/1.0.0"
>>>>>>> xmlns:ows="http://www.opengis.net/ows/1.1"
>>>>>>> xmlns:xlink="http://www.w3.org/1999/xlink"
>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>> xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
>>>>>>> http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd">
>>>>>>> <ows:Identifier>BufferPy</ows:Identifier>
>>>>>>> <wps:DataInputs>
>>>>>>> <wps:Input>
>>>>>>> <ows:Identifier>InputPolygon</ows:Identifier>
>>>>>>> <ows:Title>water bodies</ows:Title>
>>>>>>> <wps:Reference xlink:href="http://demo.opengeo.org/geoserver/ows?Request=GetFeature&Service=WFS&Version=1.0.0&Typename=topp:states"/>
>>>>>>> </wps:Input>
>>>>>>> <wps:Input>
>>>>>>> <ows:Identifier>BufferDistance</ows:Identifier>
>>>>>>> <ows:Title>Emergency area.</ows:Title>
>>>>>>> <wps:Data>
>>>>>>> <wps:LiteralData>0.01</wps:LiteralData>
>>>>>>> </wps:Data>
>>>>>>> </wps:Input>
>>>>>>> </wps:DataInputs>
>>>>>>> <wps:ResponseForm>
>>>>>>> <wps:ResponseDocument storeExecuteResponse="false">
>>>>>>> <wps:Output asReference="true">
>>>>>>> <ows:Identifier>Result</ows:Identifier>
>>>>>>> </wps:Output>
>>>>>>> </wps:ResponseDocument>
>>>>>>> </wps:ResponseForm>
>>>>>>> </wps:Execute>
>>>>>>>
>>>>>>>
>>>>>>> [2]   ======
>>>>>>> * About to connect() to localhost port 80
>>>>>>> *   Trying 127.0.0.1... connected
>>>>>>> * Connected to localhost (127.0.0.1) port 80
>>>>>>>> POST /cgi-bin/zoo_loader.cgi HTTP/1.1
>>>>>>>> User-Agent: curl/7.15.1 (i386-pc-win32) libcurl/7.15.1 OpenSSL/1.0.1c zlib/1.2.3
>>>>>>>> Host: localhost
>>>>>>>> Accept: */*
>>>>>>>> content-type: text/xml
>>>>>>>> Content-Length: 1040
>>>>>>>> Expect: 100-continue
>>>>>>>>
>>>>>>> < HTTP/1.1 100 Continue
>>>>>>> HTTP/1.1 200 OK
>>>>>>> < Date: Sun, 13 Jan 2013 22:09:34 GMT
>>>>>>> < Server: Apache/2.2.14 (Win32)
>>>>>>> < Transfer-Encoding: chunked
>>>>>>> < Content-Type: text/xml; charset=UTF-8
>>>>>>> * Connection #0 to host localhost left intact
>>>>>>> * Closing connection #0
>>>>>>>
>>>>>>>
>>>>>>> [3] ======
>>>>>>> 127.0.0.1 - - [13/Jan/2013:23:09:34 +0100] "POST
>>>>>>> /cgi-bin/zoo_loader.cgi HTTP/1.1" 200 1390
>>>>>>>
>>>>>>>
>>>>>>> [4] ======
>>>>>>> 127.0.0.1 - - [13/Jan/2013:23:06:42 +0100] "OPTIONS
>>>>>>> /cgi-bin/zoo_loader.cgi HTTP/1.1" 200 531
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 13 January 2013 20:50, Gérald Fenoy <gerald.fenoy at geolabs.fr> wrote:
>>>>>>>> Hi Farkas,
>>>>>>>> I forgot to say in my previous email that using rev. 389 should solve issue using UnionPy service.
>>>>>>>>
>>>>>>>> I'm not sure to follow what happen when you use POST request. Did you try using curl tool from command line with -v option to get a verbose output ? If yes, what was the output ? I guess it would be helpful for testing your ZOO-Kernel version and make sure it can handle properly the POST requests to run curl from command line.
>>>>>>>>
>>>>>>>> Did you take a look at the Apache error log ? Maybe there is some user privileges issue due to running zoo_loader.cgi from the command line using another user (which make some files owned by this user).
>>>>>>>>
>>>>>>>> It would be helpful to get more details on what is not working what is exactly the XML request you are using to request the ZOO-Kernel.
>>>>>>>>
>>>>>>>> I hope you can provide more details.
>>>>>>>>
>>>>>>>> Waiting for your answer,
>>>>>>>> Best regards,
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Gérald Fenoy
>>>>>>>> gerald.fenoy at geolabs.fr
>>>>>>>>
>>>>>>>>
>>>>>>>> Le 13 janv. 2013 à 20:43, Farkas H <farkas.dus at gmail.com> a écrit :
>>>>>>>>
>>>>>>>>> Firebug reports that parsing the xml causes an error [2] when
>>>>>>>>> processing the JavaScript via http-Post request.
>>>>>>>>>
>>>>>>>>> Do you have any idea?
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Zoo-discuss mailing list
>>>>>>> Zoo-discuss at lists.osgeo.org
>>>>>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/zoo-discuss
>>>>>>
>>>>>> _______________________________________________
>>>>>> Zoo-discuss mailing list
>>>>>> Zoo-discuss at lists.osgeo.org
>>>>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/zoo-discuss
>>>>>
>>>> _______________________________________________
>>>> Zoo-discuss mailing list
>>>> Zoo-discuss at lists.osgeo.org
>>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/zoo-discuss
>>>
>> _______________________________________________
>> Zoo-discuss mailing list
>> Zoo-discuss at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/zoo-discuss
>


More information about the Zoo-discuss mailing list