Plugin Http client Error 404

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Plugin Http client Error 404

Postby JuanMartin » Thu Dec 22, 2022 8:44 pm

Hi
I think there is a problem with the http plugin
It is impossible to connect with any portal, in my case to read Prestahop portals

Whit Servoy vesrion 2022.6 works fine but with the 2022.9.2 dosen´t work

Always return error 404.

If I read the same url with Postman or with Servoy version 2022.6 and it's works fine

Thanks
Juan Antonio Martín Pinilla
Servoy 2022.9.2 - PostgreSql 9.4
software@critenerife.com
User avatar
JuanMartin
 
Posts: 169
Joined: Tue Nov 25, 2008 9:20 pm
Location: Tenerife - Spain

Re: Plugin Http client Error 404

Postby robert.edelmann » Fri Dec 23, 2022 1:55 pm

I'm using the plugin and it works for us without problems.

Can you post such a url and check if the "/" are correctly in place, that has changed, before 2022.09 you could use something like "https://forum.servoy.com//viewtopic.php?f=22&t=23677", that has changed due to an update of the http-plugin.

Postman corrects "//" automatically, so you would not notice problems there.

And you should check that you always close the http-connection after use, that gave us some problems with memory.
mit freundlichen Grüßen
Robert Stefan Edelmann
User avatar
robert.edelmann
 
Posts: 91
Joined: Wed Aug 14, 2013 6:12 pm

Re: Plugin Http client Error 404

Postby jcompagner » Fri Dec 23, 2022 2:52 pm

2022.09 we updated the whole underlying HttpClient Engine to a newer version of Apache HC
that had some side effects that some stuff did work differently now.
in the latest release that is in 2022.12.RC3 (released shortly) the things that we know of should be fixed or work the same again.

but without knowing what sites you hit with what url we can't see what is going on
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Plugin Http client Error 404

Postby JuanMartin » Fri Dec 23, 2022 7:01 pm

We use http with diferents web services and since Servoy 2022.9.2, the connection with Prestashop portals dosen´t work

It's work fine with woocommerce portals

jcompagner, send me and email for send the url of one of the our Prestashop portals

It is very urgent to solve this problem because we have several clients who have lost the connection with their Prestashop portals

Thanks
Juan Antonio Martín Pinilla
Servoy 2022.9.2 - PostgreSql 9.4
software@critenerife.com
User avatar
JuanMartin
 
Posts: 169
Joined: Tue Nov 25, 2008 9:20 pm
Location: Tenerife - Spain

Re: Plugin Http client Error 404

Postby JuanMartin » Fri Dec 23, 2022 7:29 pm

These are some result of probe with the Servoy version 22.6 and Servoy version 22.9.02 after response=getRequest.executeRequest() at the same Prestahop portal

With Servoy 22.6
response.getCharset() the result is "utf-8"
response.getResponseHeaders() the result is {Access-Time:["1671815330"],Connection:["keep-alive"],Content-Sha1:["19207521eda9cef310e5eb0d73cf10b14cf91904"],Content-Type:["text/xml;charset=utf-8"],Date:["Fri, 23 Dec 2022 17:08:50 GMT"],Execution-Time:["0.041"],Keep-Alive:["timeout=15"],PSWS-Version:["1.7.8.6"],Server:["Apache"],Transfer-Encoding:["chunked"],X-Powered-By:["PrestaShop Webservice"]}

With Servoy 22.9.2
response.getCharset() the result is "Error during evaluation:Wrapped java.lang.NullPointerException"
response.getResponseHeaders() the result is {content-length:["146"],content-type:["text/html"],date:["Fri, 23 Dec 2022 17:21:39 GMT"],server:["nginx"]}
Juan Antonio Martín Pinilla
Servoy 2022.9.2 - PostgreSql 9.4
software@critenerife.com
User avatar
JuanMartin
 
Posts: 169
Joined: Tue Nov 25, 2008 9:20 pm
Location: Tenerife - Spain

Re: Plugin Http client Error 404

Postby robert.edelmann » Sat Dec 24, 2022 2:23 pm

JuanMartin wrote:These are some result of probe with the Servoy version 22.6 and Servoy version 22.9.02 after response=getRequest.executeRequest() at the same Prestahop portal

With Servoy 22.6
response.getCharset() the result is "utf-8"
response.getResponseHeaders() the result is {Access-Time:["1671815330"],Connection:["keep-alive"],Content-Sha1:["19207521eda9cef310e5eb0d73cf10b14cf91904"],Content-Type:["text/xml;charset=utf-8"],Date:["Fri, 23 Dec 2022 17:08:50 GMT"],Execution-Time:["0.041"],Keep-Alive:["timeout=15"],PSWS-Version:["1.7.8.6"],Server:["Apache"],Transfer-Encoding:["chunked"],X-Powered-By:["PrestaShop Webservice"]}

With Servoy 22.9.2
response.getCharset() the result is "Error during evaluation:Wrapped java.lang.NullPointerException"
response.getResponseHeaders() the result is {content-length:["146"],content-type:["text/html"],date:["Fri, 23 Dec 2022 17:21:39 GMT"],server:["nginx"]}


Can you check with postman if the content-type header does include the encoding? The new version of the http-plugin is less forgiving in this regard: https://support.servoy.com/browse/SVY-17640.
mit freundlichen Grüßen
Robert Stefan Edelmann
User avatar
robert.edelmann
 
Posts: 91
Joined: Wed Aug 14, 2013 6:12 pm

Re: Plugin Http client Error 404

Postby JuanMartin » Mon Dec 26, 2022 1:20 pm

This is the process to read a category in Prestashop:

var url='https://xxxxxxxxxxxxxxx@domain/api/categories/?display=full&filter[name]=[category];
cliHttp =plugins.http.createNewHttpClient();
var getRequest = cliHttp.createGetRequest(url);
response=getRequest.executeRequest();

This works in servoy server, but in Developer always return 404 Error

This is the process to send an image:
var url = 'https://xxxxxxxxxxxxxxxx@domain/api/images/products/id_product;
cliHttp = plugins.http.createNewHttpClient();
postRequest = cliHttp.createPostRequest(url);
postRequest.addHeader('enctype', 'multipart/form-data');
postRequest.addHeader('method', 'POST');
postRequest.addParameter('Content-Type', content);
postRequest.addFile('image', tempFile);
response = postRequest.executeRequest();

This does not work neither in developer nor in server
It always returns that the image sent is not correct

Please, need fix this problem is 2022.9.2
Juan Antonio Martín Pinilla
Servoy 2022.9.2 - PostgreSql 9.4
software@critenerife.com
User avatar
JuanMartin
 
Posts: 169
Joined: Tue Nov 25, 2008 9:20 pm
Location: Tenerife - Spain

Re: Plugin Http client Error 404

Postby jcompagner » Tue Dec 27, 2022 10:46 am

do test this with viewtopic.php?f=1&t=23679

for 09 there won't be any other release

If you still have this same problem with 12 we need a case, where we can do that exact post, to see what goes wrong there.

what you also can do is add this:

<Logger name="org.apache.hc.client5.http.wire" level="DEBUG">
</Logger>

to the log4j.xml file

that will then generate a lot of httpclient traffic in the servoy_log.txt file \

And you can compare that with what postman does send
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Plugin Http client Error 404

Postby JuanMartin » Tue Dec 27, 2022 12:05 pm

I have installed 2022.12 and have the same problem

I think my only option is to downgrade to 2022.6
Juan Antonio Martín Pinilla
Servoy 2022.9.2 - PostgreSql 9.4
software@critenerife.com
User avatar
JuanMartin
 
Posts: 169
Joined: Tue Nov 25, 2008 9:20 pm
Location: Tenerife - Spain

Re: Plugin Http client Error 404

Postby jcompagner » Tue Dec 27, 2022 12:45 pm

you need to check what goes wrong.
If you are downgrading, you are stuck, 06 will never change

Did you look what the output is? did you add the logger?

My feeling is that the server can't handle chunked encoding what the http client by default does now.
(if you are sending big files)

so it could be that you really need to set the "Content-Length" now yourself.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Plugin Http client Error 404

Postby JuanMartin » Tue Dec 27, 2022 12:58 pm

I have customers stopped with this topic
I have to solve the problem urgently and the fastest way is to downgrade and then I'll start testing with 12, because it's currently a beta
Juan Antonio Martín Pinilla
Servoy 2022.9.2 - PostgreSql 9.4
software@critenerife.com
User avatar
JuanMartin
 
Posts: 169
Joined: Tue Nov 25, 2008 9:20 pm
Location: Tenerife - Spain

Re: Plugin Http client Error 404

Postby lvostinar » Wed Dec 28, 2022 5:15 pm

JuanMartin wrote:These are some result of probe with the Servoy version 22.6 and Servoy version 22.9.02 after response=getRequest.executeRequest() at the same Prestahop portal

With Servoy 22.6
response.getCharset() the result is "utf-8"
response.getResponseHeaders() the result is {Access-Time:["1671815330"],Connection:["keep-alive"],Content-Sha1:["19207521eda9cef310e5eb0d73cf10b14cf91904"],Content-Type:["text/xml;charset=utf-8"],Date:["Fri, 23 Dec 2022 17:08:50 GMT"],Execution-Time:["0.041"],Keep-Alive:["timeout=15"],PSWS-Version:["1.7.8.6"],Server:["Apache"],Transfer-Encoding:["chunked"],X-Powered-By:["PrestaShop Webservice"]}

With Servoy 22.9.2
response.getCharset() the result is "Error during evaluation:Wrapped java.lang.NullPointerException"
response.getResponseHeaders() the result is {content-length:["146"],content-type:["text/html"],date:["Fri, 23 Dec 2022 17:21:39 GMT"],server:["nginx"]}


so in 2022.9.2 you get an error message instead of actual response, but which is the error message ? so response.getResponseText() , what does it have ?
Laurian Vostinar
Servoy
lvostinar
 
Posts: 1062
Joined: Tue Feb 19, 2008 10:53 am

Re: Plugin Http client Error 404

Postby JuanMartin » Thu Dec 29, 2022 9:46 am

When I try to read a category, for example
On developer response.getResponseBody() I have:

<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<center>
<h1>404 Not Found</h1>
</center>
<hr>
<center>nginx</center>
</body>
</html>

On servoy server this works fine, only have problem with some characters like "ñ".

When I try to send an image, dosen´t work. On response.getResponseBody() I have:

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<errors>
<error>
<code>
<![CDATA[76]]>
</code>
<message>
<![CDATA[Please set an "image" parameter with image data for value]]>
</message>
</error>
</errors>
</prestashop>
Juan Antonio Martín Pinilla
Servoy 2022.9.2 - PostgreSql 9.4
software@critenerife.com
User avatar
JuanMartin
 
Posts: 169
Joined: Tue Nov 25, 2008 9:20 pm
Location: Tenerife - Spain

Re: Plugin Http client Error 404

Postby jcompagner » Thu Dec 29, 2022 10:52 am

what happens if you just do this:

Code: Select all
var url = 'https://xxxxxxxxxxxxxxxx@domain/api/images/products/id_product;
cliHttp = plugins.http.createNewHttpClient();
postRequest = cliHttp.createPostRequest(url);
postRequest.forceMultipart(true);
postRequest.addFile('image', tempFile);
response = postRequest.executeRequest();
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Plugin Http client Error 404

Postby JuanMartin » Thu Dec 29, 2022 11:12 am

The same response

<![CDATA[Please set an "image" parameter with image data for value]]>
Juan Antonio Martín Pinilla
Servoy 2022.9.2 - PostgreSql 9.4
software@critenerife.com
User avatar
JuanMartin
 
Posts: 169
Joined: Tue Nov 25, 2008 9:20 pm
Location: Tenerife - Spain

Next

Return to Programming with Servoy

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

cron