Webservices手写客户端调用

客户端调用
 
            // 实例化ISM Web Service
            org.codehaus.xfire.service.Service ISMserviceModel = new ObjectServiceFactory().create(IsmWebService.class,
                null,
                Constants.ISM_SERVERDNS,
                null);
 // ISM
            IsmWebService ismService = (IsmWebService) serviceFactory.create(ISMserviceModel, Constants.ISM_SERVERURL);

服务端web.xml
<servlet>
		<servlet-name>XFireServlet</servlet-name>
		<servlet-class>
			org.codehaus.xfire.transport.http.XFireConfigurableServlet
		</servlet-class>
		<init-param>
	     	<param-name>config</param-name>
	     	<param-value>services.xml</param-value>
		</init-param>
		<load-on-startup>2</load-on-startup>
  	</servlet>  

    <servlet-mapping>
	    <servlet-name>XFireServlet</servlet-name>
		<url-pattern>/services/*</url-pattern>
	</servlet-mapping>

servcies.xml
<beans>
<service xmlns="http://xfire.codehaus.org/config/1.0">  
	    <name>saas</name>
	    <namespace>http://www.saas.com/saasService</namespace>
	    <serviceClass>com.server.saas.SaasService</serviceClass>
	    <implementationClass>com.server.saas.SaasServiceImpl</implementationClass> 
  	</service>  
</beans>

你可能感兴趣的:(WebServices)