I use Drool Guvnor version 5.2.0.BRMS. I try to updating my Web decision table with Rest API from user guide <a href="http://docs.jboss.org/drools/release/5.3.0.Final/drools-guvnor-docs/html/ch09.html#d0e2735">http://docs.jboss.org/drools/release/5.3.0.Final/drools-guvnor-docs/html/ch09.html#d0e2735</a><br>
<br><u>This my source code:</u><br><br><i>package com.sample;<br><br>import java.math.BigDecimal;<br>import java.util.ArrayList;<br>import java.util.List;<br><br>import javax.ws.rs.core.Response;<br><br>import org.apache.cxf.jaxrs.client.WebClient;<br>
import org.drools.ide.common.client.modeldriven.dt52.DTCellValue52;<br>import org.drools.ide.common.client.modeldriven.dt52.GuidedDecisionTable52;<br>import org.drools.ide.common.server.util.GuidedDTXMLPersistence;<br><br>
public class Update {<br> public static void main(String args[]){<br> WebClient client = WebClient.create("<a href="http://127.0.0.1:8081/">http://127.0.0.1:8081/</a>");<br> String authorizationHeader = "Basic " + org.apache.cxf.common.util.Base64Utility.encode("admin:admin".getBytes());<br>
client.header("Authorization", authorizationHeader);<br> String content=client.path("jboss-brms/rest/packages/mortgages/assets/Pricing%20loans/source").accept("text/plain").get(String.class);<br>
//List<DTCellValue52> lData = new ArrayList<DTCellValue52>();<br> List<List<DTCellValue52>> llData = new ArrayList<List<DTCellValue52>>(); <br> System.out.println(content);<br>
GuidedDecisionTable52 dt = GuidedDTXMLPersistence.getInstance().unmarshal(content);<br> //llData = dt.getData();<br> String oldContent = GuidedDTXMLPersistence.getInstance().marshal(dt);<br> System.out.println("Original : \n============\n"+oldContent);<br>
llData = dt.getData();<br> System.out.println("Numeric List idx-1 data-0 = "+llData.get(1).get(2).getNumericValue()); <br> <b style="color:rgb(0,0,153)">llData.get(1).get(2).setNumericValue(new BigDecimal(5000));</b><br>
<br><br> dt.setData(llData);<br> String newContent = GuidedDTXMLPersistence.getInstance().marshal(dt);<br> System.out.println("Become : \n============\n"+newContent);<br> <br>
WebClient client2 = WebClient.create("<a href="http://127.0.0.1:8081/">http://127.0.0.1:8081/</a>");<br> client2.header("Authorization", authorizationHeader);<br> Response response= client2.path("jboss-brms/rest/packages/mortgages/assets/Pricing%20loans/source").accept("text/xml").put(newContent);<br>
System.out.println("succeed");<br> System.out.println(response.getMetadata());<br> }<br>}</i><br><br><br>I just try to set new value with 5000.<br>This code doesn't retrieve error, but the result is not true. My "Pricing loan" asset still not updated with new set value.<br>
<br>Anyone can help? <br clear="all"><br><br><br>Best Regards.<br>