- This topic has 5 replies, 2 voices, and was last updated 17 years, 10 months ago by InfinityComunicaciones.
-
AuthorPosts
-
InfinityComunicacionesMemberHi, i’d applied the HelloWorld Web Service sample.
Can i set initial params to my POJO using xfire exclusively (without spring, etc)?
For example:
<service>
<name>HelloWorld</name>
<serviceClass>inf.ws.IHelloWorld</serviceClass>
<implementationClass>inf.ws.HelloWorldImpl</implementationClass>
<style>wrapped</style>
<use>literal</use>
<scope>session</scope>
<properties>
<property key=”counter”>12</property>
</properties>
</service>How i can access to the property “counter” from HelloWorldImpl?
Brian FernandesModeratorHi,
You would need to change your definition somewhat:
<service> <serviceObject> <bean class = "inf.ws.HelloWorldImpl"> <property name = "counter"> <value>12</value> </property> </bean> </serviceObject> <style>wrapped</style> <use>literal</use> <scope>session</scope> </service>
Your Impl class should have a setCounter method. Let us know how it goes.
InfinityComunicacionesMemberBad news:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.codehaus.xfire.spring.ServiceBean’ defined in class path resource [META-INF/xfire/services.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property ‘serviceObject’ of bean class [org.codehaus.xfire.spring.ServiceBean]: Bean property ‘serviceObject’ is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.NotWritablePropertyException: Invalid property ‘serviceObject’ of bean class [org.codehaus.xfire.spring.ServiceBean]: Bean property ‘serviceObject’ is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:567)
at org.springframework.beans.BeanWrapperImHelloWorldImpl has setters and getters of “counter” but it seems that property ServiceObject is invalid for class Service in Xfire.
My xfire version is 1.2.2 without any framework integration.
Any ideas?
Thanks
Brian FernandesModeratorI apologize for the incorrect information, I hadn’t tested the earlier code – here’s something which I tried myself.
<beans> <bean id = "mybean" class = "inf.ws.HelloWorldImpl"> <property name = "counter"> <value>12</value> </property> </bean> <service xmlns = "http://xfire.codehaus.org/config/1.0"> <serviceBean>#mybean</serviceBean> <style>wrapped</style> <use>literal</use> <scope>session</scope> </service> </beans>
Please note how the namespace specification (xfire.codehause.org/config/1.0) has been removed from the <beans> element and added to the <service> element.
If you experience any issues, let us know – there might be a few problems as XFire 1.2.2 was at the starting stage of Spring 2 integration. ME 5.5M1 which is due in a couple of weeks will ship with XFire 1.2.4 where most of the Spring 2 issues have been ironed out.
InfinityComunicacionesMemberThanks, it seems ok, but it has a little problem:
I have testing and i’ve one issue to fix: bean’s scope is not the same than Service. Its using “application” scope and not the session scope
I’ve tried with:
<bean id="mybean" class="inf.ws.HelloWorldImpl"> <property name="counter"> <value>12</value> </property> <scope>session</scope> </bean> <service xmlns="http://xfire.codehaus.org/config/1.0"> <name>HelloWorld</name> <serviceClass>inf.ws.IHelloWorld</serviceClass> <serviceBean> #mybean <property name="scope"> <value>session</value> </property> </serviceBean> <style>wrapped</style> <use>literal</use> <scope>session</scope> </service>
With this snippet, “mybean” always use an application scope.
I’ve tried with the newest version of xfire with the same result. Is it possible?
thanks
InfinityComunicacionesMemberIf we use the tag ServiceBean, our web services can only have an application scope?
-
AuthorPosts