JAX-WS Web サービスでの WSDL バインディング順守の強制
WSDL 文書にバインディング拡張を追加して、Liberty で JAX-WS のサポートによりそれらの拡張をご使用のアプリケーションに適用することができます。
このタスクについて
Liberty では、JAX-WS 2.2 仕様で必須である wsdl:binding 拡張の使用をサポートします。このトピックでは、WSDL 拡張機能を定義し、Liberty でそれらの拡張機能をカスタマイズされた拡張性エレメントにバインドする方法について説明します。
手順
- 拡張性エレメントを定義し、それを WSDL 拡張機能で定義済みのユーザーにマップします。 以下の例では、WSDL 拡張機能 {http://server.respectbinding.jaxws22/}goodBinding を使用したバインド方法を示します。
@XmlRootElement(name = "goodBinding", namespace = "http://server.respectbinding.jaxws22/") public class GoodBindingElement implements ExtensibilityElement, Serializable { private String uri; private QName elementType = null; private Boolean required = null; @XmlAttribute(name = "uri") public String getUri() { return this.uri; } @Override public QName getElementType() { return this.elementType; } @XmlAttribute(name = "required", namespace="http://schemas.xmlsoap.org/wsdl/") public Boolean getRequired() { return this.required; } public void setUri(String uri){ this.uri = uri; } @Override public void setElementType(QName elementType) { this.elementType = elementType; } @Override public void setRequired(Boolean required) { this.required = required; } }
- ご使用の Web アプリケーションまたは EJB アプリケーションの /META-INF ディレクトリーに、extensions.xml ファイルを追加します。このファイルは、拡張機能を WSDL 文書内のどこで使用できるかを定義します。 以下の例では、javax.wsdl.Binding プロパティーを goodBindingElement クラスの親タイプとして設定するエントリーが、extensions.xml ファイルに追加されます。また、このエントリーは、拡張機能 {http://server.respectbinding.jaxws22/}goodBinding が、WSDL 文書内で binding エレメントの下にのみ追加できることを意味します。
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <!-- XML Binding --> <entry key="org.apache.cxf.bindings.xml-1">javax.wsdl.Binding=jaxws22.respectbinding.server.common.GoodBindingElement</entry> </properties>
- 次のように、binding エレメントの下に、拡張機能 {http://server.respectbinding.jaxws22/}goodBinding を追加します。
... <binding name="EchoPortBinding" type="tns:Echo"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <tns:goodBinding wsdl:required="true" uri="http://good/good" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> <operation name="echo"> <soap:operation soapAction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> <fault name="Exception"> <soap:fault name="Exception" use="literal"/> </fault> </operation> </binding> ...


http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twlp_dep_jaxws_extension
ファイル名: twlp_dep_jaxws_extension.html