Using IBM MobileFirst 7.1
I have created a very simple hybrid project. Then added a very simple java adapter:
@Path("/hello")
public class BrokenAdapterResource {
@GET
@Produces("text/plain")
public String hello() {
return "Hope keeps man alive....!";
}
}
and also created a MobileFirst environment: "Desktop Browser web page". I try to call the adapter. When I call it from the "common" it works as expected. However when I call it from "desktop" it does not work:
var resourceRequest = new WLResourceRequest(
"/adapters/BrokenAdapter/hello",
WLResourceRequest.GET);
resourceRequest.send().then(
function(result){
var data = JSON.parse(JSON.stringify(result))
var message = data['responseText']
$("#message").text(message) //Set the value in message div tag
},
function(error){
$("#message").text(JSON.stringify(error))
}
);
In "common" I get the expected: Hope keeps man alive....!
.
In the "desktop" I always get {"status":200,"responseHeaders":{},"responseText":"undefined","errorCode":"API_INVOCATION_FAILURE","errorMsg":"Unsupported environment","invocationContext":null}
I wonder what if wrong in this case? Is this the right way to call resources?
I have created a sample project that shows this thing https://hub.jazz.net/project/ignacio4d/BrokenProject/overview