Thanks for the info Dan.  That does sound like a better solution than what I
had working before.  I had actually started writing an Interceptor last
night because I realized that with the Servlet transport I can detect if
user-agent contains 'XFire' and then do some funky stuff with the message
before it is unmarshalled.  That way it won't affect performance for
requests coming from CXF clients.  Unfortunately the 'funky stuff' part is
where I am at now and am a little lost.  I'm currently looking at a few of
the other interceptors to see what they do and hopefully I can figure it
out.  Any tips on how to get started with wrapping a XMLStreamReader and
what interceptor phase to do this in (RECEIVE, *_STREAM)?  Are there any
interceptors that do something similar that I should look at?  I know how
I'll find the proper parameter names etc., but am unfamiliar with how the
overall process should be done.  Thanks for the help,

Kevin


-----Original Message-----
From: Daniel Kulp [mailto:[email protected]] 
Sent: March-13-09 12:06 PM
To: [email protected]
Cc: Kevin Priebe
Subject: Re: XFire migration - old client doesn't send named parameters


CXF is pretty strict about matching the messages up with the schema.  If
they 
don't match, it really won't find the correct parts and deserialize things.

That's what you are seeing.   "in0 != board"

The only option is to write a "filter/mapper" that would map the incoming
data 
into the data that does match the schema.   The most performant way to do
that 
would be to write a XMLStreamReader that wrappers the original
XMLStreamReader 
and whenever the token is start element or similar, map the element names.

An interceptor would just need to put your reader in place.

Dan


On Thu March 12 2009 2:10:41 pm Kevin Priebe wrote:
> Hi, I have ported all of our XFire services/clients to CXF and only have 1
> outstanding issue that is preventing any old XFire clients from working
> with the new CXF service.  Our old XFire clients seem to send non-named
> parameters (in0, in1) like so:
>
>
>
> <soap:Body><ns1:ping
>
xmlns:ns1="http://service.realtyserver.com";><ns1:in0>testValue</ns1:in0></n
>s 1:ping></soap:Body>
>
>
>
> Whereas the WSDL has the 'in0' parameter named as 'board'.  This causes
the
> parameter to be NULL when received.  The new CXF client correctly sends
> like so:
>
>
>
> <soap:Body><ns1:ping
>
xmlns:ns1="http://service.realtyserver.com/";><board>testValue</board></ns1:
>p ing></soap:Body>
>
>
>
> The missing slash was also a problem, but that has been resolved since if
I
> manually change the XFire request in0 -> board, and resend the request it
> works.  So I just need to figure out the parameter problem.
>
>
>
> I would really like to make this backwards compatible for the old XFire
> clients at least for a few months while we make the transition.  Is there
> any workaround for this?
>
>
>
> I am using XFire 1.2.6 (was using simple frontend and aegis) and CXF 2.1.4
> (with jaxws and aegis).  All using tomcat with spring server config.
>
>
>
> I have tried the simple frontend and now am trying the jaxws frontend with
> annotated web services to name the parameters using @WebParam since the
> simple frontend was causing the CXF client to send parameters as arg0,
arg1
> etc.  Here are the relevant files:
>
>
>
> @WebService
>
> public interface IAuthService {
>
>                 public boolean ping(@WebParam(name="board") String board);
>
> }
>
>
>
> @WebService(endpointInterface="com.realtyserver.service.IAuthService",
> serviceName="AuthService")
>
> public class AuthService implements IAuthService {
>
>                 public boolean ping(String board) {
>
>                                 return true;
>
>                 }
>
> }
>
>
>
> cxf.xml
>
> --------
>
>
>
> <bean id="aegisBean"
> class="org.apache.cxf.aegis.databinding.AegisDatabinding"
> scope="prototype"/>
>
>
>
> <bean id="jaxws-and-aegis-service-factory"
>
>
> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
>
>                                 scope="prototype">
>
>                                 <property name="dataBinding"
> ref="aegisBean"/>
>
>                                 <property name="serviceConfigurations">
>
>                                 <list>
>
>                                                 <bean
> class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
>
>                                                 <bean
>
class="org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfigurat
>i on"/>
>
>                                                 <bean
> class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
>
>                                 </list>
>
>                 </property>
>
> </bean>
>
>
>
> <bean id="AuthServiceImpl" class="serviceImpl.AuthService"/>
>
>
>
> <jaxws:endpoint id="AuthServceEndpoint" address="/AuthService"
> implementor="#AuthServiceImpl">
>
>                 <jaxws:serviceFactory>
>
>                                 <ref
bean="jaxws-and-aegis-service-factory"
> />
>
>                 </jaxws:serviceFactory>
>
> </jaxws:endpoint>
>
>
>
> Thanks for any help.
>
> Kevin

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to