Thilina Gunarathne
2007-03-27 15:56:47 UTC
WSRequest IMHO is not standardized as XMLHttpRequest object.
I thought we are going to provide the web services equivalent to theXMLHttpRequest.. May be we will be able to standardize it someday..
IMHO it's should not be just another javascript library. It should be
*THE* thing..
Thus, there should have been a situation one could initialize his own WSRequest
class. Thus, this will cause collisions.
Good point... But AFAIKS this is a very very rare situation..class. Thus, this will cause collisions.
In this kind of a situation you
couldn't exactly say which class the Javascript engine might use to
initialize the object. Thus, we need some mechanism to avoid this
collision. That's why we use namespaces.
IIRC yahoo namespace is the first thing which worried you when you sawcouldn't exactly say which class the Javascript engine might use to
initialize the object. Thus, we need some mechanism to avoid this
collision. That's why we use namespaces.
the Yahoo UI toolkit and I had to put lot of efforts to convince you :)..
IMHO using a wso2 namespace might prevent some users from using it, or
at least it'll give them a bit backward impression, not because of it's
WSO2 but due to the fact that it's something external (the same feeling
you had towards yahoo)...
Is there an alternative to avoid this kind of collisions ?
I don't see an alternative... But I don't see it as a rock solid reasonto make it namespaced...May be my very little knowledge on javascript
makes me oversee this..
Thanks,
Thilina
Thank you
Saminda
Saminda
Hi all,
Sorry for jumping in this late..Better late than never :)..
Saminda, What are the reasons for namespace qualifying this.. If we are
doing this we need to do so across the whole board for all the WSRequest
impls...
I would not agree with this unless there is a concrete reason...
Thanks,
Thilina
Index: samples/firefox/google.html
===================================================================
--- samples/firefox/google.html (revision 1205)
+++ samples/firefox/google.html (working copy)
@@ -2,11 +2,11 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function checkSpell()
{
@@ -97,7 +97,7 @@
<td id="resultCol"></td>
</tr>
</table>
- <input type="button" value="Check spell" onclick="checkSpell()">
+ <input type="button" value="Check spell" onclick="javascript:void
checkSpell();return false;">
<input type ="reset" name="reset" value="Reset">
<br>
your request xml<br><textarea id="request" rows=10 cols=80
===================================================================
--- samples/firefox/zipcode.html (revision 1205)
+++ samples/firefox/zipcode.html (working copy)
@@ -2,12 +2,12 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Distance between two zip codes</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function test(){
var option = new Array();
wshttp.onreadystatechange = test1;
Index: samples/firefox/greet.html
===================================================================
--- samples/firefox/greet.html (revision 1205)
+++ samples/firefox/greet.html (working copy)
@@ -2,12 +2,12 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Greet of the day</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function greet(){
wshttp.onreadystatechange = state;
Index: samples/firefox/googlesnyc.html
===================================================================
--- samples/firefox/googlesnyc.html (revision 1205)
+++ samples/firefox/googlesnyc.html (working copy)
@@ -2,11 +2,11 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function checkSpell()
{
Index: samples/ie/greet_ie.html
===================================================================
--- samples/ie/greet_ie.html (revision 1205)
+++ samples/ie/greet_ie.html (working copy)
@@ -2,12 +2,12 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Greet of the day</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function greet(){
var option = new Array();
option['useSOAP'] = 1.1;
Index: samples/ie/googlesnyc_ie.html
===================================================================
--- samples/ie/googlesnyc_ie.html (revision 1205)
+++ samples/ie/googlesnyc_ie.html (working copy)
@@ -2,7 +2,7 @@
<HEAD>
<TITLE>WSO2 WSRequest demo</TITLE>
<h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
@@ -10,7 +10,7 @@
var key;
var phrase;
var wshttp = null;
- wshttp = new WSRequest();
+ wshttp = new wso2.wsf.WSRequest();
function search(){
wshttp.onreadystatechange = callbackResult;
Index: samples/ie/google_ie.html
===================================================================
--- samples/ie/google_ie.html (revision 1205)
+++ samples/ie/google_ie.html (working copy)
@@ -2,7 +2,7 @@
<HEAD>
<TITLE>WSO2 WSRequest demo</TITLE>
<h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
@@ -10,7 +10,7 @@
var key;
var phrase;
var wshttp = null;
- wshttp = new WSRequest();
+ wshttp = new wso2.wsf.WSRequest();
function search(){
wshttp.onreadystatechange = callbackResult;
Index: samples/ie/zipcode_ie.html
===================================================================
--- samples/ie/zipcode_ie.html (revision 1205)
+++ samples/ie/zipcode_ie.html (working copy)
@@ -2,11 +2,11 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Distance between two zip codes</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest(true);
+ var wshttp = new wso2.wsf.WSRequest(true);
function test(){
// user need soap-not xml
Index: WSRequest.js
===================================================================
--- WSRequest.js (revision 1205)
+++ WSRequest.js (working copy)
@@ -14,8 +14,46 @@
* limitations under the License.
*/
-function WSRequest()
-{
+/**
+ * WSRequest object uses SOAP/HTTP|HTTPS. This object provides a wrpper
for XMLHttpRequest object.
+ * This object belongs to the namespace wso2.wsf, thus, user can init
it as follows,
+ * var foo = new wso2.wsf.WSRequest();
+ */
+
+/*
+creating the wso2 global object
+*/
+if (typeof wso2 == 'undefined') {
+ //define the WSO2 global object
+
+ wso2 = {};
+}
+
+/*this will create the namespace required.*/
+wso2.namespace = function() {
+ var a = arguments,o = null,i,j,d;
+ for (i = 0; i < a.length; i++) {
+ d = a[i].split(".");
+ o = wso2;
+
+ for (j = (d[0] == "wso2")?1:0; j < d.length; j++) {
+ o[d[j]] = o[d[j]] || {};
+ o = o[d[j]];
+ }
+ }
+
+ return o;
+}
+
+wso2.init = function() {
+ this.namespace("wsf");
+}
+
+wso2.init();
+
+
+wso2.wsf.WSRequest = function() {
+
// data members
// readyState
this.readyState = 0;
------------------------------------------------------------------------
_______________________________________________
Commons-dev mailing list
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev
Sorry for jumping in this late..Better late than never :)..
Saminda, What are the reasons for namespace qualifying this.. If we are
doing this we need to do so across the whole board for all the WSRequest
impls...
I would not agree with this unless there is a concrete reason...
Thanks,
Thilina
Hi Rajika,
Patch for making WSRequest, with the wso2.wsf namespace.
Saminda
Wsas-java-dev mailing list
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev
------------------------------------------------------------------------Patch for making WSRequest, with the wso2.wsf namespace.
Saminda
Hi Sir,
Yes Sir, it's the same code in
http://wso2.org/repos/wso2/trunk/wsf/javascript/native/ we are referring
to.
http://wso2.org/repos/wso2/trunk/wsf/javascript/native/. I think you
meant the same right?
main.js reside under commons/adminui project.
[https://wso2.org/repos/wso2/trunk/commons/adminui]. Should we use
"wso2.wsf" namespace for this too.
WSRequest right. What is preventing you from doing
foo=new wso2.wsf.WSRequest()
+1.
Should we do this to XPI and ActiveX Object too, namespace qualifying
WSRequest object.
Thank you
Saminda
_______________________________________________Yes Sir, it's the same code in
http://wso2.org/repos/wso2/trunk/wsf/javascript/native/ we are referring
to.
I believe you are referring prior to WSRequest.js. The simplest solution
would be to start with native/WSRequest.js.
I'm referring to the stuff atwould be to start with native/WSRequest.js.
http://wso2.org/repos/wso2/trunk/wsf/javascript/native/. I think you
meant the same right?
We propose that main.js contains functions related to a namespace
"WSO2.common", (ex: WSO2.common.send(args...)) will solve the namespace
issue.
+1 but IMO it should be wso2.wsf."WSO2.common", (ex: WSO2.common.send(args...)) will solve the namespace
issue.
[https://wso2.org/repos/wso2/trunk/commons/adminui]. Should we use
"wso2.wsf" namespace for this too.
As an example, WSO2.common.send(args...) is the wrapper function that
uses WSRequest functionality to communicate with server. This is our
original plan and we were waiting for a release of WSRequest to achieve
this.
No I disagree- if there's a need to wrap WSRequest then we haven't gotuses WSRequest functionality to communicate with server. This is our
original plan and we were waiting for a release of WSRequest to achieve
this.
WSRequest right. What is preventing you from doing
foo=new wso2.wsf.WSRequest()
Should we do this to XPI and ActiveX Object too, namespace qualifying
WSRequest object.
Thank you
Saminda
Wsas-java-dev mailing list
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev
Index: samples/firefox/google.html
===================================================================
--- samples/firefox/google.html (revision 1205)
+++ samples/firefox/google.html (working copy)
@@ -2,11 +2,11 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function checkSpell()
{
@@ -97,7 +97,7 @@
<td id="resultCol"></td>
</tr>
</table>
- <input type="button" value="Check spell" onclick="checkSpell()">
+ <input type="button" value="Check spell" onclick="javascript:void
checkSpell();return false;">
<input type ="reset" name="reset" value="Reset">
<br>
your request xml<br><textarea id="request" rows=10 cols=80
</textarea><br/>
Index: samples/firefox/zipcode.html===================================================================
--- samples/firefox/zipcode.html (revision 1205)
+++ samples/firefox/zipcode.html (working copy)
@@ -2,12 +2,12 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Distance between two zip codes</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function test(){
var option = new Array();
wshttp.onreadystatechange = test1;
Index: samples/firefox/greet.html
===================================================================
--- samples/firefox/greet.html (revision 1205)
+++ samples/firefox/greet.html (working copy)
@@ -2,12 +2,12 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Greet of the day</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function greet(){
wshttp.onreadystatechange = state;
Index: samples/firefox/googlesnyc.html
===================================================================
--- samples/firefox/googlesnyc.html (revision 1205)
+++ samples/firefox/googlesnyc.html (working copy)
@@ -2,11 +2,11 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function checkSpell()
{
Index: samples/ie/greet_ie.html
===================================================================
--- samples/ie/greet_ie.html (revision 1205)
+++ samples/ie/greet_ie.html (working copy)
@@ -2,12 +2,12 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Greet of the day</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest();
+ var wshttp = new wso2.wsf.WSRequest();
function greet(){
var option = new Array();
option['useSOAP'] = 1.1;
Index: samples/ie/googlesnyc_ie.html
===================================================================
--- samples/ie/googlesnyc_ie.html (revision 1205)
+++ samples/ie/googlesnyc_ie.html (working copy)
@@ -2,7 +2,7 @@
<HEAD>
<TITLE>WSO2 WSRequest demo</TITLE>
<h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
@@ -10,7 +10,7 @@
var key;
var phrase;
var wshttp = null;
- wshttp = new WSRequest();
+ wshttp = new wso2.wsf.WSRequest();
function search(){
wshttp.onreadystatechange = callbackResult;
Index: samples/ie/google_ie.html
===================================================================
--- samples/ie/google_ie.html (revision 1205)
+++ samples/ie/google_ie.html (working copy)
@@ -2,7 +2,7 @@
<HEAD>
<TITLE>WSO2 WSRequest demo</TITLE>
<h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
@@ -10,7 +10,7 @@
var key;
var phrase;
var wshttp = null;
- wshttp = new WSRequest();
+ wshttp = new wso2.wsf.WSRequest();
function search(){
wshttp.onreadystatechange = callbackResult;
Index: samples/ie/zipcode_ie.html
===================================================================
--- samples/ie/zipcode_ie.html (revision 1205)
+++ samples/ie/zipcode_ie.html (working copy)
@@ -2,11 +2,11 @@
<HEAD>
<TITLE>WSO2 WSRequest object</TITLE>
<h2>WSO2 WSRequest Object Demo-Distance between two zip codes</h2>
- <script language="javascript" src="./WSRequest.js"></script>
+ <script language="javascript" src="../../WSRequest.js"></script>
</HEAD>
<BODY>
<script language="javascript">
- var wshttp = new WSRequest(true);
+ var wshttp = new wso2.wsf.WSRequest(true);
function test(){
// user need soap-not xml
Index: WSRequest.js
===================================================================
--- WSRequest.js (revision 1205)
+++ WSRequest.js (working copy)
@@ -14,8 +14,46 @@
* limitations under the License.
*/
-function WSRequest()
-{
+/**
+ * WSRequest object uses SOAP/HTTP|HTTPS. This object provides a wrpper
for XMLHttpRequest object.
+ * This object belongs to the namespace wso2.wsf, thus, user can init
it as follows,
+ * var foo = new wso2.wsf.WSRequest();
+ */
+
+/*
+creating the wso2 global object
+*/
+if (typeof wso2 == 'undefined') {
+ //define the WSO2 global object
+
+ wso2 = {};
+}
+
+/*this will create the namespace required.*/
+wso2.namespace = function() {
+ var a = arguments,o = null,i,j,d;
+ for (i = 0; i < a.length; i++) {
+ d = a[i].split(".");
+ o = wso2;
+
+ for (j = (d[0] == "wso2")?1:0; j < d.length; j++) {
+ o[d[j]] = o[d[j]] || {};
+ o = o[d[j]];
+ }
+ }
+
+ return o;
+}
+
+wso2.init = function() {
+ this.namespace("wsf");
+}
+
+wso2.init();
+
+
+wso2.wsf.WSRequest = function() {
+
// data members
// readyState
this.readyState = 0;
------------------------------------------------------------------------
_______________________________________________
Commons-dev mailing list
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev