I am using worklight adapter to implementing on restful web service. but i can not get any successful response.
This is my adapter:
function getTest(username,password) {
var path = "http://test.mybluemix.net";
var request = 'username='+username+'&'+'password='+password;
var input = {
method : 'get',
returnedContentType : 'plain',
path : path,
headers: {
"Host":"http://test.mybluemix.net"
},
body : {
contentType: 'text/xml; charset=UTF-8',
content: request.toString()
}
};
return WL.Server.invokeHttp(input);
}
this i got response for when i call the adapter..
response header is connection close and X-Backside-Transport is failed
normally i have to hit above the url its working fine http://test.mybluemix.net/?username=sssss&password=dffa
response : {"ID":"5","USERNAME":"sassad","PASSWORD":"adsa","ROLE":"abc","PHONENUMBER":"12345678"}
Several things look wrong to me.
The
path
variable should not point to the hostname. It's supposed to be the part afterwards:In the adapter XML file you define the protocol, host and port values.
Then you provide the path, for example:
http://myhost:8080/THE-PATH
. In this case I don't think you need it since according to your working URL example there is no actual path - there are only the parameters, the request.I'm not sure you need the
host
header. Try w/out it first...Try this. Hopefully that'll work.