Re: [flexcoders] Re: Calling Java Servlet

2005-03-25 Thread Harris Reynolds

The fact that RemoteObject uses a servlet is an
implementation detail.  You can see that it is by
looking at the [FLEX_APP]/WEB-INF/web.xml file in your
Flex application.  It is the servlet named
AMFGatewayServlet.

With regard to your problem, depending on how your
code is factored, you may be able to use RemoteObject
out of the box.   Typically you would surface a remote
object that provided a service In your case you
could create a Java object called JavaBeanService (or
whatever) and expose a method on it that returned all
your java beans.  

The point here is that you don't need to muck around
with HTTP level stuff as is the case with your
servlet.  Flex handles that using Flash remoting.

good luck,

~harris


--- Libby [EMAIL PROTECTED] wrote:

 
 Well, my custom servlet already exists. I have read
 all I can find on
 RemoteObject and have not discovered any mention of
 servlet, either
 mine or flex's. Could you tell me exactly where you
 are looking to get
 your info?
 Thanks,
 Libby
 
 --- In flexcoders@yahoogroups.com, Harris Reynolds
 [EMAIL PROTECTED]
 wrote:
  Libby,
  
  It is definitely possible to invoke a servlet from
  Flex b/c I have done it successfully.  If you
 invoke a
  custom servlet though, the burden is on you to
 return
  data in a format that Flex can understand.
  
  I guess I am wondering why you want to invoke a
 custom
  servlet;  it seems like you should be invoking the
  remoting gateway servlet that ships with Flex and
  automatically handles data (un)marshalling of java
  objects for you.  See the RemoteObject component
 for
  more information.
  
  good luck,
  
  ~harris
  
  
  --- Libby [EMAIL PROTECTED] wrote:
   
   No, I'm returning an array of javabeans. At this
   point I am wondering
   if it is even possible to call a servlet from
 Flex
   since they don't
   have an example of doing it. I have successfully
   invoked some other
   java objects, but not servlets so far.
   
   --- In flexcoders@yahoogroups.com, Harris
 Reynolds
   [EMAIL PROTECTED]
   wrote:
Libby,

If you are returning a chunck of XML one
 simple
   option
is to call your servlet using the HTTPService
 Flex
control.  Using this approach you can attach
 the
result to a data provide and Flex will wire it
 all
   up
for you.  An example of this can be found here
   [1]. 
It uses a JSP page instead of a servlet, but
 the
concept is the same.

Hope this helps,

~harris

[1]
   
  
 

http://flexapps.macromedia.com/flex15/explorer/explorer.mxml
  (See Dynamic Data Services - HTTP Service)


--- Libby [EMAIL PROTECTED] wrote:
 
 Hello,
 I am evaluating Flex. We have flash Remoting
   calling
 some servlets
 running on Websphere 5.1, and for my eval I
 am
 trying to build a
 similiar interface to them. So far I cannot
 find
   an
 example of how to
 do this (call a servlet with arguments) so I
 was
 hoping someone here
 could show me a tiny example, or offer
   corrections
 to my code?
 
 Using flash, we call a controller servlet
 using
   one
 or more arguments.
 ItemDefServlet(getAllRecords); -- like
 this
   in
 Flash
 
 In Flex, this is what I have:
 mx:RemoteObject type=servlet
 source=maintenance.ItemDefServlet
 protocol=http
 id=remoteobject1/mx:RemoteObject
 
 
 mx:DataGrid id=ItemDef_grd

  
 dataProvider={remoteobject2.getMessage.result}
 .
 .
 /mx:DataGrid
   mx:ControlBar
 mx:Button label=Get All
 click=remoteobject1.send() /
   /mx:ControlBar
 thanks,
 Libby
 
 
 
 



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources
   site!
http://smallbusiness.yahoo.com/resources/
   
   
   
   
  
  
  
  __ 
  Do you Yahoo!? 
  Yahoo! Small Business - Try our new resources
 site!
  http://smallbusiness.yahoo.com/resources/
 
 
 
 




__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 


 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





RE: [flexcoders] Re: Calling Java Servlet

2005-03-25 Thread Cathy Murphy

Libby -

I think this is possible but haven't tried it myself.
Here's some information which should set you down the right path.  Good
luck!

I've seen examples for the Flex 1.0 session servlet [Replaced in Flex
1.5 with new session access but not relevant to this discussion.]

http://www.macromedia.com/devnet/flex/articles/flex_portals/flex_portals
_whitepaper.pdf
'Accessing the portlet session' - Again, you would be accessing your
servlet instead of the 'session' servlet.

http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=97b1769b
Troubleshooting for the session servlet which would be relevant in your
case as well.

mx:RemoteObject source=servlet id=remoteobject1 protocol=http/
// cmurphy - the source should always be servlet

mx:Button label=Get All
click=remoteobject1.yourServletName('yourServletArg1',
'yourServletArg2') /

Instead of specifying the class name of you're servlet directly, map
yourServletName to the class name of the servlet in web.xml.

- Cathy

 http://flexapps.macromedia.com/flex15/explorer/explorer.mxml


 --- Libby [EMAIL PROTECTED] wrote:
  
  Hello,
  I am evaluating Flex. We have flash Remoting
calling
  some servlets
  running on Websphere 5.1, and for my eval I
  am
  trying to build a
  similiar interface to them. So far I cannot
  find
an
  example of how to
  do this (call a servlet with arguments) so I
  was
  hoping someone here
  could show me a tiny example, or offer
corrections
  to my code?
  
  Using flash, we call a controller servlet
  using
one
  or more arguments.
  ItemDefServlet(getAllRecords); -- like
  this
in
  Flash
  
  In Flex, this is what I have:
  mx:RemoteObject type=servlet
  source=maintenance.ItemDefServlet
  protocol=http
  id=remoteobject1/mx:RemoteObject
  
  
  mx:DataGrid id=ItemDef_grd
 
   
  dataProvider={remoteobject2.getMessage.result}
  .
  .
  /mx:DataGrid
mx:ControlBar
mx:Button label=Get All
  click=remoteobject1.send() /
  /mx:ControlBar
  thanks,
  Libby
  
  
  
  
 
 
   
 __ 
 Do you Yahoo!? 
 Yahoo! Small Business - Try our new resources
site!
 http://smallbusiness.yahoo.com/resources/




   
   
 
   __ 
   Do you Yahoo!? 
   Yahoo! Small Business - Try our new resources
  site!
   http://smallbusiness.yahoo.com/resources/
  
  
  
  
 
 
 
   
 __ 
 Do you Yahoo!? 
 Yahoo! Small Business - Try our new resources site!
 http://smallbusiness.yahoo.com/resources/ 
 
 
  
 Yahoo! Groups Links
 
 
 
  
 
 
 
 


 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





RE: [flexcoders] Re: Calling Java Servlet

2005-03-25 Thread Peter Farland

Hi Libby,

You can invoke a servlet, but it's really a deprecated method of
contacting the server from Flash Remoting. It's not a preferred method
as the 
servicename.functioname() invocation isn't as straight forward as a
plain old java object classname.methodname() idea.

For a servlet invocation, the service name is the context root of the
web application that holds your servlet. The function name is the
servlet name (as your servlet is contacted via a
ServletContext.getNamedDispatcher(...)). Parameters are send in a
FLASH.PARAMS request attribute so that you can get access to them in
your servlet. The result from your servlet can be set as the
FLASH.RESULT request attribute.

The main reason why people used servlets in Flash Remoting MX was to get
access to the HttpServletRequest (and hence the session), and
HttpServletResponse. You can do this in Flex 1.5 from your plain old
java objects by calling the static accessors to some thread local
variables on the Gateway class:


flashgateway.Gateway

public static HttpServletRequest getHttpRequest()
public static HttpServletResponse getHttpResponse()
public static ServletConfig getServletConfig()

 
Rgds,
   Pete


 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





[flexcoders] Re: Calling Java Servlet

2005-03-24 Thread Libby


No, I'm returning an array of javabeans. At this point I am wondering
if it is even possible to call a servlet from Flex since they don't
have an example of doing it. I have successfully invoked some other
java objects, but not servlets so far.

--- In flexcoders@yahoogroups.com, Harris Reynolds [EMAIL PROTECTED]
wrote:
 Libby,
 
 If you are returning a chunck of XML one simple option
 is to call your servlet using the HTTPService Flex
 control.  Using this approach you can attach the
 result to a data provide and Flex will wire it all up
 for you.  An example of this can be found here [1]. 
 It uses a JSP page instead of a servlet, but the
 concept is the same.
 
 Hope this helps,
 
 ~harris
 
 [1]
 http://flexapps.macromedia.com/flex15/explorer/explorer.mxml
   (See Dynamic Data Services - HTTP Service)
 
 
 --- Libby [EMAIL PROTECTED] wrote:
  
  Hello,
  I am evaluating Flex. We have flash Remoting calling
  some servlets
  running on Websphere 5.1, and for my eval I am
  trying to build a
  similiar interface to them. So far I cannot find an
  example of how to
  do this (call a servlet with arguments) so I was
  hoping someone here
  could show me a tiny example, or offer corrections
  to my code?
  
  Using flash, we call a controller servlet using one
  or more arguments.
  ItemDefServlet(getAllRecords); -- like this in
  Flash
  
  In Flex, this is what I have:
  mx:RemoteObject type=servlet
  source=maintenance.ItemDefServlet
  protocol=http
  id=remoteobject1/mx:RemoteObject
  
  
  mx:DataGrid id=ItemDef_grd
  dataProvider={remoteobject2.getMessage.result}
  .
  .
  /mx:DataGrid
mx:ControlBar
mx:Button label=Get All
  click=remoteobject1.send() /
  /mx:ControlBar
  thanks,
  Libby
  
  
  
  
 
 
   
 __ 
 Do you Yahoo!? 
 Yahoo! Small Business - Try our new resources site!
 http://smallbusiness.yahoo.com/resources/





 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [flexcoders] Re: Calling Java Servlet

2005-03-24 Thread Harris Reynolds

Libby,

It is definitely possible to invoke a servlet from
Flex b/c I have done it successfully.  If you invoke a
custom servlet though, the burden is on you to return
data in a format that Flex can understand.

I guess I am wondering why you want to invoke a custom
servlet;  it seems like you should be invoking the
remoting gateway servlet that ships with Flex and
automatically handles data (un)marshalling of java
objects for you.  See the RemoteObject component for
more information.

good luck,

~harris


--- Libby [EMAIL PROTECTED] wrote:
 
 No, I'm returning an array of javabeans. At this
 point I am wondering
 if it is even possible to call a servlet from Flex
 since they don't
 have an example of doing it. I have successfully
 invoked some other
 java objects, but not servlets so far.
 
 --- In flexcoders@yahoogroups.com, Harris Reynolds
 [EMAIL PROTECTED]
 wrote:
  Libby,
  
  If you are returning a chunck of XML one simple
 option
  is to call your servlet using the HTTPService Flex
  control.  Using this approach you can attach the
  result to a data provide and Flex will wire it all
 up
  for you.  An example of this can be found here
 [1]. 
  It uses a JSP page instead of a servlet, but the
  concept is the same.
  
  Hope this helps,
  
  ~harris
  
  [1]
 

http://flexapps.macromedia.com/flex15/explorer/explorer.mxml
(See Dynamic Data Services - HTTP Service)
  
  
  --- Libby [EMAIL PROTECTED] wrote:
   
   Hello,
   I am evaluating Flex. We have flash Remoting
 calling
   some servlets
   running on Websphere 5.1, and for my eval I am
   trying to build a
   similiar interface to them. So far I cannot find
 an
   example of how to
   do this (call a servlet with arguments) so I was
   hoping someone here
   could show me a tiny example, or offer
 corrections
   to my code?
   
   Using flash, we call a controller servlet using
 one
   or more arguments.
   ItemDefServlet(getAllRecords); -- like this
 in
   Flash
   
   In Flex, this is what I have:
   mx:RemoteObject type=servlet
   source=maintenance.ItemDefServlet
   protocol=http
   id=remoteobject1/mx:RemoteObject
   
   
   mx:DataGrid id=ItemDef_grd
  
 dataProvider={remoteobject2.getMessage.result}
   .
   .
   /mx:DataGrid
 mx:ControlBar
   mx:Button label=Get All
   click=remoteobject1.send() /
 /mx:ControlBar
   thanks,
   Libby
   
   
   
   
  
  
  
  __ 
  Do you Yahoo!? 
  Yahoo! Small Business - Try our new resources
 site!
  http://smallbusiness.yahoo.com/resources/
 
 
 
 



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 


 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





[flexcoders] Re: Calling Java Servlet

2005-03-24 Thread Libby


Well, my custom servlet already exists. I have read all I can find on
RemoteObject and have not discovered any mention of servlet, either
mine or flex's. Could you tell me exactly where you are looking to get
your info?
Thanks,
Libby

--- In flexcoders@yahoogroups.com, Harris Reynolds [EMAIL PROTECTED]
wrote:
 Libby,
 
 It is definitely possible to invoke a servlet from
 Flex b/c I have done it successfully.  If you invoke a
 custom servlet though, the burden is on you to return
 data in a format that Flex can understand.
 
 I guess I am wondering why you want to invoke a custom
 servlet;  it seems like you should be invoking the
 remoting gateway servlet that ships with Flex and
 automatically handles data (un)marshalling of java
 objects for you.  See the RemoteObject component for
 more information.
 
 good luck,
 
 ~harris
 
 
 --- Libby [EMAIL PROTECTED] wrote:
  
  No, I'm returning an array of javabeans. At this
  point I am wondering
  if it is even possible to call a servlet from Flex
  since they don't
  have an example of doing it. I have successfully
  invoked some other
  java objects, but not servlets so far.
  
  --- In flexcoders@yahoogroups.com, Harris Reynolds
  [EMAIL PROTECTED]
  wrote:
   Libby,
   
   If you are returning a chunck of XML one simple
  option
   is to call your servlet using the HTTPService Flex
   control.  Using this approach you can attach the
   result to a data provide and Flex will wire it all
  up
   for you.  An example of this can be found here
  [1]. 
   It uses a JSP page instead of a servlet, but the
   concept is the same.
   
   Hope this helps,
   
   ~harris
   
   [1]
  
 
 http://flexapps.macromedia.com/flex15/explorer/explorer.mxml
 (See Dynamic Data Services - HTTP Service)
   
   
   --- Libby [EMAIL PROTECTED] wrote:

Hello,
I am evaluating Flex. We have flash Remoting
  calling
some servlets
running on Websphere 5.1, and for my eval I am
trying to build a
similiar interface to them. So far I cannot find
  an
example of how to
do this (call a servlet with arguments) so I was
hoping someone here
could show me a tiny example, or offer
  corrections
to my code?

Using flash, we call a controller servlet using
  one
or more arguments.
ItemDefServlet(getAllRecords); -- like this
  in
Flash

In Flex, this is what I have:
mx:RemoteObject type=servlet
source=maintenance.ItemDefServlet
protocol=http
id=remoteobject1/mx:RemoteObject


mx:DataGrid id=ItemDef_grd
   
  dataProvider={remoteobject2.getMessage.result}
.
.
/mx:DataGrid
  mx:ControlBar
  mx:Button label=Get All
click=remoteobject1.send() /
/mx:ControlBar
thanks,
Libby




   
   
 
   __ 
   Do you Yahoo!? 
   Yahoo! Small Business - Try our new resources
  site!
   http://smallbusiness.yahoo.com/resources/
  
  
  
  
 
 
   
 __ 
 Do you Yahoo!? 
 Yahoo! Small Business - Try our new resources site!
 http://smallbusiness.yahoo.com/resources/





 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/