developer tip

WSDL이 웹 서비스의 SOAP 버전 (1.1 또는 1.2)을 나타낼 수 있습니까?

optionbox 2020. 11. 5. 07:55
반응형

WSDL이 웹 서비스의 SOAP 버전 (1.1 또는 1.2)을 나타낼 수 있습니까?


WSDL의 정보를 기반으로 웹 서비스가 SOAP 1.1 또는 1.2를 사용하는지 확인할 수 있습니까?


SOAP 1.1은 http://schemas.xmlsoap.org/wsdl/soap/ 네임 스페이스를 사용합니다 .

SOAP 1.2는 네임 스페이스 http://schemas.xmlsoap.org/wsdl/soap12/를 사용합니다 .

wsdl은 같은 wsdl에서 soap 1.1 및 soap 1.2에서 동시에 작업을 정의 할 수 있습니다. 이는 soap 1.2 (예 : MTOM)를 필요로하는 새로운 기능을 지원하기 위해 wsdl을 발전시켜야하는 경우에 유용합니다.이 경우 새로운 서비스를 만들 필요가없고 원래 서비스 만 발전시킬 필요가 있습니다.


WSDL에서 Binding 섹션 을 보면 서비스가 SOAP 1.2를 사용하는 경우 SOAP 바인딩이 명시 적으로 언급되어 있음을 분명히 알 수 있습니다. 아래 샘플을 참조하십시오.

<binding name="EmployeeServiceImplPortBinding" type="tns:EmployeeServiceImpl">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="findEmployeeById">
    <soap12:operation soapAction=""/>
    <input><soap12:body use="literal"/></input>
    <output><soap12:body use="literal"/></output>
</operation><operation name="create">
    <soap12:operation soapAction=""/>
    <input><soap12:body use="literal"/></input>
    <output><soap12:body use="literal"/></output>
</operation>
</binding>

웹 서비스가 SOAP 1.1을 사용하는 경우 바인딩 섹션 아래의 WSDL 파일에서 SOAP 버전을 명시 적으로 정의하지 않습니다. 아래 샘플을 참조하십시오.

<binding name="EmployeeServiceImplPortBinding" type="tns:EmployeeServiceImpl">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="findEmployeeById">
    <soap:operation soapAction=""/>
    <input><soap:body use="literal" namespace="http://jaxb.ws.jax.samples.chathurangaonline.com/"/></input>
    <output><soap:body use="literal" namespace="http://jaxb.ws.jax.samples.chathurangaonline.com/"/></output>
</operation><operation name="create">
    <soap:operation soapAction=""/>
    <input><soap:body use="literal" namespace="http://jaxb.ws.jax.samples.chathurangaonline.com/"/></input>
    <output><soap:body use="literal" namespace="http://jaxb.ws.jax.samples.chathurangaonline.com/"/></output>
</operation>
</binding>

SOAP 메시지의 SOAP 버전을 확인하는 방법은 무엇입니까?

그러나 이것은 웹 서비스가 사용하는 SOAP 버전을 결정하는 데 권장되는 방법은 아닙니다. SOAP 메시지의 버전은 다음 방법 중 하나를 사용하여 판별 할 수 있습니다.

1. SOAP 메시지의 네임 스페이스 확인

SOAP 1.1  namespace : http://schemas.xmlsoap.org/soap/envelope

SOAP 1.2 namespace  : http://www.w3.org/2003/05/soap-envelope

2. SOAP 메시지의 전송 바인딩 정보 (http 헤더 정보) 확인

SOAP 1.1 : 컨텍스트 유형에 대한 사용자 텍스트 / xml

   POST /MyService HTTP/1.1
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxx
   SOAPAction: "urn:uuid:myaction"

SOAP 1.2 : 컨텍스트 유형에 대한 사용자 애플리케이션 / soap + xml

   POST /MyService HTTP/1.1
   Content-Type: application/soap+xml; charset="utf-8"
   Content-Length: xxx
   SOAPAction: "urn:uuid:myaction"

3. SOAP 오류 정보 사용

두 버전 간의 SOAP 오류 메시지 구조가 다릅니다.


이 페이지를 찾았습니다

http://schemas.xmlsoap.org/wsdl/soap12/soap12WSDL.htm

which says that Soap 1.2 uses the new namespace http://schemas.xmlsoap.org/wsdl/soap12/

It is in the 'WSDL 1.1 Binding extension for SOAP 1.1'.


Yes you can usually see what SOAP version is supported based on the WSDL.

Take a look at Demo web service WSDL. It has a reference to the soap12 namespace indicating it supports SOAP 1.2. If that was absent then you'd probably be safe assuming the service only supported SOAP 1.1.


Found transport-attribute in binding-element which tells us that this is the WSDL 1.1 binding for the SOAP 1.1 HTTP binding.

ex.

<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

참고URL : https://stackoverflow.com/questions/736845/can-a-wsdl-indicate-the-soap-version-1-1-or-1-2-of-the-web-service

반응형