Transferring a DOM to the server-side

View: New views
8 Messages — Rating Filter:   Alert me  

Transferring a DOM to the server-side

by Jochen Huber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

currently I'm trying to call a DWR method and passing a DOM as an
argument. Sadly it doesn't work and I don't get any response at all.
Here's the sample code:

- Server-side Java

public class Testclass {
[...]
        public void printRequest(Document doc) {
                System.out.println("printRequest called.");
        }
[...]
}

- Client-side JavaScript

Testclass.printRequest(document.body);

As a matter of fact, there are no error messages at all. Does anybody
know the convenient way to do this?

I'm stuck :(

Btw: DWR is set up correctly. I've built several other applications
using DWR with the same setup.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Transferring a DOM to the server-side

by David Marginian-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I remember seeing a message about this awhile ago and I think there was
a problem with dom serialization -- not sure.  What version of DWR are
you using?  Are you absolutely sure that there is nothing in the logs?  
If DWR is having a problem marshaling the dom you can bet that there
will be an error in the log.  Do you need the entire document body?  You
may be getting a serialization error resulting from too many nodes.  Are
you sure your dwr.xml is set up correctly?



Jochen Huber wrote:

> Hello,
>
> currently I'm trying to call a DWR method and passing a DOM as an
> argument. Sadly it doesn't work and I don't get any response at all.
> Here's the sample code:
>
> - Server-side Java
>
> public class Testclass {
> [...]
> public void printRequest(Document doc) {
> System.out.println("printRequest called.");
> }
> [...]
> }
>
> - Client-side JavaScript
>
> Testclass.printRequest(document.body);
>
> As a matter of fact, there are no error messages at all. Does anybody
> know the convenient way to do this?
>
> I'm stuck :(
>
> Btw: DWR is set up correctly. I've built several other applications
> using DWR with the same setup.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Transferring a DOM to the server-side

by Jochen Huber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David,

I'm currently using version 2.0.4. I'm absolutely sure, that there's nothing in the logs. When I call Testclass.printRequest("sample string"); then there will be an entry in the logs.

I actually need the whole document body. I removed the check for the DOM level (std is < 20) in the source and recompiled them myself. Once again: Everything's working smoothly except the marshalling & seralization of DOM objects. :( So well yes, my dwr.xml is setup correctly.

David Marginian-2 wrote:
I remember seeing a message about this awhile ago and I think there was
a problem with dom serialization -- not sure.  What version of DWR are
you using?  Are you absolutely sure that there is nothing in the logs?  
If DWR is having a problem marshaling the dom you can bet that there
will be an error in the log.  Do you need the entire document body?  You
may be getting a serialization error resulting from too many nodes.  Are
you sure your dwr.xml is set up correctly?



Jochen Huber wrote:
> Hello,
>
> currently I'm trying to call a DWR method and passing a DOM as an
> argument. Sadly it doesn't work and I don't get any response at all.
> Here's the sample code:
>
> - Server-side Java
>
> public class Testclass {
> [...]
> public void printRequest(Document doc) {
> System.out.println("printRequest called.");
> }
> [...]
> }
>
> - Client-side JavaScript
>
> Testclass.printRequest(document.body);
>
> As a matter of fact, there are no error messages at all. Does anybody
> know the convenient way to do this?
>
> I'm stuck :(
>
> Btw: DWR is set up correctly. I've built several other applications
> using DWR with the same setup.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> For additional commands, e-mail: users-help@dwr.dev.java.net
>
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
For additional commands, e-mail: users-help@dwr.dev.java.net

Re: Transferring a DOM to the server-side

by David Marginian-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Might be able to get a bit more info if you add an error handler to your
call:

Testclass.printRequest(document.body, {
        errorHandler: function(errorFromServer) {

            alert("An error occurred.  Details - " + errorFromServer);
          }
});

Jochen Huber wrote:

> David,
>
> I'm currently using version 2.0.4. I'm absolutely sure, that there's nothing
> in the logs. When I call Testclass.printRequest("sample string"); then there
> will be an entry in the logs.
>
> I actually need the whole document body. I removed the check for the DOM
> level (std is < 20) in the source and recompiled them myself. Once again:
> Everything's working smoothly except the marshalling & seralization of DOM
> objects. :( So well yes, my dwr.xml is setup correctly.
>
>
> David Marginian-2 wrote:
>  
>> I remember seeing a message about this awhile ago and I think there was
>> a problem with dom serialization -- not sure.  What version of DWR are
>> you using?  Are you absolutely sure that there is nothing in the logs?  
>> If DWR is having a problem marshaling the dom you can bet that there
>> will be an error in the log.  Do you need the entire document body?  You
>> may be getting a serialization error resulting from too many nodes.  Are
>> you sure your dwr.xml is set up correctly?
>>
>>
>>
>> Jochen Huber wrote:
>>    
>>> Hello,
>>>
>>> currently I'm trying to call a DWR method and passing a DOM as an
>>> argument. Sadly it doesn't work and I don't get any response at all.
>>> Here's the sample code:
>>>
>>> - Server-side Java
>>>
>>> public class Testclass {
>>> [...]
>>> public void printRequest(Document doc) {
>>> System.out.println("printRequest called.");
>>> }
>>> [...]
>>> }
>>>
>>> - Client-side JavaScript
>>>
>>> Testclass.printRequest(document.body);
>>>
>>> As a matter of fact, there are no error messages at all. Does anybody
>>> know the convenient way to do this?
>>>
>>> I'm stuck :(
>>>
>>> Btw: DWR is set up correctly. I've built several other applications
>>> using DWR with the same setup.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>  
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>
>>    
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Transferring a DOM to the server-side

by Jochen Huber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I upgraded to DWR 3 M1 and it seems as if DOM marshalling is fixed.

Nevertheless, I downgraded back to 2.0.4. Firebug recognizes the request being sent and shows the following response:

//#DWR-REPLY

if (window.dwr) dwr.engine._remoteHandleBatchException({ name:'org.directwebremoting.extend.ServerException'

, message:'The specified call count is not a number' });

else if (window.parent.dwr) window.parent.dwr.engine._remoteHandleBatchException({ name:'org.directwebremoting

.extend.ServerException', message:'The specified call count is not a number' });
Any ideas?

Btw, I've registered a global error handler.

Re: Transferring a DOM to the server-side

by David Marginian-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Aren't you supposed to pass the dom as a string?  Can you try
document.body.innerHTML?

David Marginian wrote:

> Might be able to get a bit more info if you add an error handler to
> your call:
>
> Testclass.printRequest(document.body, {
>        errorHandler: function(errorFromServer) {
>
>            alert("An error occurred.  Details - " + errorFromServer);
>          }
> });
>
> Jochen Huber wrote:
>> David,
>>
>> I'm currently using version 2.0.4. I'm absolutely sure, that there's
>> nothing
>> in the logs. When I call Testclass.printRequest("sample string");
>> then there
>> will be an entry in the logs.
>> I actually need the whole document body. I removed the check for the DOM
>> level (std is < 20) in the source and recompiled them myself. Once
>> again:
>> Everything's working smoothly except the marshalling & seralization
>> of DOM
>> objects. :( So well yes, my dwr.xml is setup correctly.
>>
>>
>> David Marginian-2 wrote:
>>  
>>> I remember seeing a message about this awhile ago and I think there
>>> was a problem with dom serialization -- not sure.  What version of
>>> DWR are you using?  Are you absolutely sure that there is nothing in
>>> the logs?  If DWR is having a problem marshaling the dom you can bet
>>> that there will be an error in the log.  Do you need the entire
>>> document body?  You may be getting a serialization error resulting
>>> from too many nodes.  Are you sure your dwr.xml is set up correctly?
>>>
>>>
>>>
>>> Jochen Huber wrote:
>>>    
>>>> Hello,
>>>>
>>>> currently I'm trying to call a DWR method and passing a DOM as an
>>>> argument. Sadly it doesn't work and I don't get any response at all.
>>>> Here's the sample code:
>>>>
>>>> - Server-side Java
>>>>
>>>> public class Testclass {
>>>> [...]
>>>>     public void printRequest(Document doc) {
>>>>         System.out.println("printRequest called.");
>>>>     }
>>>> [...]
>>>> }
>>>>
>>>> - Client-side JavaScript
>>>>
>>>> Testclass.printRequest(document.body);
>>>>
>>>> As a matter of fact, there are no error messages at all. Does anybody
>>>> know the convenient way to do this?
>>>>
>>>> I'm stuck :(
>>>>
>>>> Btw: DWR is set up correctly. I've built several other applications
>>>> using DWR with the same setup.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>> For additional commands, e-mail: users-help@...
>>>>
>>>>
>>>>        
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>
>>>    
>>
>>  
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Transferring a DOM to the server-side

by Jochen Huber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, actually not. It works (or at least should do so) by passing DOM objects.

But passing innerHTML might be an acceptable workaround.

David Marginian-2 wrote:
Aren't you supposed to pass the dom as a string?  Can you try
document.body.innerHTML?

David Marginian wrote:
> Might be able to get a bit more info if you add an error handler to
> your call:
>
> Testclass.printRequest(document.body, {
>        errorHandler: function(errorFromServer) {
>
>            alert("An error occurred.  Details - " + errorFromServer);
>          }
> });
>
> Jochen Huber wrote:
>> David,
>>
>> I'm currently using version 2.0.4. I'm absolutely sure, that there's
>> nothing
>> in the logs. When I call Testclass.printRequest("sample string");
>> then there
>> will be an entry in the logs.
>> I actually need the whole document body. I removed the check for the DOM
>> level (std is < 20) in the source and recompiled them myself. Once
>> again:
>> Everything's working smoothly except the marshalling & seralization
>> of DOM
>> objects. :( So well yes, my dwr.xml is setup correctly.
>>
>>
>> David Marginian-2 wrote:
>>  
>>> I remember seeing a message about this awhile ago and I think there
>>> was a problem with dom serialization -- not sure.  What version of
>>> DWR are you using?  Are you absolutely sure that there is nothing in
>>> the logs?  If DWR is having a problem marshaling the dom you can bet
>>> that there will be an error in the log.  Do you need the entire
>>> document body?  You may be getting a serialization error resulting
>>> from too many nodes.  Are you sure your dwr.xml is set up correctly?
>>>
>>>
>>>
>>> Jochen Huber wrote:
>>>    
>>>> Hello,
>>>>
>>>> currently I'm trying to call a DWR method and passing a DOM as an
>>>> argument. Sadly it doesn't work and I don't get any response at all.
>>>> Here's the sample code:
>>>>
>>>> - Server-side Java
>>>>
>>>> public class Testclass {
>>>> [...]
>>>>     public void printRequest(Document doc) {
>>>>         System.out.println("printRequest called.");
>>>>     }
>>>> [...]
>>>> }
>>>>
>>>> - Client-side JavaScript
>>>>
>>>> Testclass.printRequest(document.body);
>>>>
>>>> As a matter of fact, there are no error messages at all. Does anybody
>>>> know the convenient way to do this?
>>>>
>>>> I'm stuck :(
>>>>
>>>> Btw: DWR is set up correctly. I've built several other applications
>>>> using DWR with the same setup.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
>>>> For additional commands, e-mail: users-help@dwr.dev.java.net
>>>>
>>>>
>>>>        
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
>>> For additional commands, e-mail: users-help@dwr.dev.java.net
>>>
>>>
>>>
>>>    
>>
>>  
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> For additional commands, e-mail: users-help@dwr.dev.java.net
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
For additional commands, e-mail: users-help@dwr.dev.java.net

Re: Transferring a DOM to the server-side

by David Marginian-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not sure either.  I tried to take a look at Jira to see if there is an
2.x issue for this but the server's crashed recently and I think Jira
might still be down.

Jochen Huber wrote:

> Well, actually not. It works (or at least should do so) by passing DOM
> objects.
>
> But passing innerHTML might be an acceptable workaround.
>
>
> David Marginian-2 wrote:
>  
>> Aren't you supposed to pass the dom as a string?  Can you try
>> document.body.innerHTML?
>>
>> David Marginian wrote:
>>    
>>> Might be able to get a bit more info if you add an error handler to
>>> your call:
>>>
>>> Testclass.printRequest(document.body, {
>>>        errorHandler: function(errorFromServer) {
>>>
>>>            alert("An error occurred.  Details - " + errorFromServer);
>>>          }
>>> });
>>>
>>> Jochen Huber wrote:
>>>      
>>>> David,
>>>>
>>>> I'm currently using version 2.0.4. I'm absolutely sure, that there's
>>>> nothing
>>>> in the logs. When I call Testclass.printRequest("sample string");
>>>> then there
>>>> will be an entry in the logs.
>>>> I actually need the whole document body. I removed the check for the DOM
>>>> level (std is < 20) in the source and recompiled them myself. Once
>>>> again:
>>>> Everything's working smoothly except the marshalling & seralization
>>>> of DOM
>>>> objects. :( So well yes, my dwr.xml is setup correctly.
>>>>
>>>>
>>>> David Marginian-2 wrote:
>>>>  
>>>>        
>>>>> I remember seeing a message about this awhile ago and I think there
>>>>> was a problem with dom serialization -- not sure.  What version of
>>>>> DWR are you using?  Are you absolutely sure that there is nothing in
>>>>> the logs?  If DWR is having a problem marshaling the dom you can bet
>>>>> that there will be an error in the log.  Do you need the entire
>>>>> document body?  You may be getting a serialization error resulting
>>>>> from too many nodes.  Are you sure your dwr.xml is set up correctly?
>>>>>
>>>>>
>>>>>
>>>>> Jochen Huber wrote:
>>>>>    
>>>>>          
>>>>>> Hello,
>>>>>>
>>>>>> currently I'm trying to call a DWR method and passing a DOM as an
>>>>>> argument. Sadly it doesn't work and I don't get any response at all.
>>>>>> Here's the sample code:
>>>>>>
>>>>>> - Server-side Java
>>>>>>
>>>>>> public class Testclass {
>>>>>> [...]
>>>>>>     public void printRequest(Document doc) {
>>>>>>         System.out.println("printRequest called.");
>>>>>>     }
>>>>>> [...]
>>>>>> }
>>>>>>
>>>>>> - Client-side JavaScript
>>>>>>
>>>>>> Testclass.printRequest(document.body);
>>>>>>
>>>>>> As a matter of fact, there are no error messages at all. Does anybody
>>>>>> know the convenient way to do this?
>>>>>>
>>>>>> I'm stuck :(
>>>>>>
>>>>>> Btw: DWR is set up correctly. I've built several other applications
>>>>>> using DWR with the same setup.
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>>>> For additional commands, e-mail: users-help@...
>>>>>>
>>>>>>
>>>>>>        
>>>>>>            
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>>> For additional commands, e-mail: users-help@...
>>>>>
>>>>>
>>>>>
>>>>>    
>>>>>          
>>>>  
>>>>        
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>
>>    
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

LightInTheBox - Buy quality products at wholesale price