aspose file tools*
The moose likes Web Services and the fly likes Uncaught SyntaxError: Unexpected token < when calling java SOAP webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Uncaught SyntaxError: Unexpected token < when calling java SOAP webservice" Watch "Uncaught SyntaxError: Unexpected token < when calling java SOAP webservice" New topic
Author

Uncaught SyntaxError: Unexpected token < when calling java SOAP webservice

Hari Phaneendra
Greenhorn

Joined: Nov 04, 2011
Posts: 2
Hi,

I am seriously stuck with this. I have created a webservice in Java and I am trying to use the response of the webservice in an html page. So I am using ajax call to the webservice and I get the error:

Resource interpreted as Other but transferred with MIME type undefined.
inputArrf:1Uncaught SyntaxError: Unexpected token <

The xml response from the webservice is:
<ns:inputArrfResponse xmlns:ns="http://wkr"><ns:return>hello</ns:return></ns:inputArrfResponse>

The soap client:
<html>
<body>
<script language="javascript" src="jquery-1.7.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){

$.ajax({
type:'POST',
url: 'http://localhost:8080/WekaRaytheon/services/callClassifier/inputArrf',
data: "buf:hari",
dataType: 'jsonp',
processData: false,
contentType: 'application/json',
jsonpCallback: 'jsonpCallback',
success: callback,
error: function(){
alert("failed");
}
});

});

function callback(data){
alert(data);
$('#jsonpResult').text(data.message);
}
</script>
</body>
</html>


The above error is on chrome.I get a different error when i use firefox:
XML can't be the whole program.

Can someone please help me on resolving this. I have tried all possible ways suggest on google and this didnt work.
Raphael Okochu
Greenhorn

Joined: Jul 17, 2009
Posts: 22
Hi Hari,

I have the exact same problem. have you been able to fix it?


SCJP 5
Hari Phaneendra
Greenhorn

Joined: Nov 04, 2011
Posts: 2
Hi Raphael,

I am still looking for a solution to this. I had no luck so far
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 460
    
    4
1. Google for how to use SOAP UI or TCPMon to see the request sent and the response recieved from the server.

and http headers like content type.

2. If I read your ajax client correctly:

SOAP-based web service returned xml format where as your client json format.

Either change your's client to expect xml format OR Write your web service using Rest style and return data in json format.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Uncaught SyntaxError: Unexpected token < when calling java SOAP webservice