|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
请问 CXF+Spring+hiberate集成的问题之前我做了个jsf+spring+hibernate的小例子。现在想把它发布成webservice供远程调用。
参照cxf的sample集成了好多天了,没弄明白怎么回事。 比方说我想实现一个从一个表中查询一条数据的功能。 我的步骤是: 1.先手动编辑wsdl文件 2.用ant生成wsdl提到的java文件 3.在applicationContext里添加jaxws:endpoint, 这个我想利用以前spring管理的bean作为我的实现类,可是以前的实现类不是继承的wsdl生成的接口,似乎无法集成。 如果新作一个实现类,感觉也是没有利用spring管理的bean,有些不伦不类似的。 究其原因是好象是wsdl中声明的类型不能映射成hibernate识别的对象? <wsdl:types>里声明了一个<complexType name="AdministratorInfo">,这个复杂 的输出参数本来应该是一个java bean,也就是hibernate管理的bean才对,不知道如何设置才能工作。 另外不知道发布成webservice以后,如何通过url访问啊? 比如说我要访问AdministratorInfoImpl.getAdministratorInfo(id)方法,返回一行记录 附带部分代码: applicationContext.xml : <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <jaxws:endpoint id="AdministratorInfo" implementor="#administratorInfoService" wsdlLocation="WEB-INF/wsdl/AdministratorInfoService.wsdl" address="/AdministratorInfo" /> <bean id="administratorInfoService" class="test.service.impl.CachedAdministratorInfoServiceImpl" > <property name="administratorInfoDao" ref="administratorInfoDao"> </property> </bean> <bean id="administratorInfoDao" class="test.dao.hibernate.AdministratorInfoDaoHibernateImpl"> <property name="sessionFactory" ref="sessionFactory" /> </bean> wsdl: <wsdl:types> <complexType name="AdministratorInfo"> <sequence> <element name="id" nillable="false" type="int"/> <element name="administrator_id" nillable="false" type="string"/> <element name="effective_start_date" nillable="false" type="string"/> //如果是日期类型该怎么写? <element name="effective_end_date" nillable="false" type="string"/ > </sequence> </complexType> --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。 要在此论坛发帖,请发电子邮件到 cxf-zh@... 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@... 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛 ---- Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: 请问 CXF+Spring+hiberate集成的问题想了一下,wsdl里最好还是不要暴露数据结构。那传递的类型应该改成list之类的类型。
还不知道wsdl是如何支持复杂类型的,查一下。 On 10月19日, 下午5时01分, shadowgenius <shadow...@...> wrote: > 之前我做了个jsf+spring+hibernate的小例子。现在想把它发布成webservice供远程调用。 > 参照cxf的sample集成了好多天了,没弄明白怎么回事。 > > 比方说我想实现一个从一个表中查询一条数据的功能。 > > 我的步骤是: > 1.先手动编辑wsdl文件 > 2.用ant生成wsdl提到的java文件 > 3.在applicationContext里添加jaxws:endpoint, > 这个我想利用以前spring管理的bean作为我的实现类,可是以前的实现类不是继承的wsdl生成的接口,似乎无法集成。 > 如果新作一个实现类,感觉也是没有利用spring管理的bean,有些不伦不类似的。 > > 究其原因是好象是wsdl中声明的类型不能映射成hibernate识别的对象? > > <wsdl:types>里声明了一个<complexType name="AdministratorInfo">,这个复杂 > 的输出参数本来应该是一个java bean,也就是hibernate管理的bean才对,不知道如何设置才能工作。 > > 另外不知道发布成webservice以后,如何通过url访问啊? > 比如说我要访问AdministratorInfoImpl.getAdministratorInfo(id)方法,返回一行记录 > > 附带部分代码: > > applicationContext.xml : > > <import resource="classpath:META-INF/cxf/cxf.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> > <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> > > <jaxws:endpoint id="AdministratorInfo" > implementor="#administratorInfoService" > wsdlLocation="WEB-INF/wsdl/AdministratorInfoService.wsdl" > address="/AdministratorInfo" /> > > <bean id="administratorInfoService" > class="test.service.impl.CachedAdministratorInfoServiceImpl" > > <property name="administratorInfoDao" ref="administratorInfoDao"> > </property> > </bean> > <bean id="administratorInfoDao" > class="test.dao.hibernate.AdministratorInfoDaoHibernateImpl"> > <property name="sessionFactory" ref="sessionFactory" /> > </bean> > > wsdl: > <wsdl:types> > <complexType name="AdministratorInfo"> > <sequence> > <element name="id" nillable="false" type="int"/> > <element name="administrator_id" nillable="false" type="string"/> > <element name="effective_start_date" nillable="false" > type="string"/> //如果是日期类型该怎么写? > <element name="effective_end_date" nillable="false" type="string"/ > > </sequence> > </complexType> 您收到此信息是由于您订阅了 Google 论坛“cxf-zh”论坛。 要在此论坛发帖,请发电子邮件到 cxf-zh@... 要退订此论坛,请发邮件至 cxf-zh-unsubscribe@... 更多选项,请通过 http://groups.google.com/group/cxf-zh?hl=zh-CN 访问该论坛 ---- Apache CXF 首页 http://cwiki.apache.org/confluence/display/CXF/Index -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |