- Posts: 15
[solved] Received empty response from Moodle
- rob kuhlig
- Topic Author
- Offline
- New Member
-
Less
More
12 years 1 week ago - 11 years 11 months ago #1
by rob kuhlig
[solved] Received empty response from Moodle was created by rob kuhlig
hello
I need some help
Both are running on the same machine. NO firewall NO mod-Security
test.mitsm.de/component/joomdle?task=ws.server&format=xmlrpc
returns XML-RPC Error (1): Access Denied178.26.XX:XX
But I still have the "Received empty response from Moodle" error
Can somebody help me?
Thanks in advanced
rob
I need some help
- my Jommla (version 3.2) is installed "in" test.mitsm.de
- my moodle is installed in Website-URL moodle.mitsm.de
- Moodle-Version 2013111801.03
- Moodle-Release 2.6.1+ (Build: 20140123)
- joomdle version is 0.95
Both are running on the same machine. NO firewall NO mod-Security
- Webservices is ON - enablewebservices
- Moodle Networking is ON
- Moodle trusted XML-RPC is set to 87.106.93.239/32 AND 127.0.0.1/32
- allow_url_fopen = On
- Joomdle auth plugin in Moodle Admin is on
- Joomla URL in Joomdle auth plugin configuration
- Script test.mitsm.de/moodle_test.php is working fine
Code:
<?php
echo file_get_contents ('http://moodle.mitsm.de');
?>
But I still have the "Received empty response from Moodle" error
Can somebody help me?
Thanks in advanced
rob
Last edit: 11 years 11 months ago by rob kuhlig.
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7902
12 years 7 hours ago #2
by Antonio Durán
Replied by Antonio Durán on topic Received empty response from Moodle
How are previous checks in system check? Any errors in Joomla-Moodle or Moolde-Joomla connectivity?
Please Log in or Create an account to join the conversation.
- rob kuhlig
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 15
11 years 11 months ago #3
by rob kuhlig
Replied by rob kuhlig on topic Received empty response from Moodle
Hi
after some debugging (thanks for the reply) I was able to get it going until the "Web Services” Test reported a wrong url in the moodle config. However the url was clearly right. After some wiresharking I found out, that the problem is the encoding of the XML request.
Short version:
Change
array_push($headers,"Content-Type: text/xml”)
in auth.php call_method_curl to
array_push($headers,"Content-Type: application/x-www-form-urlencoded");
long version:
When calling
wget ' test.mitsm.de/index.php?option=com_joomd...server&format=xmlrpc ' --post-file=/tmp/payload -O -
with a payload of
<?xml version="1.0" encoding="utf8"?>
<methodCall>
<methodName>joomdle.test</methodName>
<params/>
</methodCall>
everything works fine.
When the auth plugin does the same it does not work. This is because, wget sets the content type to application/x-www-form-urlencoded, the php code sets it to text/xml.
Joomla will reply to application/x-www-form-urlencoded with the correct response, while redirecting the request using HTTP-303 when confronted with text/xml.
As if this is not entertaining enough, the file_get_content php implementation will follow that redirect, issuing a GET request (that is o.k. with the standard) which in turn lacks the POST data. CURL will not follow the redirect and return null in the xml response.
Clearly this needs serious investigation, as Joomla might have changed behaviour in a minor version, it may be a php quirk, whatever. Hence I did not submit a patch and leave this as exercise to the reader/maintainer
after some debugging (thanks for the reply) I was able to get it going until the "Web Services” Test reported a wrong url in the moodle config. However the url was clearly right. After some wiresharking I found out, that the problem is the encoding of the XML request.
Short version:
Change
array_push($headers,"Content-Type: text/xml”)
in auth.php call_method_curl to
array_push($headers,"Content-Type: application/x-www-form-urlencoded");
long version:
When calling
wget ' test.mitsm.de/index.php?option=com_joomd...server&format=xmlrpc ' --post-file=/tmp/payload -O -
with a payload of
<?xml version="1.0" encoding="utf8"?>
<methodCall>
<methodName>joomdle.test</methodName>
<params/>
</methodCall>
everything works fine.
When the auth plugin does the same it does not work. This is because, wget sets the content type to application/x-www-form-urlencoded, the php code sets it to text/xml.
Joomla will reply to application/x-www-form-urlencoded with the correct response, while redirecting the request using HTTP-303 when confronted with text/xml.
As if this is not entertaining enough, the file_get_content php implementation will follow that redirect, issuing a GET request (that is o.k. with the standard) which in turn lacks the POST data. CURL will not follow the redirect and return null in the xml response.
Clearly this needs serious investigation, as Joomla might have changed behaviour in a minor version, it may be a php quirk, whatever. Hence I did not submit a patch and leave this as exercise to the reader/maintainer
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7902
11 years 11 months ago #4
by Antonio Durán
Replied by Antonio Durán on topic Received empty response from Moodle
Wow, thank you very much for the detailed explanation. It is always nice to see that I am not the only one bringing up wireshark as soon as something smells fishy 
I will try to set up a new Joomla 3.2 installation, to see if I can reproduce the problem, as I have never experienced something like that in the past.
When I do some testing I will get back to you.
Thanks again!
I will try to set up a new Joomla 3.2 installation, to see if I can reproduce the problem, as I have never experienced something like that in the past.
When I do some testing I will get back to you.
Thanks again!
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7902
11 years 11 months ago #5
by Antonio Durán
Replied by Antonio Durán on topic Received empty response from Moodle
Hi again.
I am thinking this may be caused by something else, as a wget-only comparision gives the same results on my machine, with different content-type values.
wget "http://localhost/j323/index.php?option=com_joomdle&task=ws.server&format=xmlrpc" --header "Content-Type: text/xml" --post-file=/tmp/payload -O -
I set content-type in command-line to text/xml (and check that it is using it with wireshark) and I still get a good reply.
In fact I tried this with your site and I get the access denied error. If it was not working fine, I guess i should get something else.
I will try setting up a new installation with latest versions to see if I can replicate the problem.
It would be great if you could do a new installation with only joomdle installed, and test, so we could see if something else is getting in the way (some SEF extension, a security extension, redirect extension,....)
I am thinking this may be caused by something else, as a wget-only comparision gives the same results on my machine, with different content-type values.
wget "http://localhost/j323/index.php?option=com_joomdle&task=ws.server&format=xmlrpc" --header "Content-Type: text/xml" --post-file=/tmp/payload -O -
I set content-type in command-line to text/xml (and check that it is using it with wireshark) and I still get a good reply.
In fact I tried this with your site and I get the access denied error. If it was not working fine, I guess i should get something else.
I will try setting up a new installation with latest versions to see if I can replicate the problem.
It would be great if you could do a new installation with only joomdle installed, and test, so we could see if something else is getting in the way (some SEF extension, a security extension, redirect extension,....)
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7902
11 years 11 months ago #6
by Antonio Durán
Replied by Antonio Durán on topic Received empty response from Moodle
Hi Rob.
I set up a new site with latest versions, but could not reproduce your problem.
I think it could be related to something else in your setup, but I cannot be sure from here.
I set up a new site with latest versions, but could not reproduce your problem.
I think it could be related to something else in your setup, but I cannot be sure from here.
Please Log in or Create an account to join the conversation.
- rob kuhlig
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 15
11 years 11 months ago - 11 years 11 months ago #7
by rob kuhlig
Replied by rob kuhlig on topic Received empty response from Moodle
Probably solved!? But we still need some testing - Is looks like that the interaction with the JoomSEF-Component was not working.
Solution:
Change under "Components without SEF Extension installed" for "joomdle "
Changed from "Component's router" to "JoomSEF default handler " -> OK
Note:
"Default Joomla! router" is NOT working too, but
"Not using SEF " is working
Solution:
Change under "Components without SEF Extension installed" for "joomdle "
Changed from "Component's router" to "JoomSEF default handler " -> OK
Note:
"Default Joomla! router" is NOT working too, but
"Not using SEF " is working
Last edit: 11 years 11 months ago by rob kuhlig.
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7902
11 years 11 months ago #8
by Antonio Durán
Replied by Antonio Durán on topic Received empty response from Moodle
Thank you very much for the follow up. I am sure it will help others in the future.
Please Log in or Create an account to join the conversation.