Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-4875

REST API calls using MIME-type text/xml content are failing

    • Icon: Bug Bug
    • Resolution: Answered
    • Icon: Low Low
    • None
    • None
    • None
    • None

      Summary

      REST API calls using MIME-type text/xml content are failing

      Environment

      Crowd 2.10

      Steps to Reproduce

      1. Make a POST call such as the following on your Crowd instance:
        curl --header "Content-Type: text/xml" --header "Authorization: Basic Y3Jvd2Q6Y3Jvd2Q=" -X POST -d '<?xml version="1.0" encoding="UTF-8"?><password><value>crowd</value></password>' "http://localhost:8095/crowd/rest/usermanagement/1/authentication?username=admin"
        

      Expected Results

      Results are returned in formatted XML. For example, when I run the CURL command above on my Crowd 2.7.2 instance it works and returns the following:

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?><user expand="attributes" name="admin"><link href="http://localhost:8272/crowd/rest/usermanagement/1/user?username=admin" rel="self"/><first-name>admin</first-name><last-name>admin</last-name><display-name>admin admin</display-name><email>admin@admin.com</email><password><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/password?username=admin" rel="edit"/></password><key>32769:a3ca9c26-137f-4689-8e9a-1be9dd8158b9</key><active>true</active><attributes><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/attribute?username=admin" rel="self"/></attributes></user>
      

      Actual Results

      HTML error is returned:

      <html><head><title>Apache Tomcat/7.0.69 - Error report</title><style><!--H1 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY \{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P \{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A \{color : black;}A.name \{color : black;}HR \{color : #525D76;}--></style> </head><body><h1>HTTP Status 415 - Unsupported Media Type</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Unsupported Media Type</u></p><p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.69</h3></body></html>

      Workaround

      Change the command to use application/xml.

            [CWD-4875] REST API calls using MIME-type text/xml content are failing

            Monique Khairuliana (Inactive) made changes -
            Workflow Original: Simplified Crowd Development Workflow v2 - restricted [ 1764397 ] New: JAC Bug Workflow v3 [ 3365737 ]
            Status Original: Resolved [ 5 ] New: Closed [ 6 ]
            Owen made changes -
            Symptom Severity Original: Minor [ 14432 ] New: Severity 3 - Minor [ 15832 ]
            Marcin Kempa made changes -
            Resolution New: Answered [ 9 ]
            Status Original: Open [ 1 ] New: Resolved [ 5 ]
            Daniel Ponzio made changes -
            Description Original: h3. Summary
            REST API calls using MIME-type text/xml content are failing

            h3. Environment
            Crowd 2.10

            h3. Steps to Reproduce
            # Make a POST call such as the following on your Crowd instance:
            \{code}
            curl --header "Content-Type: text/xml" --header "Authorization: Basic Y3Jvd2Q6Y3Jvd2Q=" -X POST -d '<?xml version="1.0" encoding="UTF-8"?><password><value>crowd</value></password>' "http://localhost:8095/crowd/rest/usermanagement/1/authentication?username=admin"
            \{code}

            h3. Expected Results
            Results are returned in formatted XML. For example, when I run the CURL command above on my Crowd 2.7.2 instance it works and returns the following:
            \{code}
            <?xml version="1.0" encoding="UTF-8" standalone="yes"?><user expand="attributes" name="admin"><link href="http://localhost:8272/crowd/rest/usermanagement/1/user?username=admin" rel="self"/><first-name>admin</first-name><last-name>admin</last-name><display-name>admin admin</display-name><email>admin@admin.com</email><password><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/password?username=admin" rel="edit"/></password><key>32769:a3ca9c26-137f-4689-8e9a-1be9dd8158b9</key><active>true</active><attributes><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/attribute?username=admin" rel="self"/></attributes></user>
            \{code}

            h3. Actual Results
            HTML error is returned:
            \{code}
            <html><head><title>Apache Tomcat/7.0.69 - Error report</title><style><!--H1 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY \{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P \{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A \{color : black;}A.name \{color : black;}HR \{color : #525D76;}--></style> </head><body><h1>HTTP Status 415 - Unsupported Media Type</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Unsupported Media Type</u></p><p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.69</h3></body></html>
            \{code}
             
            h3.Workaround
            Change the command to use application/xml.
            New: h3. Summary
            REST API calls using MIME-type text/xml content are failing

            h3. Environment
            Crowd 2.10

            h3. Steps to Reproduce
            # Make a POST call such as the following on your Crowd instance:
            {code}
            curl --header "Content-Type: text/xml" --header "Authorization: Basic Y3Jvd2Q6Y3Jvd2Q=" -X POST -d '<?xml version="1.0" encoding="UTF-8"?><password><value>crowd</value></password>' "http://localhost:8095/crowd/rest/usermanagement/1/authentication?username=admin"
            {code}

            h3. Expected Results
            Results are returned in formatted XML. For example, when I run the CURL command above on my Crowd 2.7.2 instance it works and returns the following:
            {code}
            <?xml version="1.0" encoding="UTF-8" standalone="yes"?><user expand="attributes" name="admin"><link href="http://localhost:8272/crowd/rest/usermanagement/1/user?username=admin" rel="self"/><first-name>admin</first-name><last-name>admin</last-name><display-name>admin admin</display-name><email>admin@admin.com</email><password><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/password?username=admin" rel="edit"/></password><key>32769:a3ca9c26-137f-4689-8e9a-1be9dd8158b9</key><active>true</active><attributes><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/attribute?username=admin" rel="self"/></attributes></user>
            {code}

            h3. Actual Results
            HTML error is returned:
            {code}
            <html><head><title>Apache Tomcat/7.0.69 - Error report</title><style><!--H1 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY \{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P \{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A \{color : black;}A.name \{color : black;}HR \{color : #525D76;}--></style> </head><body><h1>HTTP Status 415 - Unsupported Media Type</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Unsupported Media Type</u></p><p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.69</h3></body></html>{code}
             
            h3.Workaround
            Change the command to use application/xml.
            Daniel Ponzio made changes -
            Description New: h3. Summary
            REST API calls using MIME-type text/xml content are failing

            h3. Environment
            Crowd 2.10

            h3. Steps to Reproduce
            # Make a POST call such as the following on your Crowd instance:
            \{code}
            curl --header "Content-Type: text/xml" --header "Authorization: Basic Y3Jvd2Q6Y3Jvd2Q=" -X POST -d '<?xml version="1.0" encoding="UTF-8"?><password><value>crowd</value></password>' "http://localhost:8095/crowd/rest/usermanagement/1/authentication?username=admin"
            \{code}

            h3. Expected Results
            Results are returned in formatted XML. For example, when I run the CURL command above on my Crowd 2.7.2 instance it works and returns the following:
            \{code}
            <?xml version="1.0" encoding="UTF-8" standalone="yes"?><user expand="attributes" name="admin"><link href="http://localhost:8272/crowd/rest/usermanagement/1/user?username=admin" rel="self"/><first-name>admin</first-name><last-name>admin</last-name><display-name>admin admin</display-name><email>admin@admin.com</email><password><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/password?username=admin" rel="edit"/></password><key>32769:a3ca9c26-137f-4689-8e9a-1be9dd8158b9</key><active>true</active><attributes><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/attribute?username=admin" rel="self"/></attributes></user>
            \{code}

            h3. Actual Results
            HTML error is returned:
            \{code}
            <html><head><title>Apache Tomcat/7.0.69 - Error report</title><style><!--H1 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY \{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P \{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A \{color : black;}A.name \{color : black;}HR \{color : #525D76;}--></style> </head><body><h1>HTTP Status 415 - Unsupported Media Type</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Unsupported Media Type</u></p><p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.69</h3></body></html>
            \{code}
             
            h3.Workaround
            Change the command to use application/xml.
            Daniel Ponzio created issue -

              Unassigned Unassigned
              dponzio Daniel Ponzio
              Affected customers:
              1 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: