File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Uncaught SyntaxError: Unexpected token < when calling java SOAP webservice

 
Hari Phaneendra
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hari,

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

 
Hari Phaneendra
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raphael,

I am still looking for a solution to this. I had no luck so far
 
H Paul
Ranch Hand
Posts: 471
4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic