Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0010236
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajoralways2009-08-11 12:552009-10-22 12:00
Reportersgue0065View Statuspublic 
Assigned Toiperdomo 
PriorityurgentResolutionfixedFixed in Versionpi
StatusclosedFix in branchFixed in SCM revision233482b59254
ProjectionnoneETAnoneTarget Version
OSWindowsDatabaseAnyJava version
OS VersionXPDatabase versionAnt version
Product VersionmainSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0010236: DalWebService.java

DescriptionIn the service-methods a call to

response.setHeader("Content-Encoding", "UTF-8");

is done in several places. This is wrong!

see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11 [^] [^]

The setting is used to set for example a compression scheme, but not the character-enconding. Not shure, but what you probably want to do is to set a Content-Transfer-Encoding
Steps To ReproduceCall the rest service not from a browser, but for example from Axis 2. You get an exception upon an unknown "Content-Encoding".

package de.his.appserver.ws.rm.fim;

import java.net.URLEncoder;
import java.util.Iterator;

import javax.xml.namespace.QName;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;

import de.his.core.util.junit.TestOwner;


/**
 * @author GUENTHER
 * @version $Id$
 * Testklasse für Rest-Webservices zwischen OpenBravo und H1
 */
@TestOwner(cvsLogin = "guenther#his.de")
public class OpenBravoRestTest extends junit.framework.TestCase {

    
    /**
     * Store the texts read by NavigationURL
     */
    private String snippet;

    public String searchOpenBravoEntities() {
        try {
            snippet = "";
            String epr = "http://localhost:8080/openbravo/ws/dal?l=Openbravo&p=openbravo"; [^] [^]
            
            ServiceClient client = new ServiceClient();
            Options options = new Options();
            options.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING, "UTF-8");
            options.setProperty(Constants.Configuration.ENABLE_REST, Boolean.TRUE);
            options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET);
            options.setProperty(Constants.Configuration.MESSAGE_TYPE,
                org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_TEXT_XML);
            options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Constants.VALUE_TRUE);
            options.setCallTransportCleanup(true);
            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
            options.setTo(new EndpointReference(epr));

            client.setOptions(options);
            
            //if post is through GET of HTTP
            OMElement response = client.sendReceive(null);
            generateSnippet(response);
            return snippet;

        } catch (Exception e) {
            e.printStackTrace();
            snippet = e.getMessage();
        }
        return null;
    }


    private void generateSnippet(OMElement response) {
        String title = null;

        snippet="";
        
        QName qname= new QName("entityName");
        OMElement result = null;
        //get an iterator for Result elements
        Iterator itr = response.getChildElements();
        while (itr.hasNext()) {
            result = (OMElement) itr.next();
            
            
            title=result.getAttributeValue(qname);
            
            snippet += " "+title;
            System.out.println(title);
        }
    }

    
    public void testRestCall(){
        String test=searchOpenBravoEntities();
        System.out.println(snippet);
    }
    
    
}
Proposed SolutionQuick solution is delete all calls to

response.setHeader("Content-Encoding", "UTF-8");

the bug seems to be introduced after MP1 and is in MP2. it is in the current HEAD or main. I have not tried to do a direct MP3 checkout.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0008652 closedmtaal REST web service doesn't set content type of response for DELETE of specific object 

-  Notes
(0018915)
hgbot (developer)
2009-08-11 18:24

Repository: erp/devel/pi
Changeset: 39f9c04554194f996f1f05de8a720d9ee2b4b261
Author: Iván Perdomo <ivan.perdomo <at> openbravo.com>
Date: Tue Aug 11 18:24:02 2009 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/39f9c04554194f996f1f05de8a720d9ee2b4b261 [^]

Fixes issue 10236: Removed Content-Enconding header, added the charset to the ContentType header

---
M src/org/openbravo/service/rest/DalWebService.java
---
(0018916)
iperdomo (reporter)
2009-08-11 18:26

Added charset to ContentType header [1]

[1] http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletResponse.html#setContentType%28java.lang.String%29 [^]

Iván
(0018918)
hgbot (developer)
2009-08-12 06:47

Repository: erp/devel/pi
Changeset: 6e349828535575a39bf28aace886eaf2630aac7d
Author: Iván Perdomo <ivan.perdomo <at> openbravo.com>
Date: Wed Aug 12 06:47:02 2009 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/6e349828535575a39bf28aace886eaf2630aac7d [^]

Fixes issue 10236: Changed content type from previous changeset

---
M src/org/openbravo/service/rest/DalWebService.java
---
(0018991)
sureshbabu (reporter)
2009-08-18 09:14

Not able to close this issue (informed to Lujan)
(0021321)
hgbot (developer)
2009-10-22 12:00

Repository: erp/devel/pi
Changeset: 233482b592541db0ded00ea94371d8f13285e6d9
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Oct 22 12:00:05 2009 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/233482b592541db0ded00ea94371d8f13285e6d9 [^]

Removed check on contentencoding, not relevant anymore since issue 10236 was solved

---
M src-test/org/openbravo/test/webservice/BaseWSTest.java
---

- Issue History
Date Modified Username Field Change
2009-08-11 12:55 sgue0065 New Issue
2009-08-11 12:55 sgue0065 Assigned To => rafaroda
2009-08-11 15:03 rafaroda Assigned To rafaroda => mtaal
2009-08-11 15:03 rafaroda Priority normal => urgent
2009-08-11 15:03 rafaroda Status new => scheduled
2009-08-11 15:57 shuehner Relationship added related to 0008652
2009-08-11 16:59 iperdomo Assigned To mtaal => iperdomo
2009-08-11 18:24 hgbot Checkin
2009-08-11 18:24 hgbot Note Added: 0018915
2009-08-11 18:24 hgbot Status scheduled => resolved
2009-08-11 18:24 hgbot Resolution open => fixed
2009-08-11 18:24 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/39f9c04554194f996f1f05de8a720d9ee2b4b261 [^]
2009-08-11 18:26 iperdomo Note Added: 0018916
2009-08-12 06:47 hgbot Checkin
2009-08-12 06:47 hgbot Note Added: 0018918
2009-08-12 06:47 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/pi/rev/39f9c04554194f996f1f05de8a720d9ee2b4b261 [^] => http://code.openbravo.com/erp/devel/pi/rev/6e349828535575a39bf28aace886eaf2630aac7d [^]
2009-08-18 09:14 sureshbabu Status resolved => closed
2009-08-18 09:14 sureshbabu Note Added: 0018991
2009-08-18 09:14 sureshbabu Fixed in Version => pi
2009-08-19 00:00 anonymous sf_bug_id 0 => 2839902
2009-10-22 12:00 hgbot Checkin
2009-10-22 12:00 hgbot Note Added: 0021321
2009-10-22 12:00 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/pi/rev/6e349828535575a39bf28aace886eaf2630aac7d [^] => http://code.openbravo.com/erp/devel/pi/rev/233482b592541db0ded00ea94371d8f13285e6d9 [^]


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker