Axis2+Myeclipse+hibernate

第一步:配置简单的axis2+Myeclipse 教程地址:http://wenku.baidu.com/view/50b0f3166edb6f1aff001f83.html(有图很详细)

第二步: 按正常流程配置hibernate

第三步:写具体逻辑SendMessageServiceSkeleton

第四步:结合hibernate(本人用的第一种解决方法)

这里不能简单的当做你看到的helloWorld的例子部署,因为

{

  • hibernate.cfg.xml放在aar内,axis2项目报错找不到
  •  service 类 调用其他实体类(Student2),但实体类放在aar中没用,axis2项目报错找不到
  •  hibernate如果采用hbm mapping文件(Student2.hbm.xml),则hbm mapping放在aar中没用,axis2项目报错找不到

}

 

 

解决方法1)

services.xml文件中“</service>”之前加上一行

【  <parameter name="ServiceTCCL">composite</parameter>   】

 

并且确定aar包的目录结构如下:
 

com.machome.model包
|----com
|----------machome
|-------------------model
|---------------------------Student2.class
|---------------------------Student2.hbm.xml

com.machome.test包
|-------------------test
|-----------------------TestHibernate.class

META-INF文件夹

|---META-INF

|------------MANIFEST.MF

|------------services.xml

|---hibernate.cfg.xml (和com同一层次,最外面)

 

解决方法2)

----------------------------

打包格式不变,services.xml文件中不加哪一行。

只是将需要的配置文件放在classes文件夹下,jar包放lib下。

目录结构类似如下

--src----
|--com.machome.model
|----------------------------Student2.java
|----------------------------Student2.hbm.xml
|----------------------------hibernate.cfg.xml 
--webroot--
|--WEB-INF
|--------------classes
|-----------------------com.machome.model
|-----------------------Student2.class
|-----------------------Student2.hbm.xml
|-----------------------hibernate.cfg.xml
|-lib
|----jar file
|-conf
|-modules
|-services
|-----------TestHibernate.aar

===============================================

参考文章:http://blog.knowsky.com/179908.htm


发布自定义wsdl

  • 1. Get the latest axis2 1.1 build (this works for the

       1-Nov-2006 nightly snapshot)



    2. Structure of aar is to be as follows

        * MyService.aar

            /META-INF

                Services.xml

                service.wsdl

           /MyService.class



    2. Naming 

        * The axis2 java code that looks for a deployed

          WSDL first looks for a wsdl named service.wsdl

          if it cannot find it it then looks for a wsdl

          named MyService.wsdl if that is not found a

          wsdl will be generated.



    3. Ensure that Your names matchup in the WSDL and

       services.xml

        * In the wsdl The service name

          <wsdl:service name="MyService"> 'MUST' be

        * The same as the name in the services.xml

          <serviceGroup>

            <service name="MyService">

            ....

            </service>

          </serviceGroup>



    4. Ensure that the

    <parameter name="useOriginalwsdl">true</parameter>

       is set in the services.xml



    <serviceGroup>

      <service name="MyService">

        <parameter name="useOriginalwsdl">true</parameter>

         ....

      </service>

    </serviceGroup>







    ===========================

    http://www.opensubscriber.com/message/axis-user@ws.apache.org/5247792.html





    In my case it worked when I

    put the parameter this way:



    <parameter name="useOriginalwsdl">true</parameter>



    And the structure of the .aar File is just like you described it at the

    beginning:



    AddressBook-v1-0-0.aar

       META-INF/AddressBook-v1-0-0.wsdl

       META-INF/services.xml

       au/...../some.class

实际操作中,还必须设置services.xml里中的 <parameter name="modifyUserWSDLPortAddress">false</parameter>


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值