WSRequest.js related issue

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

WSRequest.js related issue

saminda abeyruwan-4
Hi,

WSAS has encountered a slight issue in WSRequest.js (line 743)

i.e randomToken = Math.floor(Math.random() * 10000000000);

The above line is in the _buildWSAHeaders : function(standardversion,
options, address) {...} of WSRequest.js.

WSAS loads "Try it" inside an iframe which embeds into a div. When an
service is invoked and WSRequest hits the line 747 to build WSA headers,
  it will throw an undefined error. Once this line has been removed and
generates the MessageId as follows,
id = "http://identifiers.wso2.com/messageid/" + now + "/" + now;

everything worked fine.

Unfortunately, I could not give much information on why it would cause
such error only I could demonstrate it.

Considering the safe side should it be viable to remove the
"randomToken" variable and generate the message id with

  "http://identifiers.wso2.com/messageid/" + now ;

now = (new Date()).valueOf();

because, IMHO the probability of getting the same Id in concurrent
situation is quite small.

Thank you

Saminda

_______________________________________________
Wsas-java-dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev
Reply | Threaded
Open this post in threaded view
|

Re: [mashup-dev] WSRequest.js related issue

saminda abeyruwan-4
Hi All,

Well I have an explanation to the cause for the prior mentioned problem.
The web service I've created called "Math". The combination of
jsstub.xsl and tryit.xsl xslts create an custom javascript class called
"Math". Browser has loaded the generated "Math" class instead of the
predefined "Math" class coming from the javascript runtime. If you look
at the javascript flow, it is lucid that the custom created "Math" class
loaded first before the predefined one.

Unfortunately their could be situations that javascirpt class loading
would be in conflicting state (ex: if there exist an "Date" service :)
dynamic-codegen would create an Date class. If this class loaded first,
the predefined Date class would not be loaded). One proposal I could
come forth would be to "qualify" the classes that dynamic-codegen could
create,  i.e org.wsf.dc.Math for "Math" service or org.wsf.dc.Date for
"Date" service.

What would be your consent on prior anomaly.

Shall I open an JIRA for this issue.

Thank you

Saminda

saminda abeyruwan wrote:

> Hi,
>
> WSAS has encountered a slight issue in WSRequest.js (line 743)
>
> i.e randomToken = Math.floor(Math.random() * 10000000000);
>
> The above line is in the _buildWSAHeaders : function(standardversion,
> options, address) {...} of WSRequest.js.
>
> WSAS loads "Try it" inside an iframe which embeds into a div. When an
> service is invoked and WSRequest hits the line 747 to build WSA headers,
>  it will throw an undefined error. Once this line has been removed and
> generates the MessageId as follows,
> id = "http://identifiers.wso2.com/messageid/" + now + "/" + now;
>
> everything worked fine.
>
> Unfortunately, I could not give much information on why it would cause
> such error only I could demonstrate it.
>
> Considering the safe side should it be viable to remove the
> "randomToken" variable and generate the message id with
>
>  "http://identifiers.wso2.com/messageid/" + now ;
>
> now = (new Date()).valueOf();
>
> because, IMHO the probability of getting the same Id in concurrent
> situation is quite small.
>
> Thank you
>
> Saminda
>
> _______________________________________________
> Mashup-dev mailing list
> [hidden email]
> http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
>


_______________________________________________
Wsas-java-dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev
Reply | Threaded
Open this post in threaded view
|

RE: [mashup-dev] WSRequest.js related issue

Jonathan Marsh-2
Yes, please open a JIRA.  In the Mashup Server we can limit the ability to
deploy services with reserved names.  We already do this if the name is
already in use by another service, if the service contains bad characters
like "-", and so forth.  But if those restrictions aren't followed by WSAS,
and by arbitrary services that you might apply the try-it to, it's not a
very good solution.

On the other hand always rewriting the try-it objects (Math -> WS_Math, foo
-> WS_foo) so they won't conflict with anything makes for a poor user
experience, and still doesn't always solve the problem.  Perhaps the best we
can do is have the try-it rewrite the names only when they conflict (Math ->
_Math, foo -> foo).  A bit complicated to implement.

Or we could simply give up on such services, but then we'd need to develop
an "error" view of a service, which is also a little complicated.

Jonathan Marsh - http://www.wso2.com - http://auburnmarshes.spaces.live.com
 

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> On Behalf Of saminda abeyruwan
> Sent: Saturday, November 03, 2007 6:54 AM
> To: [hidden email]
> Cc: [hidden email]
> Subject: Re: [mashup-dev] WSRequest.js related issue
>
> Hi All,
>
> Well I have an explanation to the cause for the prior mentioned
> problem.
> The web service I've created called "Math". The combination of
> jsstub.xsl and tryit.xsl xslts create an custom javascript class called
> "Math". Browser has loaded the generated "Math" class instead of the
> predefined "Math" class coming from the javascript runtime. If you look
> at the javascript flow, it is lucid that the custom created "Math"
> class
> loaded first before the predefined one.
>
> Unfortunately their could be situations that javascirpt class loading
> would be in conflicting state (ex: if there exist an "Date" service :)
> dynamic-codegen would create an Date class. If this class loaded first,
> the predefined Date class would not be loaded). One proposal I could
> come forth would be to "qualify" the classes that dynamic-codegen could
> create,  i.e org.wsf.dc.Math for "Math" service or org.wsf.dc.Date for
> "Date" service.
>
> What would be your consent on prior anomaly.
>
> Shall I open an JIRA for this issue.
>
> Thank you
>
> Saminda
>
> saminda abeyruwan wrote:
> > Hi,
> >
> > WSAS has encountered a slight issue in WSRequest.js (line 743)
> >
> > i.e randomToken = Math.floor(Math.random() * 10000000000);
> >
> > The above line is in the _buildWSAHeaders : function(standardversion,
> > options, address) {...} of WSRequest.js.
> >
> > WSAS loads "Try it" inside an iframe which embeds into a div. When an
> > service is invoked and WSRequest hits the line 747 to build WSA
> headers,
> >  it will throw an undefined error. Once this line has been removed
> and
> > generates the MessageId as follows,
> > id = "http://identifiers.wso2.com/messageid/" + now + "/" + now;
> >
> > everything worked fine.
> >
> > Unfortunately, I could not give much information on why it would
> cause
> > such error only I could demonstrate it.
> >
> > Considering the safe side should it be viable to remove the
> > "randomToken" variable and generate the message id with
> >
> >  "http://identifiers.wso2.com/messageid/" + now ;
> >
> > now = (new Date()).valueOf();
> >
> > because, IMHO the probability of getting the same Id in concurrent
> > situation is quite small.
> >
> > Thank you
> >
> > Saminda
> >
> > _______________________________________________
> > Mashup-dev mailing list
> > [hidden email]
> > http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
> >
>
>
> _______________________________________________
> Mashup-dev mailing list
> [hidden email]
> http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev


_______________________________________________
Wsas-java-dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev
Reply | Threaded
Open this post in threaded view
|

RE: [mashup-dev] WSRequest.js related issue

Jonathan Marsh-2
In reply to this post by saminda abeyruwan-4
While it is unlikely a client would generate two identifiers with the same
Date (millisecond), the WS-A MessageId is supposed to be unique across
clients as well - which is why I added the random number which seemed an
expedient way to ensure 99.99999% of message ids would be unique.  And
easier to generate than a GUID.  I fear removing the random number might
cause some interop problems down the line somewhere.  Since we've found the
source of the problem, I'm not inclined to change this at present - though
I'm open to convincing arguments!

Jonathan Marsh - http://www.wso2.com - http://auburnmarshes.spaces.live.com
 

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> On Behalf Of saminda abeyruwan
> Sent: Friday, November 02, 2007 8:11 PM
> To: [hidden email]
> Cc: [hidden email]
> Subject: [mashup-dev] WSRequest.js related issue
>
> Hi,
>
> WSAS has encountered a slight issue in WSRequest.js (line 743)
>
> i.e randomToken = Math.floor(Math.random() * 10000000000);
>
> The above line is in the _buildWSAHeaders : function(standardversion,
> options, address) {...} of WSRequest.js.
>
> WSAS loads "Try it" inside an iframe which embeds into a div. When an
> service is invoked and WSRequest hits the line 747 to build WSA
> headers,
>   it will throw an undefined error. Once this line has been removed and
> generates the MessageId as follows,
> id = "http://identifiers.wso2.com/messageid/" + now + "/" + now;
>
> everything worked fine.
>
> Unfortunately, I could not give much information on why it would cause
> such error only I could demonstrate it.
>
> Considering the safe side should it be viable to remove the
> "randomToken" variable and generate the message id with
>
>   "http://identifiers.wso2.com/messageid/" + now ;
>
> now = (new Date()).valueOf();
>
> because, IMHO the probability of getting the same Id in concurrent
> situation is quite small.
>
> Thank you
>
> Saminda
>
> _______________________________________________
> Mashup-dev mailing list
> [hidden email]
> http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev


_______________________________________________
Wsas-java-dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev