[Opensource] Apache Axis integration
Sandra Cann
scann at jcorporate.com
Thu Jul 11 12:49:23 PDT 2002
Dear Community,
I've been contacted by a community member who is working on an application
with the Expresso Framework which requires the ability to offer some of the
functionality of the application as Web Services. He asked about Axis. In
the design of what is planned for web services - I was wondering if Apache
Axis should be reflected? I was wondering what others thought of this.
Recently there was a posting on the Struts Dev list about Axis so for
additional insight I am including it.
Cheers
Sandra
-----Original Message-----
From: Kevin.Bedell at sunlife.com [mailto:Kevin.Bedell at sunlife.com]
Sent: Friday, June 28, 2002 10:36 AM
To: struts-dev at jakarta.apache.org
Subject: Struts for serving Web Services - dev list
I follow the Axis list and have been doing quite a bit of Web Services work
for my job recently.
Here's a note I got from one of the list members that works at Macromedia
in their Server Development group (they put out Jrun and Cold Fusion). He
says that they are embedding Axis directly into both Cold Fusion and JRun
to make it easy to deploy web services on that platform.
If there are thoughts about adding functionality to Struts to make it easy
to use to build Web Services, then it may be worth looking at these two
products and how they've done it.
Thought that the developers on this list may find it valuable to see this.
In addition, I've put some thought to it and feel it may not be difficult
to adapt Struts as a Web Service platform:
- Model components would not change much (and could be reused between
Struts apps and Struts Web Services apps
- The ActionServlet would need to recognize SOAP requests (from the
SoapAction header or some other way) and process them slightly different.
- Much of the changes to the ActionServlet may just be done using Axis
functionality. These changes would include:
- Send back WSDL if it were asked (using Axis functionality).
- Deserialize soap arguments/attachments (using Axis
functionality).
- Populate the arguments into the form bean
- Continue processing as it does now.
- This would be probably be built by ceating helper classes called by
the ActionServlet.
- The Action classes users create would have to change some - here is what
I'm thinking:
- Create a WebServiceAction (that might just subclass Action). Then
MyAction.java would begin:
public class MyAction extends WebServiceAction {
instead of
public class MyAction extends Action {
- WebServiceAction would have it's primary method be:
public WebServiceResponse execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
returning a WebServiceResponse instead of an ActionForward.
I think this is fine because a "view" in WebServices is
different - it's the encoded data in the web service response - not HTML.
Struts users shouldn't have to know how to encode the XML
response - if they return a collection of values, then Struts should handle
the
rest (using Axis).
- WebServiceResponse.java would replace ActionForward as the "thing" you
return from an Action.
- It would encapsulate the data for the response.
- It would be able to map each data element returned to its argument as
defined in the WSDL (struts-config entries here to point to the WSDL?)
- It would be able to serialize the data elements (using Axis
functionality).
- The ActionServlet then would be able to take a WebServiceResponse and use
Axis functionality to turn that into the actual XML going out - and then
send the response.
I think this is doable - the people at Macromedia are already doing
something like it. The detail would likely be slightly different than what
I've
laid out, but it's a place to start.
I'll look at this some more as I have time, but would be interested in
discussing it on the list if people have time. I know you're all gearing up
for
the next beta release.
Thanks for the efforts,
Kevin
---------------------- Forwarded by Kevin Bedell/Systems/USHO/SunLife on
06/28/2002 10:10 AM ---------------------------
Tom Jordahl <tomj at macromedia.com> on 06/27/2002 02:31:51 PM
Please respond to axis-user at xml.apache.org
To: "'axis-user at xml.apache.org'" <axis-user at xml.apache.org>
cc: (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject: RE: Interesting TAG -> Code Questions
Kevin,
<blatant-product-plug>
ColdFusion MX has much cooler support for web services, the <CFINVOKE> tag.
You can provide a WSDL file and CFMX will run the Axis WSDL2Java under the
covers, compile it, convert all of your ColdFusion structures and arguments
to the right Java types, invoke the web service using the generated
proxies, then convert the output back in to CFML variables. (it only does
the generation the first time, so its not as slow as it sounds!)
Makes it trivial to use a web service.
You can also publish web services written in CFML (called ColdFusion
Components or CFC's) with a single Admin step.
Download the FREE developer edition at
http://www.macromedia.com/sorfware/coldfusion.
</blatant-product-plug>
One quick warning, both JRun and ColdFusion MX embed Axis Beta 1 currently,
although we have aggressive plans to update that to Axis 1.0 (when
released)
--
Tom Jordahl
Macromedia Server Development
-----Original Message-----
From: Kevin.Bedell at sunlife.com [mailto:Kevin.Bedell at sunlife.com]
Sent: Thursday, June 27, 2002 2:09 PM
To: axis-user at xml.apache.org
Subject: RE: Interesting TAG -> Code Questions
Tom -
Will this tag lib make its way into Cold Fusion?
Tom Jordahl <tomj at macromedia.com> on 06/27/2002 02:22:19 PM
Please respond to axis-user at xml.apache.org
To: "'axis-user at xml.apache.org'" <axis-user at xml.apache.org>
cc: (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject: RE: Interesting TAG -> Code Questions
Hi Mick,
First, let me just point out that the webservice tag you are using is a
feature of JRun, not part of Axis. I am glad you are having success with
the tag, since I wrote it.
Anyway, to answer your Axis coding questions
1. You need to register a type mapping. You need the following call:
call.registerTypeMapping(
com.themindelectric.www.LocationInfo.class,
new QName(
"http://www.themindelectric.com/package/com.esri.is.services.common/"
"LocationInfo"),
org.apache.axis.encoding.ser.BeanSerializerFactory.class,
org.apache.axis.encoding.ser.BeanDeserializerFactory.class);
2. You need to set a SoapAction in the tag (use soapaction="") or in the
Call:
call.setUseSOAPAction(true);
call.setSOAPActionURI("action here");
For .NET, you will probably need to set the style= attribute when using the
tag to "wrapped" and the use= attribute to "literal".
A really good way to figure out what Axis client code is needed is to run
the WSDL2Java tool on the WSDL for the service you are trying to access,
then examining the Stub code that is generated.
--
Tom Jordahl
Macromedia
More information about the Opensource
mailing list