Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ajax Programming

SOAP XMLHTTPRequest problem in Firefox : System.Web.Services.Protocols. SoapException............


Hi

I have created one application which is calling web service [Written
C# & ASP.Net]  by XMLHttpRequest or Microsoft.XMLHTTP [In case of IE].

Following is the code which works fine with IE 6 but when i am
browsing the same page on
Firefox it is giving following error.
"System.Web.Services.Protocols.SoapException.Server was unable to
process request.---> the root element is missing."

function loadXMLDoc(url) {
     if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("POST", url, true);
        req.send(null);
    } else if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            var url1="<?xml version='1.0' encoding='utf-8'?

><soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-

instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>"+
                "<soap12:Body><HelloWorld xmlns='http://
tempuri.org/'>"+
                    "<name>hellohello</name>"+
                    "</HelloWorld>"+
                    "</soap12:Body></soap12:Envelope>";
            req.open("POST", url, true);
            req.setRequestHeader("Man", "HTTP/1.1 200 OK");
            req.setRequestHeader("Host", "localhost:8919");
            req.setRequestHeader("Content-Type", "application/soap
+xml; charset=utf-8");
            req.setRequestHeader("Content-Length", url1.length );
            req.setRequestHeader("SOAPAction", "http://tempuri.org/
HelloWorld");
            req.send(url1);
        }
    }

}

function processReqChange()
{   if(req.status==200)
        {
    alert(req.responseText); //This is the line where error is coming.
        }

}

Can any answer why it dosent work in FireFox and it works fine in IE

------
Hitendra Patel

On Jan 31, 2:23 pm, "Hiten" <hitendr@gmail.com> wrote:

> Can any answer why it dosent work in FireFox and it works fine in IE

Do not know exactly why but you can try to sniff HTTP requests using
software like Ethereal and compare what IE sends and what FF sends.

-----------------------------------------------Reply-----------------------------------------------

try chaning the content type to just text xml
xmlhttp.setRequestHeader('Content-Type', 'text/xml');

Eric

On 2/1/07, AlexVN <alexander.netkac@gmail.com> wrote:

Hi

I have created one application which is calling web service [Written
C# & ASP.Net]  by XMLHttpRequest or Microsoft.XMLHTTP [In case of IE].

Following is the code which works fine with IE 6 but when i am
browsing the same page on
Firefox it is giving following error.
"System.Web.Services.Protocols.SoapException.Server was unable to
process request.---> the root element is missing."

function loadXMLDoc(url) {
     if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("POST", url, true);
        req.send(null);
    } else if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            var url1="<?xml version='1.0' encoding='utf-8'?

><soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-

instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>"+
                "<soap12:Body><HelloWorld xmlns='http://
tempuri.org/'>"+
                    "<name>hellohello</name>"+
                    "</HelloWorld>"+
                    "</soap12:Body></soap12:Envelope>";
            req.open("POST", url, true);
            req.setRequestHeader("Man", "HTTP/1.1 200 OK");
            req.setRequestHeader("Host", "localhost:8919");
            req.setRequestHeader("Content-Type", "application/soap
+xml; charset=utf-8");
            req.setRequestHeader("Content-Length", url1.length );
            req.setRequestHeader("SOAPAction", "http://tempuri.org/
HelloWorld");
            req.send(url1);
        }
    }

}

function processReqChange()
{   if(req.status==200)
        {
    alert(req.responseText); //This is the line where error is coming.
        }

}

Can any answer why it dosent work in FireFox and it works fine in IE

------
Hitendra Patel

-----------------------------------------------Reply-----------------------------------------------

If you need a working SOAP client layer for JavaScript have a look at
http://www.mathertel.de/AJAXEngine/.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc