[rules-users] guvnor restful api problem

gcautiero gianfranco.cautiero at truvo.com
Tue Nov 29 05:53:29 EST 2011


Hello to everyone,

i'm trying to upload a .drl file using  guvnor's restFul service. But im not
able to get a POST call working.

what i'm trying to do is:

make a call first to get a content of .drl file already stored in Guvnon: 

here the working code using cxf client (as the example in the guvnor doc):

WebClient c = WebClient.create("http://127.0.0.1:8081/");
String authorizationHeader = "Basic " +
org.apache.cxf.common.util.Base64Utility.encode("guest:".getBytes());
c.header("Authorization", authorizationHeader);
String content =
c.path("http://localhost:8081/guvnor-5.3.0.Final-tomcat-6.0/org.drools.guvnor.Guvnor/api/packages/com.truvo.price/PRICERULE").accept("text/plain").get(String.class);

then i try to upload the content in another asset 
Here the code that DOSEN'T work:

Response response =
client.path("http://localhost:8081/guvnor-5.3.0.Final-tomcat-6.0/org.drools.guvnor.Guvnor/api/packages/com.truvo.price/price/").accept("application/xml").post(content);

for this call i get the following error:


Nov 29, 2011 11:23:12 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet RestAPIServlet threw exception
java.lang.ArrayIndexOutOfBoundsException: 1
	at org.drools.repository.remoteapi.RestAPI.post(RestAPI.java:235)
	at
org.drools.guvnor.server.files.RestAPIServlet$1.execute(RestAPIServlet.java:56)
	at
org.drools.guvnor.server.files.RepositoryServlet.doAuthorizedAction(RepositoryServlet.java:75)
	at
org.drools.guvnor.server.files.RestAPIServlet.doPost(RestAPIServlet.java:49)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
	at
org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:65)
	at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
	at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
	at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
	at java.lang.Thread.run(Thread.java:662)


someone have a suggestion? or a working example?

tnx

Gianfranco



--
View this message in context: http://drools.46999.n3.nabble.com/guvnor-restful-api-problem-tp3544799p3544799.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list