第一步:配置简单的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