JBPM REST Client 401 Error
Hello Team,
I wrote a simple webservice to retrieve all of the organizational units within business central. I have no issues recieving a response when i paste the url in the browser or in a web based REST client. However when i call the REST service from a server side code I recieve a 401 error code.
I am running business central in JBOSS EAP 6.1. Is there any extra configuration i must make within JBOSS EAP or business central?
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
public static void main(String[] args) {
try {
Client client = Client.create();
WebResource webResource = client
.resource("http://localhost:8080/business-central/rest/organizationalunits");
ClientResponse response = webResource.accept("application/json")
.get(ClientResponse.class);
if (response.getStatus() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ response.getStatus());
}
String output = response.getEntity(String.class);
System.out.println("Output from Server .... \n");
System.out.println(output);
} catch (Exception e) {
e.printStackTrace();
}
}
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
