Openbravo:如何使用其余 Web 服务将产品保存在数据库中?

Openbravo: How to save Product in database using rest web services?

我已经成功安装 Openbravo,现在我正在测试 web services。我已经使用 Restful Web 服务成功创建并测试了 GetProductDetails Web 服务。现在我正在数据库中保存产品。但它不起作用。下面是我保存产品的代码。

public void doPut(String path, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        // and return something...
        String returnMessage;
        try {
            final SAXReader reader = new SAXReader();
            final Document document = reader.read(request.getInputStream());
            System.out.println("##### document : "+document.asXML());
            // create a converter from xml to Openbravo business objects
            final XMLEntityConverter xec = XMLEntityConverter.newInstance();
            System.out.println("Get Client : "+OBContext.getOBContext().getCurrentClient().getName());
            xec.setClient(OBContext.getOBContext().getCurrentClient());
            System.out.println("Get Organization : "+OBContext.getOBContext().getCurrentOrganization().getName());
            xec.setOrganization(OBContext.getOBContext().getCurrentOrganization());

            // for a webservice referenced entities should not be created, see the javadoc
            // for more information
            xec.getEntityResolver().setOptionCreateReferencedIfNotFound(false);

            // process the dom4j document, does the actual conversion
            xec.process(document);

            // list the new objects (which do not yet exist in the db)
            for (BaseOBObject bob : xec.getToInsert()) {
              System.err.println("New business objects: " + bob.getIdentifier());
            }

            // list the objects which will be updated
            for (BaseOBObject bob : xec.getToUpdate()) {
              System.err.println("Updated business objects: " + bob.getIdentifier());
            }

            returnMessage = WebServiceUtil.getInstance().createResultXMLWithObjectsAndWarning(
                "Action performed successfully", "", xec.getWarningMessages(), xec.getToInsert(),
                xec.getToUpdate(), null);
            final Writer w = response.getWriter();
            w.write(returnMessage);
            w.close();
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    } 

这是我的简单产品 xml 数据。

<?xml version="1.0" encoding="UTF-8"?>
<Openbravo xmlns="http://www.openbravo.com">
<Product>
<description>Test Description</description>
<imageUrl>Test Image URL</imageUrl>
<listPrice>50</listPrice>
<name>Test Name</name>
<number>number</number>
<purchasePrice>50</purchasePrice>
</Product>
</Openbravo>

我没有收到任何异常,也没有数据保存在数据库中。这是我得到的输出

Output from Server .... 

    <?xml version="1.0" encoding="UTF-8"?>

    <ob:result xmlns:ob="http://www.openbravo.com">
      <msg>Action performed successfully</msg>
    </ob:result>

有什么问题?

我已经使用了 JSON 休息网络服务。现在已成功将产品添加到数据库中。