JAX-WS 웹 서비스의 WSDL 바인딩 준수 강제 실행

WSDL 문서에서 바인딩 확장기능을 추가한 후에 Liberty에서 JAX-WS 지원이 있는 애플리케이션으로 확장기능을 적용할 수 있습니다.

이 태스크 정보

Liberty는 JAX-WS 2.2 스펙에서 필요한 wsdl:binding 확장기능의 사용을 지원합니다. 이 주제는 WSDL 확장기능을 정의하고 Liberty에서 사용자 정의된 확장성 요소와 이를 바인드하는 방법에 대해 설명합니다.

프로시저

  1. 확장성 요소를 정의하고 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;
        }
    }
  2. 웹 또는 EJB 애플리케이션의 /META-INF 디렉토리에 extensions.xml 파일을 추가하십시오. 이 파일은 WSDL 문서에서 확장기능을 사용할 수 있는 위치를 정의합니다. 다음 예에서는, javax.wsdl.Binding 특성을 goodBindingElement 클래스의 상위 유형으로 설정하는 항목이 extensions.xml 파일에 추가됩니다. 또한 이 항목은 WSDL 문서에서 binding 요소 아래에만 {http://server.respectbinding.jaxws22/}goodBinding 확장기능을 추가할 수 있음을 의미합니다.
    <?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>
  3. 다음과 같이 {http://server.respectbinding.jaxws22/}goodBinding 확장기능을 binding 요소 아래에 추가하십시오.
    ...
      <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>
      ...

주제의 유형을 표시하는 아이콘 태스크 주제

파일 이름: twlp_dep_jaxws_extension.html