I have seen at least 3 other unanswered posts on this topic. Does anyone make successful java API calls to the REST interface, and if so, could you please help me figure this out? Pretty please?
When making the REST call, the CPU spikes and just stays there.
I'm running the Docker images: jboss/drools-workbench-showcase and jboss/kie-server-showcase with optaplanner and jbpm disabled.
Screenshot, Code and Output below.
com.services.configuration.Relationship@44f75083
<batch-execution lookup="defaultKieSession">
<insert out-identifier="insert-identifier" return-object="true" entry-point="DEFAULT">
<com.services.configuration.Relationship>
<source__class>Server Hosting</source__class>
<source__option1>Provisioning</source__option1>
<target__class>Virtual Host</target__class>
<impact>false</impact>
</com.services.configuration.Relationship>
</insert>
<fire-all-rules out-identifier="fire-identifier"/>
</batch-execution>
{
"lookup" : "defaultKieSession",
"commands" : [ {
"insert" : {
"object" : {"com.services.configuration.Relationship":{
"source_class" : "Server Hosting",
"source_option1" : "Provisioning",
"source_option2" : null,
"source_option3" : null,
"target_class" : "Virtual Host",
"target_option1" : null,
"target_option2" : null,
"target_option3" : null,
"impact_model" : null
}},
"disconnected" : false,
"out-identifier" : "insert-identifier",
"return-object" : true,
"entry-point" : "DEFAULT"
}
}, {
"fire-all-rules" : {
"max" : -1,
"out-identifier" : "fire-identifier"
}
} ]
}
===server response====
Exception in thread "main" org.kie.remote.common.rest.KieRemoteHttpRequestException: Error occurred when trying to retrieve response code
at org.kie.remote.common.rest.KieRemoteHttpRequest.responseCode(KieRemoteHttpRequest.java:1331)
at org.kie.server.client.impl.AbstractKieServicesClientImpl.makeHttpPostRequestAndCreateServiceResponse(AbstractKieServicesClientImpl.java:244)
at org.kie.server.client.impl.AbstractKieServicesClientImpl.makeHttpPostRequestAndCreateServiceResponse(AbstractKieServicesClientImpl.java:234)
at org.kie.server.client.impl.RuleServicesClientImpl.executeCommandsWithResults(RuleServicesClientImpl.java:72)
at temp.try2(temp.java:65)
at temp.main(temp.java:19)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at org.kie.remote.common.rest.KieRemoteHttpRequest.responseCode(KieRemoteHttpRequest.java:1329)
... 6 more
I've spent two days trying this every which way and I would very much appreciate some help.
J.