473,388 Members | 1,277 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

AJAX and web service in Safari

Hello

In Safari, (cant do it in Firefox because of security restriction) I'm
trying to access a web service in another domain via

function doAjax() {
xmlhttp.open("POST",
"http://company.com.au/dir/servlet/rpcrouter",true);
xmlhttp.onreadystatechange = myreturnmethod;
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlhttp.send('input=88921');
}
and I'm getting this error back from the Web Service:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<SOAP-ENV:Body>

<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>parsing error: org.xml.sax.SAXParseException: Document
root element is missing.</faultstring>
<faultactor>/aplus2006/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Anybody can shed some light?

Thank you.

Nov 16 '06 #1
4 2522

bookmac wrote:
Hello

In Safari, (cant do it in Firefox because of security restriction) I'm
trying to access a web service in another domain via

function doAjax() {
xmlhttp.open("POST",
"http://company.com.au/dir/servlet/rpcrouter",true);
xmlhttp.onreadystatechange = myreturnmethod;
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlhttp.send('input=88921');
}
and I'm getting this error back from the Web Service:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<SOAP-ENV:Body>

<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>parsing error: org.xml.sax.SAXParseException: Document
root element is missing.</faultstring>
<faultactor>/aplus2006/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Anybody can shed some light?

Thank you.
What happens when you visit
http://company.com.au/dir/servlet/rpcrouter?input=88921 (or whatever)
in your browser? You should get a valid XML document. As it is, I
would take your SOAP message at its word here. Sounds like your
webservice is not behaving. This is most likely not at all a
JavaScript or browser-dependent problem here.

Besides, you don't want to do cross-domain web service calls anyway.
Nobody else is going to be able to use them unless (apparently) they're
also using Safari, which is like 2% of the market. Also, there are
ways around this - the standard one being, set up a proxy script on
your own server (usually only a couple of lines necessary) to fetch the
data from the remote domain and serve it to your XHR calls. There are
also techniques involving cross-domain iframes, though I understand IE7
has just killed this as a security measure. Anyway, try setting up a
small server proxy for starters and your life will be much simpler.

Good luck!

-David

Nov 16 '06 #2
ASM
bookmac a crit :
>
In Safari, (cant do it in Firefox because of security restriction) I'm
trying to access a web service in another domain via
..../...
Anybody can shed some light?
It seems to me almost clear : "root element is missing"

What make your 'myreturnmethod' function ?
--
Stephane Moriaux et son (moins) vieux Mac dj dpass
Stephane Moriaux and his (less) old Mac already out of date
Nov 16 '06 #3
I am writing an Apple Mac OS X Widget which can do cross-domain
invocations ( I believe) when its deployed as a widget after developing
it in Safari. Just in answer to your question.

David Golightly wrote:
bookmac wrote:
Hello

In Safari, (cant do it in Firefox because of security restriction) I'm
trying to access a web service in another domain via

function doAjax() {
xmlhttp.open("POST",
"http://company.com.au/dir/servlet/rpcrouter",true);
xmlhttp.onreadystatechange = myreturnmethod;
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlhttp.send('input=88921');
}
and I'm getting this error back from the Web Service:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<SOAP-ENV:Body>

<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>parsing error: org.xml.sax.SAXParseException: Document
root element is missing.</faultstring>
<faultactor>/aplus2006/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Anybody can shed some light?

Thank you.

What happens when you visit
http://company.com.au/dir/servlet/rpcrouter?input=88921 (or whatever)
in your browser? You should get a valid XML document. As it is, I
would take your SOAP message at its word here. Sounds like your
webservice is not behaving. This is most likely not at all a
JavaScript or browser-dependent problem here.

Besides, you don't want to do cross-domain web service calls anyway.
Nobody else is going to be able to use them unless (apparently) they're
also using Safari, which is like 2% of the market. Also, there are
ways around this - the standard one being, set up a proxy script on
your own server (usually only a couple of lines necessary) to fetch the
data from the remote domain and serve it to your XHR calls. There are
also techniques involving cross-domain iframes, though I understand IE7
has just killed this as a security measure. Anyway, try setting up a
small server proxy for starters and your life will be much simpler.

Good luck!

-David
Nov 16 '06 #4
bookmac <10*****@swin.edu.auwrote:
I am writing an Apple Mac OS X Widget which can do cross-domain
invocations ( I believe) when its deployed as a widget after developing
it in Safari. Just in answer to your question.
and you "believe" this is possible doing cross-domain ajax without a
proxy ?
--
Une Bvue
Nov 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: shadow.demon | last post by:
So ajax is the new black, i've had a couple ideas about how to implement it. I've alook at ajax.net and few other implementations but to me they're a bit complex. Maybe it's the way to go to have...
4
by: VK | last post by:
Google Trends is an all new service (started May 10) and I have not responsability for proper query or data accuracy. Overall seems pretty close to what could be observed by the post history in...
3
by: noballack | last post by:
I've got a problem, I'm working with Ajax in a web with a form with a list of checkbox added to the form via an Ajax.Updater method. These added checkboxs are not been sended by the form if I use...
17
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
5
gregerly
by: gregerly | last post by:
Ok, I've got an ajaxed calendar that lets users add their own events. This works great in Firefox and IE. In Safari however, i'm getting errors as the response text, instead of the success or...
2
by: ebremner | last post by:
when using safari and updating a select box with ajax, the new value appears with a black box across the new value. If I select the value then the blackbox goes away and I can see the value ...
2
by: JDeats | last post by:
>From my development envrionment (i.e. a single WinXP notebook PC) I have a basic AJAX application that is making the call to a Windows Form page that just returns the request back to the AJAX...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
7
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
我们现在遇到一个问题,通过wcf创建的webservice,选择windows service作为宿主,采用java作为客户端调用成功,但是无法使用asp.net ajax调用。...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.