You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Christine (JIRA)" <ji...@apache.org> on 2008/07/22 13:48:31 UTC

[jira] Created: (CXF-1713) Generated Javascript does not handle simultaneous soap requests correctly

Generated Javascript does not handle simultaneous soap requests correctly
-------------------------------------------------------------------------

                 Key: CXF-1713
                 URL: https://issues.apache.org/jira/browse/CXF-1713
             Project: CXF
          Issue Type: Bug
          Components: JavaScript Client
         Environment: linux64 ubuntu firefox 3.0
            Reporter: Christine
            Priority: Minor


I use the js client code as dynamically provided by cxf. My js client, which is modeled after the helloworld example, generates two soap requests. The second request is issued before the first has completed. What happens is that the response to the first request gets handled by the response handler of the second request. this is my code (I have added an additional "sayIt" to demo the issue)
function saySomething(formObj)
{
	saveText = formObj.textField.value;
	formObj.textField.value = "";
	userId=readCookie();
	if (userId == null || userId.length < 20)
	{
	   register(userId);
	   sayIt(userId, "hi");
	} else {
	   sayIt(userId, saveText);
	}
}

The response to the "register(userid)" is handled by the response function for the SayIt function. I have solved the problem in my code by making the sayIt wait until the responst to the register has been processed.

What I think that happens is the following. The cxf js code sets the response functions in function soap__say_op:
    this._onsuccess = successCallback;
    this._onerror = errorCallback;
When a response comes in, the onsuccess or onerror function is used that has last been set. What should happen is that the name of the response function is taken from the xml response, xmlresponse.firstchild.firstchild.firstchild.localname. There is a  function org_apache_cxf_deserialize_anyType that does seem to take the tag name from the xml, but this is not used in the response handling that I have seen.

My js client runs in FireFox 3.0 on Ubuntu linux 64 bits. I have tested on IE7 on Windows XP with the same results. I use cxf 2.1.1.




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (CXF-1713) Generated Javascript does not handle simultaneous soap requests correctly

Posted by Benson Margulies <bi...@gmail.com>.
The design intention is that this is your problem. You can pass a
different function in as the success function each time, or you can
concoct a closure that associates the requests. The bug is that this
intended design didn't get implemented properly because i fell asleep.


On Tue, Jul 22, 2008 at 3:13 PM, Christine (JIRA) <ji...@apache.org> wrote:
>
>    [ https://issues.apache.org/jira/browse/CXF-1713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615745#action_12615745 ]
>
> Christine commented on CXF-1713:
> --------------------------------
>
> Whatever solution you come up with, the js client will have to decide where to put the response based on the response it gets from the server. I mean, you send request A and request B shortly after one another, and you don't know which one will receive a response first. When the first response comes in, you have to identify it from the message or the envelope or whatever you have that comes back. I don't know enough about web services to be of any help here, I guess.
> Why exactly can't you pick the function name from the message? I saw that the original function name is in the response header, there should be a point after receiving the message and before handing it to the user response function, where you can set the proper response function name.
>
>> Generated Javascript does not handle simultaneous soap requests correctly
>> -------------------------------------------------------------------------
>>
>>                 Key: CXF-1713
>>                 URL: https://issues.apache.org/jira/browse/CXF-1713
>>             Project: CXF
>>          Issue Type: Bug
>>          Components: JavaScript Client
>>         Environment: linux64 ubuntu firefox 3.0
>>            Reporter: Christine
>>            Assignee: Benson Margulies
>>            Priority: Minor
>>
>> I use the js client code as dynamically provided by cxf. My js client, which is modeled after the helloworld example, generates two soap requests. The second request is issued before the first has completed. What happens is that the response to the first request gets handled by the response handler of the second request. this is my code (I have added an additional "sayIt" to demo the issue)
>> function saySomething(formObj)
>> {
>>       saveText = formObj.textField.value;
>>       formObj.textField.value = "";
>>       userId=readCookie();
>>       if (userId == null || userId.length < 20)
>>       {
>>          register(userId);
>>          sayIt(userId, "hi");
>>       } else {
>>          sayIt(userId, saveText);
>>       }
>> }
>> The response to the "register(userid)" is handled by the response function for the SayIt function. I have solved the problem in my code by making the sayIt wait until the responst to the register has been processed.
>> What I think that happens is the following. The cxf js code sets the response functions in function soap__say_op:
>>     this._onsuccess = successCallback;
>>     this._onerror = errorCallback;
>> When a response comes in, the onsuccess or onerror function is used that has last been set. What should happen is that the name of the response function is taken from the xml response, xmlresponse.firstchild.firstchild.firstchild.localname. There is a  function org_apache_cxf_deserialize_anyType that does seem to take the tag name from the xml, but this is not used in the response handling that I have seen.
>> My js client runs in FireFox 3.0 on Ubuntu linux 64 bits. I have tested on IE7 on Windows XP with the same results. I use cxf 2.1.1.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

[jira] Commented: (CXF-1713) Generated Javascript does not handle simultaneous soap requests correctly

Posted by "Christine (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12616438#action_12616438 ] 

Christine commented on CXF-1713:
--------------------------------

Cool! Thanks.

Christine

-- 
dagdag is just a two character rotation of byebye
www.christine.nl



> Generated Javascript does not handle simultaneous soap requests correctly
> -------------------------------------------------------------------------
>
>                 Key: CXF-1713
>                 URL: https://issues.apache.org/jira/browse/CXF-1713
>             Project: CXF
>          Issue Type: Bug
>          Components: JavaScript Client
>         Environment: linux64 ubuntu firefox 3.0
>            Reporter: Christine
>            Assignee: Benson Margulies
>            Priority: Minor
>             Fix For: 2.1.2
>
>
> I use the js client code as dynamically provided by cxf. My js client, which is modeled after the helloworld example, generates two soap requests. The second request is issued before the first has completed. What happens is that the response to the first request gets handled by the response handler of the second request. this is my code (I have added an additional "sayIt" to demo the issue)
> function saySomething(formObj)
> {
> 	saveText = formObj.textField.value;
> 	formObj.textField.value = "";
> 	userId=readCookie();
> 	if (userId == null || userId.length < 20)
> 	{
> 	   register(userId);
> 	   sayIt(userId, "hi");
> 	} else {
> 	   sayIt(userId, saveText);
> 	}
> }
> The response to the "register(userid)" is handled by the response function for the SayIt function. I have solved the problem in my code by making the sayIt wait until the responst to the register has been processed.
> What I think that happens is the following. The cxf js code sets the response functions in function soap__say_op:
>     this._onsuccess = successCallback;
>     this._onerror = errorCallback;
> When a response comes in, the onsuccess or onerror function is used that has last been set. What should happen is that the name of the response function is taken from the xml response, xmlresponse.firstchild.firstchild.firstchild.localname. There is a  function org_apache_cxf_deserialize_anyType that does seem to take the tag name from the xml, but this is not used in the response handling that I have seen.
> My js client runs in FireFox 3.0 on Ubuntu linux 64 bits. I have tested on IE7 on Windows XP with the same results. I use cxf 2.1.1.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1713) Generated Javascript does not handle simultaneous soap requests correctly

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615861#action_12615861 ] 

Benson Margulies commented on CXF-1713:
---------------------------------------

As promised, I added an example of how to keep multiple requests sorted out. If you fetch from svn, you can find it here.

distribution/src/main/release/samples/js_browser_client_simple/staticContent/HelloWorld.html

Here's the fun part:

For each transaction, it creates a new JavaScript closure that arranges to deposit the response in the desired place.

   var receiveFirstResponse = function(response) { sayHiResponse(response, responseSpan1); };
    Greeter.sayHi(receiveFirstResponse, sayHiError);
    var receiveSecondResponse = function(response) { sayHiResponse(response, responseSpan2); };
    Greeter.sayHi(receiveSecondResponse, sayHiError);

> Generated Javascript does not handle simultaneous soap requests correctly
> -------------------------------------------------------------------------
>
>                 Key: CXF-1713
>                 URL: https://issues.apache.org/jira/browse/CXF-1713
>             Project: CXF
>          Issue Type: Bug
>          Components: JavaScript Client
>         Environment: linux64 ubuntu firefox 3.0
>            Reporter: Christine
>            Assignee: Benson Margulies
>            Priority: Minor
>             Fix For: 2.1.2
>
>
> I use the js client code as dynamically provided by cxf. My js client, which is modeled after the helloworld example, generates two soap requests. The second request is issued before the first has completed. What happens is that the response to the first request gets handled by the response handler of the second request. this is my code (I have added an additional "sayIt" to demo the issue)
> function saySomething(formObj)
> {
> 	saveText = formObj.textField.value;
> 	formObj.textField.value = "";
> 	userId=readCookie();
> 	if (userId == null || userId.length < 20)
> 	{
> 	   register(userId);
> 	   sayIt(userId, "hi");
> 	} else {
> 	   sayIt(userId, saveText);
> 	}
> }
> The response to the "register(userid)" is handled by the response function for the SayIt function. I have solved the problem in my code by making the sayIt wait until the responst to the register has been processed.
> What I think that happens is the following. The cxf js code sets the response functions in function soap__say_op:
>     this._onsuccess = successCallback;
>     this._onerror = errorCallback;
> When a response comes in, the onsuccess or onerror function is used that has last been set. What should happen is that the name of the response function is taken from the xml response, xmlresponse.firstchild.firstchild.firstchild.localname. There is a  function org_apache_cxf_deserialize_anyType that does seem to take the tag name from the xml, but this is not used in the response handling that I have seen.
> My js client runs in FireFox 3.0 on Ubuntu linux 64 bits. I have tested on IE7 on Windows XP with the same results. I use cxf 2.1.1.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-1713) Generated Javascript does not handle simultaneous soap requests correctly

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies reassigned CXF-1713:
-------------------------------------

    Assignee: Benson Margulies

> Generated Javascript does not handle simultaneous soap requests correctly
> -------------------------------------------------------------------------
>
>                 Key: CXF-1713
>                 URL: https://issues.apache.org/jira/browse/CXF-1713
>             Project: CXF
>          Issue Type: Bug
>          Components: JavaScript Client
>         Environment: linux64 ubuntu firefox 3.0
>            Reporter: Christine
>            Assignee: Benson Margulies
>            Priority: Minor
>
> I use the js client code as dynamically provided by cxf. My js client, which is modeled after the helloworld example, generates two soap requests. The second request is issued before the first has completed. What happens is that the response to the first request gets handled by the response handler of the second request. this is my code (I have added an additional "sayIt" to demo the issue)
> function saySomething(formObj)
> {
> 	saveText = formObj.textField.value;
> 	formObj.textField.value = "";
> 	userId=readCookie();
> 	if (userId == null || userId.length < 20)
> 	{
> 	   register(userId);
> 	   sayIt(userId, "hi");
> 	} else {
> 	   sayIt(userId, saveText);
> 	}
> }
> The response to the "register(userid)" is handled by the response function for the SayIt function. I have solved the problem in my code by making the sayIt wait until the responst to the register has been processed.
> What I think that happens is the following. The cxf js code sets the response functions in function soap__say_op:
>     this._onsuccess = successCallback;
>     this._onerror = errorCallback;
> When a response comes in, the onsuccess or onerror function is used that has last been set. What should happen is that the name of the response function is taken from the xml response, xmlresponse.firstchild.firstchild.firstchild.localname. There is a  function org_apache_cxf_deserialize_anyType that does seem to take the tag name from the xml, but this is not used in the response handling that I have seen.
> My js client runs in FireFox 3.0 on Ubuntu linux 64 bits. I have tested on IE7 on Windows XP with the same results. I use cxf 2.1.1.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1713) Generated Javascript does not handle simultaneous soap requests correctly

Posted by "Christine (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615745#action_12615745 ] 

Christine commented on CXF-1713:
--------------------------------

Whatever solution you come up with, the js client will have to decide where to put the response based on the response it gets from the server. I mean, you send request A and request B shortly after one another, and you don't know which one will receive a response first. When the first response comes in, you have to identify it from the message or the envelope or whatever you have that comes back. I don't know enough about web services to be of any help here, I guess.
Why exactly can't you pick the function name from the message? I saw that the original function name is in the response header, there should be a point after receiving the message and before handing it to the user response function, where you can set the proper response function name.

> Generated Javascript does not handle simultaneous soap requests correctly
> -------------------------------------------------------------------------
>
>                 Key: CXF-1713
>                 URL: https://issues.apache.org/jira/browse/CXF-1713
>             Project: CXF
>          Issue Type: Bug
>          Components: JavaScript Client
>         Environment: linux64 ubuntu firefox 3.0
>            Reporter: Christine
>            Assignee: Benson Margulies
>            Priority: Minor
>
> I use the js client code as dynamically provided by cxf. My js client, which is modeled after the helloworld example, generates two soap requests. The second request is issued before the first has completed. What happens is that the response to the first request gets handled by the response handler of the second request. this is my code (I have added an additional "sayIt" to demo the issue)
> function saySomething(formObj)
> {
> 	saveText = formObj.textField.value;
> 	formObj.textField.value = "";
> 	userId=readCookie();
> 	if (userId == null || userId.length < 20)
> 	{
> 	   register(userId);
> 	   sayIt(userId, "hi");
> 	} else {
> 	   sayIt(userId, saveText);
> 	}
> }
> The response to the "register(userid)" is handled by the response function for the SayIt function. I have solved the problem in my code by making the sayIt wait until the responst to the register has been processed.
> What I think that happens is the following. The cxf js code sets the response functions in function soap__say_op:
>     this._onsuccess = successCallback;
>     this._onerror = errorCallback;
> When a response comes in, the onsuccess or onerror function is used that has last been set. What should happen is that the name of the response function is taken from the xml response, xmlresponse.firstchild.firstchild.firstchild.localname. There is a  function org_apache_cxf_deserialize_anyType that does seem to take the tag name from the xml, but this is not used in the response handling that I have seen.
> My js client runs in FireFox 3.0 on Ubuntu linux 64 bits. I have tested on IE7 on Windows XP with the same results. I use cxf 2.1.1.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1713) Generated Javascript does not handle simultaneous soap requests correctly

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies resolved CXF-1713.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.2

I've committed the fix.

All the state for a request is now packaged with the request, so multiple requests can pend at the same time.

I will shortly make the sample demonstrate this.


> Generated Javascript does not handle simultaneous soap requests correctly
> -------------------------------------------------------------------------
>
>                 Key: CXF-1713
>                 URL: https://issues.apache.org/jira/browse/CXF-1713
>             Project: CXF
>          Issue Type: Bug
>          Components: JavaScript Client
>         Environment: linux64 ubuntu firefox 3.0
>            Reporter: Christine
>            Assignee: Benson Margulies
>            Priority: Minor
>             Fix For: 2.1.2
>
>
> I use the js client code as dynamically provided by cxf. My js client, which is modeled after the helloworld example, generates two soap requests. The second request is issued before the first has completed. What happens is that the response to the first request gets handled by the response handler of the second request. this is my code (I have added an additional "sayIt" to demo the issue)
> function saySomething(formObj)
> {
> 	saveText = formObj.textField.value;
> 	formObj.textField.value = "";
> 	userId=readCookie();
> 	if (userId == null || userId.length < 20)
> 	{
> 	   register(userId);
> 	   sayIt(userId, "hi");
> 	} else {
> 	   sayIt(userId, saveText);
> 	}
> }
> The response to the "register(userid)" is handled by the response function for the SayIt function. I have solved the problem in my code by making the sayIt wait until the responst to the register has been processed.
> What I think that happens is the following. The cxf js code sets the response functions in function soap__say_op:
>     this._onsuccess = successCallback;
>     this._onerror = errorCallback;
> When a response comes in, the onsuccess or onerror function is used that has last been set. What should happen is that the name of the response function is taken from the xml response, xmlresponse.firstchild.firstchild.firstchild.localname. There is a  function org_apache_cxf_deserialize_anyType that does seem to take the tag name from the xml, but this is not used in the response handling that I have seen.
> My js client runs in FireFox 3.0 on Ubuntu linux 64 bits. I have tested on IE7 on Windows XP with the same results. I use cxf 2.1.1.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1713) Generated Javascript does not handle simultaneous soap requests correctly

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615607#action_12615607 ] 

Benson Margulies commented on CXF-1713:
---------------------------------------

I don't think that your proposed solution can work. We need another closure.

The idea here is that you, the programmer, declare what function you want to see called at completion. We can't automatically determine that function from the response XML. (There is some trickery for 'any' types that does pick functions based on XML, but that's part of the deserialization process.)

The generated code has to create a new closure function that captures the 'on' functions and associates them with the request. In fact, I thought I'd set out to code it this way to begin with.

The hardest part of fixing this will be to come up with a 'mock' for it that allows for a test in the Rhino unit tests.



> Generated Javascript does not handle simultaneous soap requests correctly
> -------------------------------------------------------------------------
>
>                 Key: CXF-1713
>                 URL: https://issues.apache.org/jira/browse/CXF-1713
>             Project: CXF
>          Issue Type: Bug
>          Components: JavaScript Client
>         Environment: linux64 ubuntu firefox 3.0
>            Reporter: Christine
>            Priority: Minor
>
> I use the js client code as dynamically provided by cxf. My js client, which is modeled after the helloworld example, generates two soap requests. The second request is issued before the first has completed. What happens is that the response to the first request gets handled by the response handler of the second request. this is my code (I have added an additional "sayIt" to demo the issue)
> function saySomething(formObj)
> {
> 	saveText = formObj.textField.value;
> 	formObj.textField.value = "";
> 	userId=readCookie();
> 	if (userId == null || userId.length < 20)
> 	{
> 	   register(userId);
> 	   sayIt(userId, "hi");
> 	} else {
> 	   sayIt(userId, saveText);
> 	}
> }
> The response to the "register(userid)" is handled by the response function for the SayIt function. I have solved the problem in my code by making the sayIt wait until the responst to the register has been processed.
> What I think that happens is the following. The cxf js code sets the response functions in function soap__say_op:
>     this._onsuccess = successCallback;
>     this._onerror = errorCallback;
> When a response comes in, the onsuccess or onerror function is used that has last been set. What should happen is that the name of the response function is taken from the xml response, xmlresponse.firstchild.firstchild.firstchild.localname. There is a  function org_apache_cxf_deserialize_anyType that does seem to take the tag name from the xml, but this is not used in the response handling that I have seen.
> My js client runs in FireFox 3.0 on Ubuntu linux 64 bits. I have tested on IE7 on Windows XP with the same results. I use cxf 2.1.1.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.