求高手帮忙,cxf+spring发布的webservice后生成的wsdl中缺少标签

Intboy 2012-03-27 08:47:23
求高手帮忙,本人初学apache的cxf,发布的webservice成功,但是wsdl文件中缺少<wsdl:types>和<wsdl:message>标签
接口和实现类如下
@WebService
public interface HelloWorld {

@WebMethod(operationName="SayHello")
@WebResult(name="result")
public String sayHello(@WebParam(name="userName")String name);

}
public class HelloWorldImpl implements HelloWorld {

@Override
@WebMethod(operationName="SayHello")
@WebResult(name="result")
public String sayHello(@WebParam(name="userName")String name) {
System.out.println("SayHello is called for " + name);
return "Hello " + name;
}
}

beans配置文件如下

<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">

<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="helloWorld"
implementor="com.spg.testCxfSpring.impl.HelloWorldImpl"
address="/Hello" />

</beans>

web.xml文件的配置

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/beans.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
...全文
354 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Intboy 2012-03-28
  • 打赏
  • 举报
回复
怎么没人回答啊?很简单的问题?
Intboy 2012-03-27
  • 打赏
  • 举报
回复
高手出现啊,急需帮忙
Intboy 2012-03-27
  • 打赏
  • 举报
回复
最后的wsdl文件

<wsdl:definitions xmlns:ns1="http://dao.testCxfSpring.spg.com/" xmlns:ns2="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://impl.testCxfSpring.spg.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorldImplService" targetNamespace="http://impl.testCxfSpring.spg.com/">
<wsdl:import location="http://localhost:8080/cxf-Spring-server/Hello?wsdl=HelloWorld.wsdl" namespace="http://dao.testCxfSpring.spg.com/"></wsdl:import>
<wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:HelloWorld">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SayHello">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="SayHello">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="SayHelloResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldImplService">
<wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
<soap:address location="http://localhost:8080/cxf-Spring-server/Hello"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

恳请高手帮忙

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧