|
From: Michael S. <mi...@sc...> - 2005-01-06 01:43:21
|
I've stumbled again on my quest to make Axis and Spring work together in
the way I want them to. One of my operations has an out parameter (in
WSDL: a part of the output message that does not appear in the
operation's parameterOrder attribute; see JAX-RPC 4.3.4).
Now, JaxRpcPortProxyFactoryBean passes in all arguments from the proxied
interface to Call#invoke(Object[]). Unfortunately, in this specific
case, that's not the right thing to do. Instead, two things ought to
happen
(1) Only those arguments listed in the parameterOrder ought to be passed
to invoke.
With the means of plain JAX-RPC this is not possible, AFAICT. For
org.apache.axis.client.Call there's a way through getOperation() ->
getParameters() -> getMode() == OUT.
(2) Out parameters need to be extracted from the call object somewhat
painfully. In code generated by Axis' wsdl2java, it looks like this
(slightly changed for readability)
extractAttachments(_call);
java.util.Map _output;
_output = _call.getOutputParams();
try {
expiration.value = (Calendar) _output.get(
new QName("http://ns", "expires"));
} catch (Exception _exception) {
expiration.value = (Calendar) JavaUtils.convert(_output.get(
new QName("http://ns", "expires")), Calendar.class);
}
Again, the needed metadata is provided by the Axis implementation
classes, but are not in JAX-RPC.
When I started to write this message I thought of the problem as a
hopeless case. In the meantime it looks quite solvable. I'll probably
have a go at it in the next couple of days. Thus if anyone else intends
to do something similar, please contact me.
Michael
--
Michael Schuerig Face reality and stare it down
mailto:mi...@sc... --Jethro Tull, Silver River Turning
http://www.schuerig.de/michael/
|
|
From: Michael S. <mi...@sc...> - 2005-01-08 02:25:27
|
On Thursday 06 January 2005 02:42, Michael Schuerig wrote:
> I've stumbled again on my quest to make Axis and Spring work together
> in the way I want them to. One of my operations has an out parameter
> (in WSDL: a part of the output message that does not appear in the
> operation's parameterOrder attribute; see JAX-RPC 4.3.4).
[snip]
> I'll probably have a go at it in the next couple of days. Thus if
> anyone else intends to do something similar, please contact me.
So, now I've got a factory bean that creates a "tweakable" web service
client using Axis. The factory helps with declarative type mapping,
unwraps business exceptions, handles out parameters and allows to set
document-style services to be "wrapped". See below for a sample
configuration.
I really don't want to keep this to myself. The same goes for other
smallish-but-reusable stuff I've written in the past few months; tests
included, of course. But what can I do to avoid this? I could put the
code on my web site where nobody will find it. What I'm looking for is
some kind of Spring Component Playground for bits and pieces that snap
into Spring but are not (yet) part of the official distribution.
Something with a wider scope and access than the existing sandbox.
Michael
<bean id="webserviceclient"
class="de.schuerig.webservices.AxisClientFactoryBean">
<property name="serviceFactoryClass">
<value>org.apache.axis.client.ServiceFactory</value>
</property>
<property name="wsdlDocumentUrl">
<value>http://serviceprovider.net/service?wsdl</value>
</property>
<property name="timeout">
<value>30000</value> <!-- milliseconds -->
</property>
<property name="namespaceUri">
<value>http://serviceprovider.net/service</value>
</property>
<property name="typeNamespaceUri">
<value>http://serviceprovider.net/service/types</value>
</property>
<property name="serviceName">
<value>TheService</value>
</property>
<property name="portName">
<value>TheSoapPort</value>
</property>
<property name="serviceInterface">
<value>net.example.TheService</value>
</property>
<property name="wrappedStyle">
<value>false</value>
</property>
<property name="encodingStyleUri">
<value></value> <!-- for literal -->
</property>
<property name="typeMappings">
<list>
<bean class="de.schuerig.webservices.TypeMappingDesc">
<property name="javaType">
<value>net.example.SomeBean</value>
</property>
<property name="xmlType">
<value>someBean</value>
</property>
</bean>
<bean class="de.schuerig.webservices.TypeMappingDesc">
<property name="javaType">
<value>net.example.SomeBean[]</value>
</property>
<property name="xmlType">
<value>SomeBeanList</value>
</property>
</bean>
<bean class="de.schuerig.webservices.TypeMappingDesc">
<property name="javaType">
<value>net.example.SpecialBean</value>
</property>
<property name="xmlType">
<value>specialBean</value>
</property>
<property name="serializerFactory">
<value>net.example.SpecialBeanSerializerFactory</value>
</property>
<property name="deserializerFactory">
<value>net.example.SpecialBeanDeserializerFactory</value>
</property>
</bean>
</list>
</property>
</bean>
--
Michael Schuerig The more it stays the same,
mailto:mi...@sc... The less it changes!
http://www.schuerig.de/michael/ --Spinal Tap, The Majesty of Rock
|
|
From: Colin S. <col...@ex...> - 2005-01-08 03:48:56
|
Michael, For about a good 6 months or so now I keep meaning to set up a 'cookbook' area on the wiki where people can put shorts bits of code and tips for doing things. You could perhaps put up the stuff on the wiki, and I'll try to organize it a bit more in about 2-3 weeks when I am done with the project I am on now... Colin Michael Schuerig wrote: >On Thursday 06 January 2005 02:42, Michael Schuerig wrote: > > >>I've stumbled again on my quest to make Axis and Spring work together >>in the way I want them to. One of my operations has an out parameter >>(in WSDL: a part of the output message that does not appear in the >>operation's parameterOrder attribute; see JAX-RPC 4.3.4). >> >> >[snip] > > >>I'll probably have a go at it in the next couple of days. Thus if >>anyone else intends to do something similar, please contact me. >> >> > >So, now I've got a factory bean that creates a "tweakable" web service >client using Axis. The factory helps with declarative type mapping, >unwraps business exceptions, handles out parameters and allows to set >document-style services to be "wrapped". See below for a sample >configuration. > >I really don't want to keep this to myself. The same goes for other >smallish-but-reusable stuff I've written in the past few months; tests >included, of course. But what can I do to avoid this? I could put the >code on my web site where nobody will find it. What I'm looking for is >some kind of Spring Component Playground for bits and pieces that snap >into Spring but are not (yet) part of the official distribution. >Something with a wider scope and access than the existing sandbox. > >Michael > > ><bean id="webserviceclient" > class="de.schuerig.webservices.AxisClientFactoryBean"> > <property name="serviceFactoryClass"> > <value>org.apache.axis.client.ServiceFactory</value> > </property> > <property name="wsdlDocumentUrl"> > <value>http://serviceprovider.net/service?wsdl</value> > </property> > <property name="timeout"> > <value>30000</value> <!-- milliseconds --> > </property> > <property name="namespaceUri"> > <value>http://serviceprovider.net/service</value> > </property> > <property name="typeNamespaceUri"> > <value>http://serviceprovider.net/service/types</value> > </property> > <property name="serviceName"> > <value>TheService</value> > </property> > <property name="portName"> > <value>TheSoapPort</value> > </property> > <property name="serviceInterface"> > <value>net.example.TheService</value> > </property> > <property name="wrappedStyle"> > <value>false</value> > </property> > <property name="encodingStyleUri"> > <value></value> <!-- for literal --> > </property> > <property name="typeMappings"> > <list> > <bean class="de.schuerig.webservices.TypeMappingDesc"> > <property name="javaType"> > <value>net.example.SomeBean</value> > </property> > <property name="xmlType"> > <value>someBean</value> > </property> > </bean> > <bean class="de.schuerig.webservices.TypeMappingDesc"> > <property name="javaType"> > <value>net.example.SomeBean[]</value> > </property> > <property name="xmlType"> > <value>SomeBeanList</value> > </property> > </bean> > <bean class="de.schuerig.webservices.TypeMappingDesc"> > <property name="javaType"> > <value>net.example.SpecialBean</value> > </property> > <property name="xmlType"> > <value>specialBean</value> > </property> > <property name="serializerFactory"> > <value>net.example.SpecialBeanSerializerFactory</value> > </property> > <property name="deserializerFactory"> > <value>net.example.SpecialBeanDeserializerFactory</value> > </property> > </bean> > </list> > </property> ></bean> > > > |
|
From: Michael S. <mi...@sc...> - 2005-01-10 00:25:59
|
On Saturday 08 January 2005 04:48, Colin Sampaleanu wrote: > For about a good 6 months or so now I keep meaning to set up a > 'cookbook' area on the wiki where people can put shorts bits of code > and tips for doing things. You could perhaps put up the stuff on the > wiki, and I'll try to organize it a bit more in about 2-3 weeks when > I am done with the project I am on now... Colin, I've had a look at the wiki and while I'm used to wiki's (I'm even running one locally), I found it a bit unwieldy for my purpose. Instead I've uploaded my somewhat cleaned up collection of utility classea at http://www.schuerig.de/michael/java/msutils (the link leads to the online javadocs + download link) There are a few classes in there that are related to Spring: ...aop.ExpirationIntroducer - mixes-in an ExpiringObject interface ...aop.RetryAdvice - retries failed method invocations based on thrown exception, retry count, and method name ...util.MethodInvocationSchedulerBean - uses Quartz to schedule a method invocation on a target bean ...webservices.AxisClientFactoryBean - allows to configure type mappings, wrapped-style; works with out-only parameters and unwraps exceptions I hope some of this stuff is useful to others; the license is Apache 2.0. Michael -- Michael Schuerig I am the sum total of the parts mailto:mi...@sc... I control directly. http://www.schuerig.de/michael/ --Daniel C. Dennett, Elbow Room |
|
From: Pieter C. <pie...@on...> - 2005-01-10 08:58:22
|
Colin, I'm maintaining a 'faq' on the wiki, although it is far from complete: http://opensource.atlassian.com/confluence/spring/display/DOC/FAQ Pieter Colin Sampaleanu said: > Michael, > > For about a good 6 months or so now I keep meaning to set up a > 'cookbook' area on the wiki where people can put shorts bits of code an= d > tips for doing things. You could perhaps put up the stuff on the wiki, > and I'll try to organize it a bit more in about 2-3 weeks when I am don= e > with the project I am on now... > > Colin > > Michael Schuerig wrote: > >>On Thursday 06 January 2005 02:42, Michael Schuerig wrote: >> >> >>>I've stumbled again on my quest to make Axis and Spring work together >>>in the way I want them to. One of my operations has an out parameter >>>(in WSDL: a part of the output message that does not appear in the >>>operation's parameterOrder attribute; see JAX-RPC 4.3.4). >>> >>> >>[snip] >> >> >>>I'll probably have a go at it in the next couple of days. Thus if >>>anyone else intends to do something similar, please contact me. >>> >>> >> >>So, now I've got a factory bean that creates a "tweakable" web service >>client using Axis. The factory helps with declarative type mapping, >>unwraps business exceptions, handles out parameters and allows to set >>document-style services to be "wrapped". See below for a sample >>configuration. >> >>I really don't want to keep this to myself. The same goes for other >>smallish-but-reusable stuff I've written in the past few months; tests >>included, of course. But what can I do to avoid this? I could put the >>code on my web site where nobody will find it. What I'm looking for is >>some kind of Spring Component Playground for bits and pieces that snap >>into Spring but are not (yet) part of the official distribution. >>Something with a wider scope and access than the existing sandbox. >> >>Michael >> >> >><bean id=3D"webserviceclient" >> class=3D"de.schuerig.webservices.AxisClientFactoryBean"> >> <property name=3D"serviceFactoryClass"> >> <value>org.apache.axis.client.ServiceFactory</value> >> </property> >> <property name=3D"wsdlDocumentUrl"> >> <value>http://serviceprovider.net/service?wsdl</value> >> </property> >> <property name=3D"timeout"> >> <value>30000</value> <!-- milliseconds --> >> </property> >> <property name=3D"namespaceUri"> >> <value>http://serviceprovider.net/service</value> >> </property> >> <property name=3D"typeNamespaceUri"> >> <value>http://serviceprovider.net/service/types</value> >> </property> >> <property name=3D"serviceName"> >> <value>TheService</value> >> </property> >> <property name=3D"portName"> >> <value>TheSoapPort</value> >> </property> >> <property name=3D"serviceInterface"> >> <value>net.example.TheService</value> >> </property> >> <property name=3D"wrappedStyle"> >> <value>false</value> >> </property> >> <property name=3D"encodingStyleUri"> >> <value></value> <!-- for literal --> >> </property> >> <property name=3D"typeMappings"> >> <list> >> <bean class=3D"de.schuerig.webservices.TypeMappingDesc"> >> <property name=3D"javaType"> >> <value>net.example.SomeBean</value> >> </property> >> <property name=3D"xmlType"> >> <value>someBean</value> >> </property> >> </bean> >> <bean class=3D"de.schuerig.webservices.TypeMappingDesc"> >> <property name=3D"javaType"> >> <value>net.example.SomeBean[]</value> >> </property> >> <property name=3D"xmlType"> >> <value>SomeBeanList</value> >> </property> >> </bean> >> <bean class=3D"de.schuerig.webservices.TypeMappingDesc"> >> <property name=3D"javaType"> >> <value>net.example.SpecialBean</value> >> </property> >> <property name=3D"xmlType"> >> <value>specialBean</value> >> </property> >> <property name=3D"serializerFactory"> >> <value>net.example.SpecialBeanSerializerFactory</va= lue> >> </property> >> <property name=3D"deserializerFactory"> >> <value>net.example.SpecialBeanDeserializerFactory</= value> >> </property> >> </bean> >> </list> >> </property> >></bean> >> >> >> > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |