6장. SOAP 1.1 메시지 사용

초록

Apache CXF는 SOAP 헤더를 사용하지 않는 SOAP 1.1 바인딩을 생성하는 도구를 제공합니다. 그러나 텍스트 또는 XML 편집기를 사용하여 바인딩에 SOAP 헤더를 추가할 수 있습니다.However, you can add SOAP headers to your binding using any text or XML editor.

6.1. SOAP 1.1 바인딩 추가

6.1.1. wsdl2soap 사용

wsdl2soap 을 사용하여 SOAP 1.1 바인딩을 생성하려면 다음 명령을 사용합니다. wsdl2soap-iport-type-name-bbinding-name-doutput-directory-o output-namespace -nsoap-body-namespace-style (ral/rpc)-use (ral/encoded)-verb-oselll

참고

wsdl2soap 을 사용하려면 Apache CXF 배포판을 다운로드해야 합니다.

명령에는 다음 옵션이 있습니다.

옵션해석

-i port-type-name

바인딩이 생성되는 portType 요소를 지정합니다.

wsdlurl

portType 요소 정의를 포함하는 WSDL 파일의 경로와 이름입니다.

툴에는 다음과 같은 선택적 인수가 있습니다.

옵션해석

-b binding-name

생성된 SOAP 바인딩의 이름을 지정합니다.

-d output-directory

생성된 WSDL 파일을 배치할 디렉터리를 지정합니다.

-o output-file

생성된 WSDL 파일의 이름을 지정합니다.

-n soap-body-namespace

스타일이 RPC일 때 SOAP body 네임스페이스를 지정합니다.

-style (document/rpc)

SOAP 바인딩에서 사용할 인코딩 스타일(document 또는 RPC)을 지정합니다.Specifies the encoding style (document or RPC) to use in the SOAP binding. 기본값은 document입니다.

-use (literal/encoded)

SOAP 바인딩에 사용할 바인딩 사용(encoded 또는 literal)을 지정합니다.Specifies the binding use (encoded or literal) to use in the SOAP binding. 기본값은 literal입니다.

-v

도구의 버전 번호를 표시합니다.

-verbose

코드 생성 프로세스 중 주석을 표시합니다.

-quiet

코드 생성 프로세스 중 주석을 비활성화합니다.

-iport-type-namewsdlurl 인수가 필요합니다. -style rpc 인수가 지정된 경우 -nsoap-body-namspace 인수도 필요합니다. 다른 모든 인수는 선택 사항이며 순서에 따라 나열될 수 있습니다.

중요

wsdl2soap문서 / 인코딩된 SOAP 바인딩 생성을 지원하지 않습니다.

6.1.2. 예제

시스템에 주문을 처리하고 주문을 처리하는 단일 작업을 제공하는 인터페이스가 있는 경우 예 6.1. “시스템 인터페이스 순서” 에 표시된 것과 유사한 WSDL 조각에 정의되어 있습니다.

예 6.1. 시스템 인터페이스 순서

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="widgetOrderForm.wsdl"
    targetNamespace="http://widgetVendor.com/widgetOrderForm"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://widgetVendor.com/widgetOrderForm"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsd1="http://widgetVendor.com/types/widgetTypes"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

<message name="widgetOrder">
  <part name="numOrdered" type="xsd:int"/>
</message>
<message name="widgetOrderBill">
  <part name="price" type="xsd:float"/>
</message>
<message name="badSize">
  <part name="numInventory" type="xsd:int"/>
</message>

<portType name="orderWidgets">
  <operation name="placeWidgetOrder">
    <input message="tns:widgetOrder" name="order"/>
    <output message="tns:widgetOrderBill" name="bill"/>
    <fault message="tns:badSize" name="sizeFault"/>
  </operation>
</portType>
...
</definitions>

orderWidgets 에 대해 생성된 SOAP 바인딩은 예 6.2. “orderWidgets에 대한 SOAP 1.1 바인딩” 에 표시됩니다.

예 6.2. orderWidgets에 대한 SOAP 1.1 바인딩

<binding name="orderWidgetsBinding" type="tns:orderWidgets">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="placeWidgetOrder">
      <soap:operation soapAction="" style="document"/>
      <input name="order">
        <soap:body use="literal"/>
      </input>
      <output name="bill">
        <soap:body use="literal"/>
      </output>
      <fault name="sizeFault">
        <soap:body use="literal"/>
      </fault>
  </operation>
</binding>

이 바인딩은 문서/ 전문 메시지 스타일을 사용하여 메시지를 전송하도록 지정합니다.