HeadlessClientFactory.createSessionBean without a Request

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

HeadlessClientFactory.createSessionBean without a Request

Postby michaelwirz » Thu May 18, 2006 7:47 pm

Hello Jan!

Again its me working with the Headless Client. this time we try to apply an axis
frontend to the headless client interface -- just to provide rpc-style mehtod invocation
instead of the plain http/jsp interface. This will lead to tight integration when thinking
of the xml-plugin of Mr. Ruhsert at Dr. Maison.

We recently tried to call HeadlessClientFactories createSessionBean from within
a context where no HttpRequest is available, i.e. we called the createSessionBean-method with a "null"-Argument for the request parameter.
The Headless client started and came up, but unfortunately it did not work
-- we suggest that on intialization something important did not happen.

We'd kindly appreciate any hint on why a HttpServletRequest is needed when
bringing up a headless servoy client instance. Is there any way you know of
to substitute the HttpServlerRequest-parameter? What infomration does
headless client init take from the request?

Thanks for a quick response since this is a very hot topic at our team in the moment.

Cheers,
Michael
michaelwirz
 
Posts: 23
Joined: Mon Sep 13, 2004 1:47 pm

Postby pbakker » Mon May 22, 2006 9:24 am

Hi Michael,

Can't you retrieve the request with the following code:
Code: Select all
      ServletRequest request = getRequest();      
, before calling
Code: Select all
HeadlessClientFactory.createSessionBean(request,"solutionname");
?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby michaelwirz » Mon May 22, 2006 12:17 pm

On what instance do you call the "getRequest()" - method?
This depends on the context you are in. In a jsp you have a
request instance which is given to you by tomcat.
In an axis-RPC you do not have that directly..

I am just about to mock a request to see what the Headless Client
calls in the interface, since that cant be too much...

Servoy-Core-Developers: Can you provide with any hint?

Thanks,
Michael
michaelwirz
 
Posts: 23
Joined: Mon Sep 13, 2004 1:47 pm

Postby michaelwirz » Mon May 22, 2006 12:59 pm

Ok, at last:

As I suspected, it is not much the HeadlessClient does with the http-request it gets passed.
It just calls getLocale (in our setup). This can be mocked easily.

So, taking care of the Instance-Handling ourselves (i.e. we have no session or application
context as in the demo jsps), we are able to use an axis-RPC-style Frontend for the
Headless-Client.
Thus it is much more easy now to integrate service-calls from within a different Java
environment. No more URL/HTTP explicit stuff. Just get your WSDL and let axis generate
the client stub code for you.

And if you dont like RPC style you can enhance this to the other message styles as you like...

Is anyone interested in stuff like that?

- Michael
michaelwirz
 
Posts: 23
Joined: Mon Sep 13, 2004 1:47 pm

Postby pbakker » Mon May 22, 2006 1:06 pm

Don't really get what you achieved... :(

I thought you were trying to use the HeadLess client to publish methods as (SOAP) WebServices.

Maybe some more description of what you achieved?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby jcompagner » Mon May 22, 2006 1:22 pm

It is not really needed. You can give null to it it should work fine. This is also how batch processors are getting started.

What then can't be done is get the session client back for a second request.. So you can only use it once.

So what did go wrong? what didn't work?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby michaelwirz » Mon May 22, 2006 3:46 pm

@pbakker: Thats what we use now. Servoy methods be published as SOAP webservices.

@jcompagner: I made a mistake in the call to the servoy form-method itself. null as value
for the request parameter in the HeadlessClientFactory works fine.

Thank you,
Michael
michaelwirz
 
Posts: 23
Joined: Mon Sep 13, 2004 1:47 pm

Postby pbakker » Mon May 22, 2006 3:49 pm

That is interesting then :)

Played around with it myself, got it working, but only in a hardcoded way, meanign that you had to hardcoded the Solution, form and method name in the Java code and then compile it.

How does your functionality work?

Can you publish methods by scripting in Servoy?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby michaelwirz » Tue May 23, 2006 2:00 pm

Eeasiest way to get around this is to provide all
the static data in the webservice call itself.
Design suggestion:
Have one form and one method hardcoded and dispatch
the functions in a servoy-side-dispatcher -- this could be done just by scripting.
We use a scheme like this in our (old) headlessclient-jsp setup.

- Michael
michaelwirz
 
Posts: 23
Joined: Mon Sep 13, 2004 1:47 pm

Postby pbakker » Tue May 23, 2006 2:04 pm

OK, that does work basically just like the plugin I created myself.

So, yes, it's interesting, but for me: I allready have uild that myself :)

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 6 guests