MyEclipse6.0如何配置XFire

解决方案 »

  1.   

    什么意思?这个是MyEclipse5.0的方法,http://blog.csdn.net/caok/archive/2008/11/20/3339260.aspx
      

  2.   

    5.0以上的应该都有XFIRE插件吧,应该差不多吧。7.0我用过,都是一样的呀。我一般都不用MyEclipse的自动生成,你在网上下一个Xfire最新的包,然后在web.xml中配置一下就可以了.<?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
      
          <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/applicationContext.xml
            /WEB-INF/xfire-servlet.xml
            </param-value>
        </context-param>  
            <context-param>
            <param-name>log4jConfigLocation</param-name>
            <param-value>/WEB-INF/log4j.properties</param-value>
        </context-param>
    <context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>yygh.root</param-value>
    </context-param>
            <listener>
            <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
        </listener>
        
         <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
      
      
      <servlet>
        <servlet-name>xfire</servlet-name>
        <!--<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        -->
        <servlet-class>org.codehaus.xfire.spring.XFireSpringServlet</servlet-class>
        
        <!--    
        <load-on-startup>0</load-on-startup>
      --></servlet>
      
      <servlet-mapping>
        <servlet-name>xfire</servlet-name>
        <url-pattern>/services/*</url-pattern>
      </servlet-mapping>
      
    </web-app>
      

  3.   

    xfire-servlet.xml 文件内容:<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"  ><beans default-autowire="byName"> <!--引入XFire的预配置文件-->
    <import resource="classpath:org/codehaus/xfire/spring/xfire.xml" /><!--

    获得applicationContext中所有bean的JSR181 annotation 
    <bean id="webAnnotations"
    class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"
    lazy-init="false" />


    定义handler mapping,将所有JSR181定义的bean导出为web service 
    <bean id="jsr181HandlerMapping"
    class="org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping"
    lazy-init="false">
    <property name="xfire" ref="xfire" />
    <property name="webAnnotations" ref="webAnnotations" />
    </bean>


    --><!--
    Declare a parent bean with all properties common to both services 


    --> <bean id="baseWebService"
    class="org.codehaus.xfire.spring.remoting.XFireExporter" lazy-init="false" abstract="true"> <property name="serviceFactory">
    <ref bean="xfire.serviceFactory" />
    </property> <property name="xfire">
    <ref bean="xfire" />
    </property>
    </bean>

    <bean parent="baseWebService">

    <property name="serviceBean"><!-- applicationcontext的bean的名字-->
    <ref bean="QueryBusiness" />
    </property> <property name="serviceClass"><!--    导出的接口类 -->
    <value>com.export.Iquery</value>
    </property> <property name="name" value="Query"></property><!-- Web service 服务名-->
    <!--  
    <property name="inHandlers">
    <list>
    <ref bean="domInHandler" />
    <ref bean="wss4jInHandler"/>
    </list>
    </property>
    --> </bean>


    <bean parent="baseWebService">
    <property name="serviceBean">
    <ref bean="UpdateBussiness"/>
    </property>


    <property name="serviceClass"><!--    导出的接口类 -->
    <value>com.export.Iupdate</value>
    </property> <property name="name" value="Update"></property><!-- Web service 服务名-->

    <!-- 
    <property name="inHandlers">
    <list>
    <ref bean="domInHandler" />
    <ref bean="wss4jInHandler"/>
    </list>
    </property>
     -->
     
    </bean>



    <bean id="domInHandler" class="org.codehaus.xfire.util.dom.DOMInHandler"></bean>

    <bean id="wss4jInHandler" class="org.codehaus.xfire.security.wss4j.WSS4JInHandler">
    <property name="properties">
    <props>
    <prop key="action">UsernameToken</prop>
    <prop key="passwordCallbackClass">
    com.security.UtPasswordHandler
    </prop>
    </props>
    </property>
    </bean>
    <!--
    END SNIPPET: xfire 
    --></beans>
      

  4.   

    6.0的自带插件的
    工程右键--MyEclipse---Add Xfire Web Service Capabilities
    再按你选择的就可以了
    默认的好像缺包,用的过程中发现缺什么就加什么 
      

  5.   

    向导没有问题的,建立Web Services工程就可以了!