参考になるドキュメントが皆無なのでmemo。
SpringFramework2.5, Apache CXF2.1、その他諸々。
以下が必要となるJava側のライブラリ一覧。
[ WEB-INF/lib ]
-------------------------------
aopalliance-1.0.jar
backport-util-concurrent.jar
cglib-nodep-2.1_3.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-logging-1.1.1.jar
cxf-2.1.3.jar
FastInfoset-1.2.2.jar
geronimo-annotation_1.0_spec-1.1.1.jar
geronimo-servlet_2.5_spec-1.2.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
geronimo-ws-metadata_2.0_spec-1.1.2.jar
ibatis-2.3.4.726.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.7.jar
neethi-2.0.4.jar
opensaml-1.1.jar
saaj-api-1.3.jar
saaj-impl-1.3.2.jar
serializer-2.7.1.jar
spring-aop.jar
spring-beans.jar
spring-context-support.jar
spring-context.jar
spring-core.jar
spring-orm.jar
spring-tx.jar
spring-web.jar
spring.jar
wsdl4j-1.6.2.jar
wss4j-1.5.4.jar
wstx-asl-3.2.6.jar
xalan-2.7.1.jar
xml-resolver-1.2.jar
XmlSchema-1.4.2.jar
xmlsec-1.4.0.jar
-------------------------------
[ web.xml ]
-------------------------------
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Service</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/com/example/ws/cxf.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>/services/*</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
</web-app>
[ EOF ]
-------------------------------
[ classpath: /com/example/ws/cxf.xml ]
-------------------------------
<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.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="service" implementor="com.example.ws.Service" address="/Service" />
</beans>
[ EOF ]
-------------------------------
[ com.example.ws.IService ]
-------------------------------
package com.example.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface IService {
@WebMethod
public String hello();
}
[ EOF ]
-------------------------------
[ com.example.ws.Service ]
-------------------------------
package com.example.ws;
import javax.jws.WebService;
import javax.jws.WebMethod;
@WebService
public class Service implements IService{
@WebMethod
public String hello() {
return "Hello";
}
}
[ EOF ]
-------------------------------
これでPOJOとしてWebサービスを展開できる。
以前Codehaus XFireとしてReleaseされていたが、Celtixと統合され現在はApacheCXFとしてReleaseされている。
上記の様な形でPOJOとしてデプロイ後、http://www.example.com/services/Service?wsdl としてWSDLを取得できる。
.NETFramework2.0 に付属の wsdl.exe でスタブを作成し、プロジェクトに追加すればOK
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\wsdl.exe を使用する。
wsdl /l:cs http://www.example.com/services/Service?wsdl
とすることで、C#のスタブが作成され、プロジェクトにインポートして使用可能となる。
[ WEB-INF/lib ]
-------------------------------
aopalliance-1.0.jar
backport-util-concurrent.jar
cglib-nodep-2.1_3.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-logging-1.1.1.jar
cxf-2.1.3.jar
FastInfoset-1.2.2.jar
geronimo-annotation_1.0_spec-1.1.1.jar
geronimo-servlet_2.5_spec-1.2.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
geronimo-ws-metadata_2.0_spec-1.1.2.jar
ibatis-2.3.4.726.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.7.jar
neethi-2.0.4.jar
opensaml-1.1.jar
saaj-api-1.3.jar
saaj-impl-1.3.2.jar
serializer-2.7.1.jar
spring-aop.jar
spring-beans.jar
spring-context-support.jar
spring-context.jar
spring-core.jar
spring-orm.jar
spring-tx.jar
spring-web.jar
spring.jar
wsdl4j-1.6.2.jar
wss4j-1.5.4.jar
wstx-asl-3.2.6.jar
xalan-2.7.1.jar
xml-resolver-1.2.jar
XmlSchema-1.4.2.jar
xmlsec-1.4.0.jar
-------------------------------
[ web.xml ]
-------------------------------
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Service</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/com/example/ws/cxf.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>/services/*</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
</web-app>
[ EOF ]
-------------------------------
[ classpath: /com/example/ws/cxf.xml ]
-------------------------------
<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.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="service" implementor="com.example.ws.Service" address="/Service" />
</beans>
[ EOF ]
-------------------------------
[ com.example.ws.IService ]
-------------------------------
package com.example.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface IService {
@WebMethod
public String hello();
}
[ EOF ]
-------------------------------
[ com.example.ws.Service ]
-------------------------------
package com.example.ws;
import javax.jws.WebService;
import javax.jws.WebMethod;
@WebService
public class Service implements IService{
@WebMethod
public String hello() {
return "Hello";
}
}
[ EOF ]
-------------------------------
これでPOJOとしてWebサービスを展開できる。
以前Codehaus XFireとしてReleaseされていたが、Celtixと統合され現在はApacheCXFとしてReleaseされている。
上記の様な形でPOJOとしてデプロイ後、http://www.example.com/services/Service?wsdl としてWSDLを取得できる。
.NETFramework2.0 に付属の wsdl.exe でスタブを作成し、プロジェクトに追加すればOK
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\wsdl.exe を使用する。
wsdl /l:cs http://www.example.com/services/Service?wsdl
とすることで、C#のスタブが作成され、プロジェクトにインポートして使用可能となる。





