kinow / testlink-java-api

TestLink Java API
http://kinow.github.io/testlink-java-api/
MIT License
64 stars 88 forks source link

Exception in thread "main" br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error verifying developer key: Failed to parse server's response: Expected methodResponse element, got br #50

Closed dipkadam closed 5 years ago

dipkadam commented 9 years ago

hi kniow I am getting Following exception

Exception in thread "main" br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error verifying developer key: Failed to parse server's response: Expected methodResponse element, got br at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:64) at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(TestLinkAPI.java:145) at com.TestLink_Common.setup_Testlink(TestLink_Common.java:33) at com.UpdateManualTestResults.main(UpdateManualTestResults.java:26) Caused by: org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: Expected methodResponse element, got br at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:188)

I am using Url; http://testlink.pearsoncmg.com/lib/api/xmlrpc.php JavaApi=testlink-java-api-1.9.8-1.jar (i tried all from testlink-java-api-1.9.6-0) My testlink version is 1.9.11

When i tried following with restapi http://testlink.pearsoncmg.com/lib/api/xmlrpc/v1/xmlrpc.php?devKey=$$$$$$$$$$$$$$$ devKey is the one generated through TestLink -> My settings

i Got the following result
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0
XML-RPC server accepts POST requests only.

Can you please suggest a solution?

kinow commented 9 years ago

Hi!

My testlink version is 1.9.11

The API releases always match the TestLink release version. However, lately I've been working on other projects and could keep up with the TestLink releases, thus there is no testlink-java-api available that will work with your TestLink version.

If you can update the Java code to match the API in 1.9.11 I'd be glad to merge a pull request and cut a release for it.

Sorry @dipkadam Bruno

madhurissanap commented 9 years ago

hello

the latest jar that i can see is 1.9.8-1 at following location in maven repository http://mvnrepository.com/artifact/br.eti.kinoshita/testlink-java-api

can you please provide the latest jar (1.9.11 ) and also could you please help us with an example in java that we shall have to update would be great.

kinow commented 9 years ago

There is no 1.9.11 at the moment.

See https://groups.google.com/forum/#!searchin/jenkinsci-dev/testlink/jenkinsci-dev/iRN3jRdlQ0E/byPDvOCltSYJ

dilhanj commented 9 years ago

Hi Kinow, I downloaded the src code of version 1.9.8-1 from your repository. Could you please let me know what/where to change in order to work with TestLink 1.9.11?

BR, Dilhan

kinow commented 9 years ago

Hi Dilhan,

Sorry, I'm not using TestLink 1.9.11, so I can't really give you detailed instructions. Take a look at the signature of the API methods, and at the Java methods. They should be identical in parameters.

You'll have to add/remove/edit parameters in existing methods, remove deprecated methods, or add new methods.

Hope that helps, Bruno

harschware commented 9 years ago

I ran into this as well, the problem isn't a mismatch between the XML-RPC and testlink-java-api, the problem is that a warning message is being emitted in the middle of the XML. As can be seen here in this output of ngrep on my server.

  HTTP/1.1 200 OK..Date: Mon, 09 Mar 2015 19:57:53 GMT..Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0j DAV/2 PHP/5.6.
  2..Content-Length: 819..Keep-Alive: timeout=5, max=100..Connection: Keep-Alive..Content-Type: text/html; charset=UTF-8....<br /
  >.<b>Deprecated</b>:  Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To av
  oid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in <b>Unknown</
  b> on line <b>0</b><br />.<br />.<b>Warning</b>:  Cannot modify header information - headers already sent in <b>Unknown</b> on 
  line <b>0</b><br />.<?xml version="1.0"?>.<methodResponse>.  <params>.    <param>.      <value>.        <array><data>.  <value>
  <struct>.  <member><name>code</name><value><int>2000</int></value></member>.  <member><name>message</name><value><string>(check
  DevKey) - Can not authenticate client: invalid developer key</string></value></member>.</struct></value>.</data></array>.      
  </value>.    </param>.  </params>.</methodResponse>.

The problem with PHP emitted the warning is documented rather well here, https://www.bram.us/2014/10/26/php-5-6-automatically-populating-http_raw_post_data-is-deprecated-and-will-be-removed-in-a-future-version/

However, I can't confirm this actually fixes the issue because when I change always_populate_raw_post_data = -1 it doesn't seem to have any effect. I am using PHP version 5.6.6 on CentOS 6.6

jcppkkk commented 9 years ago

I am using HHVM/3.6.1 + nginx/1.6.0 In my case, get the new version of XML-RPC library from http://scripts.incutio.com/xmlrpc/ . Extract lib and rename it to replace testlink/third_party/xml-rpc/class-IXR.php will fix the warning

XML-RPC server accepts POST requests only.
prathi-adeptia commented 7 years ago

Issue resolved by edit php.ini file and set always_populate_raw_post_data = -1

kinow commented 5 years ago

Thanks for reporting the fix. This issue happens quite frequently, but every time it appears to be some different environment setting that causes it :/.

Other similar issues: https://github.com/kinow/testlink-java-api/issues?utf8=%E2%9C%93&q=Error+verifying+developer+key