Hi All i am working on spring3.0 restful webservice.i am able to invoke my method when i am calling the method from the same server(i.e my weblogic server).but if i want to consume\hit the same method from another server(i.e my jboss server) then it is not hitting my rest method which is on weblogic server.
in the below code if this code i am writing in weblogic jsp page and calling it is returnig me correct value and i can display the same on my web page.but if i am copying the same code to jsp in JBOSS server(my different project to access my rest service) then it is not hitting my method. ---------------------------------------
$.ajax({
url: "http://test.abc.org:7001/SpringRestService/restful/products/ALL/ALL/ALL/ALL.json",
type: "GET",
processdata: true,
dataType: "json",
contentType: "application/json;",
beforeSend: function () { },
headers :
{
"Content-Type" : "application/json",
"Accept" : "application/json",
"Access-Control-Allow-Origin":"http://its-ims002.neahq.nearoot.org:7001/"
},
success: function (data)
{
bindEvent.loadGridData(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown)
{
try
{
alert(JSON.stringify(XMLHttpRequest) + "\n" + textStatus + "\n" + errorThrown);
}
catch (ex) { alert("Exception occured.. "); }
finally { }
}
});
below is my java code which i have kept in my weblogic server and this i have to hit from jboss server using my ajax call.
---------------------------------
@Controller
public class HelloWorldController1 {
@RequestMapping(value = "/products/{userName}/{year}/{status}/{stateId}", method = RequestMethod.GET,consumes="application/text")
public ModelAndView getTextFromURL(@PathVariable("userName") String userName, @PathVariable("year") String year,
@PathVariable("status") String status, @PathVariable("stateId") String stateId) {
List<Abc> list= new ArrayList<Abc>();
list= service.products(userName, year, status, stateId);
ProductList productList = new ProductList (list);
ModelAndView mav = new ModelAndView();
mav.setViewName("index1");
mav.addObject("list", productList );
return mav;
}
}