0

Axis2 の Tomcat で実行するには、Spring 3.0.4.RELEASE で WS を作成する必要があります。私はこのドキュメントに従っています: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html#remoting-web-services-jaxws-export-ri (ifその段落は「doc」と呼ぶことができます)

詳細は次のとおりです。

Java クラス:

package foo;
@WebService(serviceName="MyService")
public class MyService{
  @WebMethod  
  public String getString(){
    return "Hello StackOverflow";
  }  
}  

WEB-INF/spring-ws.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://jax-ws.dev.java.net/spring/core https://jax-ws.dev.java.net/spring/core.xsd  
    http://jax-ws.dev.java.net/spring/servlet https://jax-ws.dev.java.net/spring/servlet.xsd">

  <wss:binding url="/myService" service="#myService" />

  <ws:service id="myService"
    impl="foo.MyService" />

</beans>

WEB-INF/web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="myService" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>my Service</display-name>
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring-ws.xml</param-value>
</context-param>
<!-- this is for Spring -->
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- these are for JAX-WS -->
<servlet>
    <servlet-name>jaxws-servlet</servlet-name>
    <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>jaxws-servlet</servlet-name>
    <url-pattern>/myService</url-pattern>
</servlet-mapping>

最後に、それほど重要ではありませんが、Tomcat 6.0.29を起動したときのエラー:

Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://jax-ws.dev.java.net/spring/servlet]
Offending resource: ServletContext resource [/WEB-INF/spring-ws.xml]  

誰かが何が起こっているかの手がかりを持っていますか? すべての構成は正しいですか? Spring を使用して WS をデプロイする方法を示す単純な (動作する) WS を持っている人はいますか?

前もって感謝します

4

1 に答える 1

1

私もこの問題をしばらく前に経験し、問題は「https://」にあることがわかりました。http:// に戻すと、準備完了です。しかし、http:// を使用すると、Eclipse ではスキーマの URL を http:// から https:// に自動的にリダイレクトできないため、Eclipse でスキーマ検証エラーが発生します。どうやらnetbeansはそれが可能です。

もう一つ。xbeans-spring も必要です。正直なところ、それはかなりばかげた依存関係だと思います。

于 2010-10-13T04:16:18.040 に答える