Thats sounds interesting.
I have to take a look at into this.

On Mon, 2004-02-16 at 23:07, Simon Stewart wrote:
I've put together an XMLRPC dispatcher and view for Webwork 2, and 
thought that maybe some of you would like to know that it's available, 
and how it works. Read on if you're interested....

http://jira.opensymphony.com/secure/ViewIssue.jspa?key=WW-467

It's composed of several parts, but the key ones are the 
XmlRpcDispatcher, which can be used in place of the normal 
ServletDispatcher and the XmlRpcDispatcherResult, which maps results to 
an XMLRPC "methodResponse" and a PositionalParameterInterceptor.

The PositionalParameterInterceptor (other than having a snappy name) 
takes the parameters of an XMLRPC method call and maps them from their 
positions to a set of space separated OGNL paths, using the static 
Action parameter "XmlRpcPaths":

<action name="manyParams"
   class="org.pubbitch.actions.ManyParamsAction">
     <param name="XmlRpcPaths">username password</param>
     <result name="success">
       <param name="location">result</param>
     </result>
</action>

In this case, the first parameter is mapped to "username", and the 
second to "password". More examples are included in the attached 
"xwork.xml" file.

Assuming that the XmlRpcDispatcherResult is being used, the "location" 
parameter of the results is again an OGNL path, which is adapted to an 
XMLRPC "methodResponse" by the DefaultObjectAdapter. There are some more 
examples of how to use the XmlRpc classes included in the "src/test" 
directory of the archives attached to the JIRA issue.

The only other thing to note is that the dispatcher uses the name of the 
method to try and determine the package; a call to "blogger.getUserInfo" 
  would look for an action named "getUserInfo" in the package called 
"blogger"

So, what are the disadvantages and advantages of using this dispatcher 
rather than (say) Apache's XMLRPC code?

*) It integrates nicely with Webwork, meaning that you don't need to 
learn another API

*) This XMLRPC code doesn't contain any extra dependencies, which means 
fewer jars are needed in your application

*) This XMLRPC code is missing certain features, specifically support 
for Base64 encoded parameters.

*) The Apache code has been better tested. For instance, the Date code 
in the "SpecBasedParser" definitely needs some more hostile testing.

*) It's a nice "proof of concept" for XWork/Webwork since very little 
additional work needed to be done once the XMLRPC adapter and parser had 
been written.

Shout if you have questions!

Regards,

Simon

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" "http://www.opensymphony.com/xwork/xwork-1.0.dtd">

<xwork>
    <include file="webwork-default.xml"/>
    <package name="example" extends="webwork-default">
    
    	<result-types>
    		<result-type name="xmlrpc" class="org.pubbitch.webwork.xmlrpc.XmlRpcDispatcherResult" default="true" />
    	</result-types>
   		
        <interceptors>
                <interceptor name="xmlrpc" class="org.pubbitch.webwork.xmlrpc.interceptor.PositionalParameterInterceptor" />
                
                <interceptor-stack name="xmlrpcStack">
                	<interceptor-ref name="xmlrpc" />
                </interceptor-stack>
        </interceptors>

		<default-interceptor-ref name="xmlrpcStack"/>
		
		<action name="manyParams" class="org.pubbitch.actions.ManyParamsAction">
			<param name="XmlRpcPaths">username password</param>
			<result name="success">
				<param name="location">result</param>
			</result>
		</action>
	</package>
</xwork>
--
Matthew Payne <[EMAIL PROTECTED]>

Reply via email to