calatonsystems / wc-api-java

Java wrapper for WooCommerce REST API
MIT License
98 stars 77 forks source link

update method is not working in product case #28

Open rahman973 opened 4 years ago

rahman973 commented 4 years ago
Map<String, Object> productInfo = new HashMap<>();
        productInfo.put("id", t1.getId());
        productInfo.put("name", p1.getName());
        productInfo.put("regular_price", String.valueOf(price1));
        //image
        productInfo.put("sku",p1.getBarcode());
        productInfo.put("description", p1.getDescription());
        Map product=   wooCommerce.update(EndpointBaseType.PRODUCTS.getValue(),t1.getId(), productInfo);
        System.out.println(product.get("id"));

it is not working while everything in debugger is showing fine. if I sue the above same code for creating product just by changing the value from update to create and removing id from map.

the error which is being recived on post man is following

Request processing failed; nested exception is java.lang.RuntimeException:
        org.apache.http.NoHttpResponseException: appropriative-holde.000webhostapp.com:443 failed to respond</p>
    <p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.
<p><b>Root Cause</b></p>
    <pre>java.lang.RuntimeException: org.apache.http.NoHttpResponseException: appropriative-holde.000webhostapp.com:443 failed to respond
    com.icoderman.woocommerce.DefaultHttpClient.getEntityAndReleaseConnection(DefaultHttpClient.java:129)
    com.icoderman.woocommerce.DefaultHttpClient.postEntity(DefaultHttpClient.java:100)
    com.icoderman.woocommerce.DefaultHttpClient.put(DefaultHttpClient.java:76)
    com.icoderman.woocommerce.WooCommerceAPI.update(WooCommerceAPI.java:51)
    com.bmis.app.controller.WoocommerceController.updateWooProduct(WoocommerceController.java:179)
    com.bmis.app.controller.WoocommerceController.checkEitherToCreateOrUpdateProduct(WoocommerceController.java:150)
    com.bmis.app.controller.WoocommerceController.run(WoocommerceController.java:187)
    com.bmis.app.controller.WoocommerceController.getAllSettings(WoocommerceController.java:70)