한국어
Qt
 

SOAP(Simple Object Access Protocol)은 일반적으로 널리 알려진 HTTP, HTTPS, SMTP 등을 통해 XML 기반의 메시지를 네트워크상에서 교환하는 프로토콜이다.

KDSoap.png

 

원격 프로시져 호출(Remote Procedure Call:RPC) 패턴으로, 네트워크 노드(클라이언트)에서 다른 쪽 노드(서버)쪽으로 메시지를 요청 하고, 서버는 메시지를 즉시 응답하게 된다.

 

KDSoap은 Qt를 사용하는 C++응용 프로그램에서 SOAP 가능하도록 하는 3rd party 오픈소스 컴포넌트이다. 웹서비스 용 클라이언트 응용프로그램을 만드는데 사용될 수 있으며 전용 웹 서버와 같은 추가구성요소 없이 웹서비스를 생성할 수 있는 수단을 제공한다.

 

빌드환경:
Windows10
mingw73-32
Qt5.12.4

 

소스코드 체크아웃
git clone https://github.com/KDAB/KDSoap.git
$ git checkout remotes/origin/kdsoap-1.9.0-release
 
Qt용 명령 프롬프트
E:\project\opensource\KDSoap>c:\Python27\python.exe autogen.py -shared -release
 
-- Using source directory: E:\project\opensource\KDSoap
-- Using repository information: revision=kdsoap-1.9.0 isTagged=True
-- Auto-generation done.
-- License marked as accepted.
-- Wrote build files to: E:\project\opensource\KDSoap
-- Now running configure script.
 
 
E:\project\opensource\KDSoap>Qt found: C:/Qt/Qt/5.12.4/mingw73_32
KDSoap v1.9.0 configuration:
 
  Debug...................: no (default: no)
  Release.................: yes (default: yes)
  Shared build............: yes (default: yes)
  Compiled-In Unit Tests..: no (default: no)
 
Info: creating stash file E:\project\opensource\KDSoap\.qmake.stash
Project MESSAGE: No install prefix given, using default of C:\KDAB\KDSoap-1.9.0 (use configure -prefix DIR to specify)
Project MESSAGE: Install prefix is C:\KDAB\KDSoap-1.9.0
Project MESSAGE: This is KD Soap version 1.9.0
Reading E:/project/opensource/KDSoap/kdwsdl2cpp/kdwsdl2cpp.pro
Reading E:/project/opensource/KDSoap/kdwsdl2cpp/libkode/libkode.pro
Reading E:/project/opensource/KDSoap/kdwsdl2cpp/common/common.pro
Reading E:/project/opensource/KDSoap/kdwsdl2cpp/schema/schema.pro
Reading E:/project/opensource/KDSoap/kdwsdl2cpp/wsdl/wsdl.pro
Reading E:/project/opensource/KDSoap/kdwsdl2cpp/src/src.pro
  Reading E:/project/opensource/KDSoap/kdwsdl2cpp/src/kdwsdl2cpp_lib.pro
  Reading E:/project/opensource/KDSoap/kdwsdl2cpp/src/kdwsdl2cpp.pro
Reading E:/project/opensource/KDSoap/src/src.pro
Reading E:/project/opensource/KDSoap/src/KDSoapClient/KDSoapClient.pro
Reading E:/project/opensource/KDSoap/src/KDSoapServer/KDSoapServer.pro
Reading E:/project/opensource/KDSoap/features/features.pro
Reading E:/project/opensource/KDSoap/include/include.pro
Reading E:/project/opensource/KDSoap/include/KDSoapClient/KDSoapClient.pro
Reading E:/project/opensource/KDSoap/include/KDSoapServer/KDSoapServer.pro
Reading E:/project/opensource/KDSoap/examples/examples.pro
Reading E:/project/opensource/KDSoap/examples/helloworld_client/helloworld_client.pro
Reading E:/project/opensource/KDSoap/examples/helloworld_server/helloworld_server.pro
Reading E:/project/opensource/KDSoap/examples/bank_gui/bank_gui.pro
Reading E:/project/opensource/KDSoap/examples/bank_wsdl/bank_wsdl.pro
Ok, now run nmake (for Visual Studio) or mingw32-make (for mingw) to build the framework.
 
빌드 및 설치:
mingw32-make

 

mingw32-make install

 

예제:

KDSoap\examples\helloworld_client

KDSoap\examples\helloworld_server

 

예제 프로젝트 폴더에서 다음과 같이 프로토콜을 정의한 xml 형식 파일이 있다. 컴파일 시 kdwsdl2cpp 에 의해 필요한 소스코드를 생성한다.

helloworld.wsdl

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="HelloService"
   targetNamespace="http://www.ecerami.com/wsdl/HelloService.wsdl"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns="http://www.ecerami.com/wsdl/HelloService.wsdl"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
   <message name="SayHelloRequest">
      <part name="msg" type="xsd:string"/>
   </message>
   <message name="SayHelloResponse">
      <part name="reply" type="xsd:string"/>
   </message>
 
   <portType name="Hello_PortType">
      <operation name="sayHello">
         <input message="tns:SayHelloRequest"/>
         <output message="tns:SayHelloResponse"/>
      </operation>
   </portType>
   
   <binding name="Hello_Binding" type="tns:Hello_PortType">
      <soap:binding style="document" 
         transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="sayHello" style="document">
         <soap:operation soapAction="sayHello"/>
         <input>
            <soap:body
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
               namespace="urn:examples:helloservice"
               use="encoded"/>
         </input>
         <output>
            <soap:body
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
               namespace="urn:examples:helloservice"
               use="encoded"/>
         </output>
      </operation>
</binding>
 
   <service name="Hello_Service">
      <documentation>WSDL File for HelloService</documentation>
      <port binding="tns:Hello_Binding" name="Hello_Port">
         <soap:address location="http://localhost:8081/hello" />
      </port>
   </service>
</definitions>
 

 

예제를 빌드해서 서버를 실행 하고

server.png

 

클라이언트를 실행하여 메세지를 보내본다.

client.png

 

로컬(localhost)에서 서버와 클라이언트 프로세스간 통신하는데도 사용할 수 있다.

번호 제목 글쓴이 날짜 조회 수
공지 Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서 운영자 2019.01.05 85700
178 가상키보드(Qt Virtual Keyboard)를 사용하는 방법 [32] file makersweb 2019.05.03 220752
177 콘솔에서 사용자 입력받기 file makersweb 2020.03.22 51834
176 QString 문자열 다루기 예제 운영자 2019.01.26 39934
175 Windows에서 Qt 설치 따라하기 file makersweb 2019.10.14 30845
174 Qt의 시그널 슬롯 시스템 file makersweb 2015.10.20 23535
173 QThread 소개 및 예제 makersweb 2019.12.25 19382
172 QtCreator Design으로 GUI만들기 (QML로 만드는 Hello World -2) [1] file makersweb 2019.05.26 14834
171 초보자를 위한 첫번째 프로젝트 - QML로 만드는 Hello World file makersweb 2018.03.16 14425
170 Qt 프로그래밍의 시작 makersweb 2015.10.25 14356
169 Qml과 C++로 구현하는 GUI어플리케이션 file makersweb 2018.12.25 13902
168 QML과 QtQuick 모듈 개념과 기본 타입들 makersweb 2019.04.26 13372
167 Windows에서 라즈베리파이3용 Qt5.10.0 크로스컴파일 [20] file makersweb 2018.02.23 12862
166 Qt의 오픈소스 라이센스 소개 file makersweb 2019.12.15 12519
165 Qml 기본 컴포넌트 강좌 (1) file makersweb 2019.01.03 12043
164 QtSerialPort를 사용한 시리얼(Serial)통신 [3] makersweb 2019.05.21 11863
163 Qt Installer Framework - 패키징, 설치프로그램 제작 file makersweb 2018.10.14 11636
162 Qt 응용프로그램 배포(windows) file makersweb 2018.10.10 11282
161 Ubuntu Linux에서 Qt Creator 설치 file makersweb 2016.03.06 10661
160 Qt의 스레드간 시그널 슬롯의 커넥션타입 [1] makersweb 2015.10.24 10148
159 QML 강좌 - 동적 Listing (ListView) file makersweb 2019.06.01 10073