Hello,
I am starting to use xFire (version 1.2.4) in a Spring-based Web
application on Tomcat , and have 2 questions, one at the server side, one at
a Spring based client side.
1) At the server side :
I created an interface ContainerISOService, and an implementation,
ContainerISOImpl.
package interfaces;
import javax.jws.*;
@WebService(name = "ContainerISOService")
public interface ContainerISOService
{
@WebMethod(operationName = "count", action = "urn:count")
@WebResult(name = "counter")
public int count();
}
package service;
import javax.jws.WebService;
@WebService(name="ContainerISOService", endpointInterface =
"interfaces.ContainerISOService")
public class ContainerISOImpl {
public int count()
{
return 123;
}
}
In order to publish them, I configured in web.xml
<servlet>
<servlet-name>SOAPServlet</servlet-name>
<servlet-class>org.codehaus.xfire.spring.XFireSpringServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SOAPServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
And in the Spring configuration file (server side)
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml"/>
<bean id="webAnnotations"
class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/>
<bean id="handlerMapping"
class="org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping">
<property name="typeMappingRegistry" ref="xfire.typeMappingRegistry"
/>
<property name="xfire" ref="xfire" />
<property name="webAnnotations" ref="webAnnotations" />
</bean>
<bean
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/ContainerISOService">
<ref bean="ContainerISOService"/>
</entry>
</map>
</property>
</bean>
<bean id="ContainerISOService" class="service.ContainerISOImpl"/>
Upon startup of the container, The server indicates following publish action
1-jan-2007 14:49:28 org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping
processBeans
INFO: Exposing service {http://interfaces}ContainerISOImpl to
/services/ContainerISOImpl
I would however expect the server to expose a
‘/services/ContainerISOService’ instead of ‘…Impl’
Is there something wrong in my interpretation of the config files?
2) Consuming this service
>From a browser, I can retrieve the wsdl by using
http://localhost:8080/CosmosServiceLayer/services/ContainerISOImpl?wsdl
Now I want to access it from a Spring-based Java command line program.
The Spring config file for client contains :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml"/>
<bean id="testWebService"
class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
<property name="serviceClass">
<value>service.ContainerISOImpl</value>
</property>
<property name="wsdlDocumentUrl">
<value>http://localhost:8080/CosmosServiceLayer/services/ContainerISOImpl?wsdl</value>
</property>
</bean>
</beans>
And the program performs
try
{
Object bean = (Object) factory.getBean("testWebService");
System.out.println(bean.getClass().toString());
}
When retrieving the bean, I get
1-jan-2007 16:43:17
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource
[org/codehaus/xfire/spring/customEditors.xml]
Resovling. Base: , URI:
http://localhost:8080/CosmosServiceLayer/services/ContainerISOImpl?wsdl
Retrieving document at 'null'.
The “Retrieving document at ‘null’ is printed in the create method of
org.codehaus.xfire.service.binding.ObjectServiceFactory, and more precisely
in the readWSDL call.
return create(clazz,
name,
WSDLFactory.newInstance().newWSDLReader().readWSDL(new
ResolverWSDLLocator(null, new InputSource(wsdlUrl.openStream()))),
properties);
Can somebody help me setting up this client software?
Thanks,
Luc De Graef
--
View this message in context:
http://www.nabble.com/JSR181---Spring-based-server-and-client-tf2961233.html#a8284855
Sent from the XFire - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email