Please find the patch, generated using diff -p -b, attached for the file
cxf-utils.js under
\trunk\rt\javascript\src\main\resources\org\apache\cxf\javascript
I have not tested it completely... just verified that it's working for
Firefox version 3.0.1 and IE 6.
Let me know in case you need any clarification.
Regards,
Harbhanu
-----Original Message-----
From: Benson Margulies [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2008 7:54 AM
To: [email protected]; [EMAIL PROTECTED]
Subject: Re: [HelloWorld JavaScript client] problem on IE.
Gosh I'd like some more details here, or even, if possible, a patch.
Even a hand-edited improved version to illustrate.
On Tue, Aug 19, 2008 at 3:08 AM, harbhanu <[EMAIL PROTECTED]> wrote:
> I am using CXF 2.1, but still I faced an issue in order to make a
successful
> invocation from JavaScript client.
>
> After some debugging I found out that the problem is with request object
> creation in function "org_apache_cxf_client_request".
>
> In my case it's failing without any proper reporting, since the exception
is
> also not caught.
>
> Now it's working for me. But I suggest we should change the XMLHttpRequest
> object creation more robust org_apache_cxf_client_request.
>
> I am not so very sure about the exact fix, but I found this link
helpful...
> http://www.brainjar.com/dhtml/ajax/
>
> Regards,
> Harbhanu
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 14, 2008 2:03 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [HelloWorld JavaScript client] problem on IE.
>
> Thanks a lot.
> My tests are ok now.
> Regards
>
> Brice Vandeputte
>
>
> -----Message d'origine-----
> De : Benson Margulies [mailto:[EMAIL PROTECTED]
> Envoyé : vendredi 11 avril 2008 20:25
> À : [EMAIL PROTECTED]
> Objet : Re: [HelloWorld JavaScript client] problem on IE.
>
> There's a new snapshot.
>
>
*** Original_cxf-utils.js Thu Apr 24 16:25:28 2008
--- Modified_cxf-utils.js Wed Aug 20 10:50:22 2008
*************** function org_apache_cxf_make_uuid(type)
*** 600,605 ****
--- 600,654 ----
return null;
}
+ //
+ // Returns XMLHttpRequest object.
+ //
+ function getXMLHttpRequest()
+ {
+ var httpRequest = null;
+
+ // Create the appropriate HttpRequest object for the browser.
+ if (window.XMLHttpRequest != null){
+ httpRequest = new window.XMLHttpRequest();
+ }
+ else if (window.ActiveXObject != null)
+ {
+ // Must be IE, find the right ActiveXObject.
+
+ var success = false;
+ //
+ // Define a list of Microsoft XML HTTP ProgIDs.
+ //
+ var XMLHTTPREQUEST_MS_PROGIDS = new Array(
+ "Msxml2.XMLHTTP.7.0",
+ "Msxml2.XMLHTTP.6.0",
+ "Msxml2.XMLHTTP.5.0",
+ "Msxml2.XMLHTTP.4.0",
+ "MSXML2.XMLHTTP.3.0",
+ "MSXML2.XMLHTTP",
+ "Microsoft.XMLHTTP"
+ );
+
+ for (var i = 0;
+ i < XMLHTTPREQUEST_MS_PROGIDS.length && !success;
+ i++)
+ {
+ try
+ {
+ httpRequest = new ActiveXObject(XMLHTTPREQUEST_MS_PROGIDS[i]);
+ success = true;
+ }
+ catch (ex)
+ {// Ignore the error or one can choose to log it..
+ }
+ }
+ }
+
+ // Return it.
+ return httpRequest;
+ }
+
+
var ORG_APACHE_CXF_MTOM_REQUEST_HEADER = 'Content-Type: application/xop+xml;
type="text/xml"; charset=utf-8\r\n';
// Caller must avoid stupid mistakes like 'GET' with a request body.
*************** function org_apache_cxf_client_request(u
*** 622,642 ****
this.method = "GET";
}
! try {
! this.req = new XMLHttpRequest();
! } catch (err) {
! this.utils.trace("Error creating XMLHttpRequest " + err);
! this.req = null;
! }
!
! if (this.req == null) {
! if (window.ActiveXObject) {
! this.req = new ActiveXObject("MSXML2.XMLHTTP.6.0"); //
Microsoft's
! // recommended
! // version
! }
! }
!
if (this.req == null) {
this.utils.trace("Unable to create request object.");
throw "ORG_APACHE_CXF_NO_REQUEST_OBJECT";
--- 671,677 ----
this.method = "GET";
}
! this.req = getXMLHttpRequest();
if (this.req == null) {
this.utils.trace("Unable to create request object.");
throw "ORG_APACHE_CXF_NO_REQUEST_OBJECT";
*************** function org_apache_cxf_client_request(u
*** 696,701 ****
--- 731,737 ----
this.req.send(dataToSend);
}
+
CxfApacheOrgClient.prototype.request = org_apache_cxf_client_request;
function org_apache_cxf_trim_string(str) {