Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-55028

SOAP WSDL request sends header "Content-Length: 1"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 3.1.1
    • 3.1, 3.2
    • Web Services
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MOODLE_31_STABLE
    • MDL-55028-master
    • Hide
      Setup
      1. Go to Site administration ► Plugins ► Web services ► Mobile
      2. Tick Enable web services for mobile devices.
      3. Go to Site administration ► Plugins ► Web services ► Manage protocols
      4. Enable SOAP protocol
      5. Go to Site administration ► Plugins ► Web services ► Manage tokens
      6. Add a token for the admin user.
      Normal WSDL output
      1. Run the following curl command:

        curl -G -I "http://YOURSITE/webservice/soap/server.php?wstoken=YOURTOKEN&wsdl=1"
        

      2. Take note of the value for the Content-Length header.
      3. Run the following curl command:

        curl -G "http://YOURSITE/webservice/soap/server.php?wstoken=YOURTOKEN&wsdl=1" > ~/wsdl.xml
        

      4. Run the following command

        ls -l ~/wsdl.xml
        

      5. Take note of the file's size.
        • Confirm that the file's size is the same as the value in Content-Length header.
      SOAP error
      1. Perform the tests above, but this time use an incorrect wstoken and save the xml file as wsdl_error.xml.
        • Confirm that the wsdl_error.xml's file size is the same as the value in Content-Length header.
      Show
      Setup Go to Site administration ► Plugins ► Web services ► Mobile Tick Enable web services for mobile devices . Go to Site administration ► Plugins ► Web services ► Manage protocols Enable SOAP protocol Go to Site administration ► Plugins ► Web services ► Manage tokens Add a token for the admin user. Normal WSDL output Run the following curl command: curl -G -I "http://YOURSITE/webservice/soap/server.php?wstoken=YOURTOKEN&wsdl=1" Take note of the value for the Content-Length header. Run the following curl command: curl -G "http://YOURSITE/webservice/soap/server.php?wstoken=YOURTOKEN&wsdl=1" > ~/wsdl.xml Run the following command ls -l ~/wsdl.xml Take note of the file's size. Confirm that the file's size is the same as the value in Content-Length header. SOAP error Perform the tests above, but this time use an incorrect wstoken and save the xml file as wsdl_error.xml . Confirm that the wsdl_error.xml's file size is the same as the value in Content-Length header.

      As reported in https://moodle.org/mod/forum/discuss.php?d=334991 some browsers/clients fail to read WSDL response because of the wrong header

      Content-Length: 1
      

      The easiest way to reproduce:
      1. Enable Web-services, mobile, SOAP protocol, create a token
      2. Request URL:

      $ curl -G "http://YOURSITE/webservice/soap/server.php?wstoken=YOURTOKEN&wsdl=1"
      <
       
      $ curl -G -I "http://YOURSITE/webservice/soap/server.php?wstoken=YOURTOKEN&wsdl=1"
      HTTP/1.1 200 OK
      Date: Mon, 27 Jun 2016 04:34:25 GMT
      Server: Apache/2.4.7 (Ubuntu)
      X-Powered-By: PHP/5.5.9-1ubuntu4.17
      Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0
      Expires: Thu, 01 Jan 1970 00:00:00 GMT
      Pragma: no-cache
      Accept-Ranges: none
      Content-Length: 1
      Content-Disposition: inline; filename="response.xml"
      Content-Type: application/xml; charset=utf-8
      
      

      The actual content is correct and most browsers correctly display the content.

            jpataleta Jun Pataleta
            marina Marina Glancy
            Marina Glancy Marina Glancy
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rajesh Taneja Rajesh Taneja
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.