This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 203085 - "Test RESTful Web Services" page shows error for PUT and POST
Summary: "Test RESTful Web Services" page shows error for PUT and POST
Status: RESOLVED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: REST (show other bugs)
Version: 7.0.1
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 17:31 UTC by neil15
Modified: 2011-10-07 14:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description neil15 2011-10-04 17:31:53 UTC
I created a simple REST webservice from database table "people" table in the in the default derby (sample) database in netbeans [app on APP]

When I am trying to test POST (application/xml) method from the local html client created by netbeans with following data , I get error

<?xml version="1.0"?>
<people> 
   <city>West Bengal</city> 
   <country>India</country> 
   <dob>2009-12-01T00:00:00+05:30</dob> 
   <email>riyer@ieee.org</email> 
   <name>Ramesh Iyer</name> 
   <state>Tamil Nadu</state> 
   <uid>3000</uid> 
</people> 


Error 

POST RequestFailed RequestFailed --> Status: () 
Response: {

}

However when I do a subsequent get request , the entry is already created in the table. Hence the error message seems to be misleading.
Same happens with PUT request , data gets changed in the required field but test client's out put says that request failed which is misleading
Comment 1 Denis Anisimov 2011-10-05 06:41:47 UTC
This is not P2. Please use appropriate priority.

You description is poor.
Please describe :
- EXACT steps of you project creation.
- What database do you use ? What is the table "people" ? 
There is no any information about it. 
- How do you create RESTful WS ( exact UI steps ) ?
- What J2EE server do you use ?

Without this information I cannot identify the problem if any.
Comment 2 neil15 2011-10-05 07:11:02 UTC
Please fine the required description inline

- EXACT steps of you project creation.

1.Create a new "Web Application" project click next
2.choose glassfish server 3.1 click next
3. Click Finish

- What database do you use ? What is the table "people" ? 

1.Using the following in-built netBeans database 

jdbc:derby://localhost:1527/sample [app on APP]

You can find the the table "people" is in the app schema

- How do you create RESTful WS ( exact UI steps ) ?

1.Right click on the project node in the navigator 
2.Select "New" -> "RestFul Webservice from databse" click next
3.select data source "JDBC/sample"
4.Add people table click next
5.Give package name "entity" click next
6.click next
7. Click Finish


- What J2EE server do you use ?
I am using Glassfish server 3.1

Let me know if you need more information.
Comment 3 Denis Anisimov 2011-10-05 07:15:38 UTC
>I created a simple REST webservice from database table "people" table in the in
>the default derby (sample) database in netbeans [app on APP]
I forgot to say that I don't see "people" DB in default derby APP .
Did you create it ?(In reply to comment #2)
> Please fine the required description inline
> 
> - EXACT steps of you project creation.
> 
> 1.Create a new "Web Application" project click next
> 2.choose glassfish server 3.1 click next
> 3. Click Finish
> 
> - What database do you use ? What is the table "people" ? 
> 
> 1.Using the following in-built netBeans database 
> 
> jdbc:derby://localhost:1527/sample [app on APP]
> 
> You can find the the table "people" is in the app schema
> 
> - How do you create RESTful WS ( exact UI steps ) ?
> 
> 1.Right click on the project node in the navigator 
> 2.Select "New" -> "RestFul Webservice from databse" click next
> 3.select data source "JDBC/sample"
> 4.Add people table click next
> 5.Give package name "entity" click next
> 6.click next
> 7. Click Finish
> 
> 
> - What J2EE server do you use ?
> I am using Glassfish server 3.1
> 
> Let me know if you need more information.

Thank you for information.
I don't have "people" table in my DB schema.
Could you please try some other table for equal steps to reproduce.
In my case there are :
Customer,
DiscountCode 
Manufacturer
MicroMarket
Product
ProductCode
PurchaseOrder.

Thanks.
Comment 4 neil15 2011-10-05 07:23:52 UTC
I tried the test case on "Manufacturer" table with the following request 

Method POST(application/xml)

Content 

<?xml version="1.0"?>
       <manufacturer> 
           <addressline1>7654 1st Street</addressline1> 
           <addressline2>Suite 100</addressline2> 
           <city>Mountain View</city> 
           <email>www.google@gmail.com</email> 
           <fax>408-456-9900</fax> 
           <manufacturerId>20985678</manufacturerId> 
           <name>Google Inc</name> 
           <phone>650-456-6688</phone> 
           <rep>John Snow</rep> 
           <state>CA</state> 
           <zip>94043</zip> 
       </manufacturer> 

It Showed the same error. Should have ended up with 200 OK
Please increment the manufacturerId to see further test cases
Comment 5 Denis Anisimov 2011-10-05 07:25:12 UTC
Thank you , I will try.
Comment 6 Denis Anisimov 2011-10-05 07:54:26 UTC
The problem is very minor : probably wrong interpretation of HTTP response code.
You've wrote :
>Should have ended up with 200 OK
No it shouldn't.
Please read :
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5

The response is expected ( it actually is result of GF runtime so it is not 
even NB issue ).
Test client recognize it as error. This is probably an issue.
Comment 7 Denis Anisimov 2011-10-05 08:45:12 UTC
Error message is fixed:
web-main#c7c122458a1e
Comment 8 Quality Engineering 2011-10-06 13:54:07 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/c7c122458a1e
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#203085 - "Test RESTful Web Services" page shows error for PUT and POST
Comment 9 Quality Engineering 2011-10-07 14:39:44 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/c7c122458a1e
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#203085 - "Test RESTful Web Services" page shows error for PUT and POST