我有一个使用axis2构建的Web服务。另外,我使用了axis2提供的Java2WSDL实用程序,在构建时从我的类(而不是已部署的服务)生成WSDL。
然后我通过wsimport为Java EE Application Server中的Deployed Web Service和生成的WSDL文件生成了一个客户端。问题是生成的代码在包和mamespace方面是不同的,因此从WSDL文件生成的客户端不起作用,因为它抱怨命名空间不匹配....在jboss上我看到以下异常;
13:46:04,524 ERROR [RPCMessageReceiver] Exception occurred while trying to invoke service method getLanguage
org.apache.axis2.AxisFault: namespace mismatch require http://CustomerServiceWs found http://customer.webservices.temenos.com
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:177)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:144)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
我使用以下命令从类文件生成我的WSDL文件;
java2wsdl.bat -o C:\Temp -tn http://CustomerServiceWs -cn com.temenos.webservices.customer.CustomerServiceWS
你能帮我解决这个问题,或者建议一个更好的方法来解决这个问题。
谢谢,
-
Sjunejo
答案 0 :(得分:0)
确保模式中的命名空间与WSDL的NameSpace匹配,坦率地说,我甚至不喜欢使用Axis2的想法,因为它有很多问题..无论如何尝试匹配xsd的命名空间与你的wsdl并确保你的请求和响应的所有名称都相似。