한국어
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 85891
50 콘솔에서 사용자 입력받기 file makersweb 2020.03.22 51845
49 QString 문자열 다루기 예제 운영자 2019.01.26 40094
48 Qt의 시그널 슬롯 시스템 file makersweb 2015.10.20 23590
47 초보자를 위한 첫번째 프로젝트 - QML로 만드는 Hello World file makersweb 2018.03.16 14454
46 Qt 프로그래밍의 시작 makersweb 2015.10.25 14369
45 Qt의 오픈소스 라이센스 소개 file makersweb 2019.12.15 12565
44 QtSerialPort를 사용한 시리얼(Serial)통신 [3] makersweb 2019.05.21 11902
43 Qt 응용프로그램 배포(windows) file makersweb 2018.10.10 11324
42 Qt의 스레드간 시그널 슬롯의 커넥션타입 [1] makersweb 2015.10.24 10173
41 Qt SQL을 이용한 가벼운 데이터베이스 다루기 [1] file 운영자 2019.01.23 6965
40 Qt 어플리에이션 전역에 폰트 설정 makersweb 2018.01.24 5582
39 Qt기반의 오픈소스 프로젝트들 makersweb 2019.05.15 5417
38 멀티 스레드환경, 스레드에 안전한 이벤트처리 makersweb 2016.10.27 4999
37 Qt 멀티 스레드 프로그래밍 시 유의해야 할 몇 가지 makersweb 2020.01.13 4870
36 QNetworkAccessManager를 통해 HTTP POST 하는 예제 makersweb 2019.01.17 4768
35 Qt응용프로그램 실행 시 콘솔창(터미널)같이 띄우기 file makersweb 2019.01.16 4485
34 Windows에서 Qt D-Bus를 사용하여 프로세스간 통신(IPC) file makersweb 2019.05.02 4481
33 Qt기반의 오픈소스 프로젝트들 - 2 운영자 2019.07.21 4003
32 Qt 를 사용하거나 기반으로 하는 응용프로그램 file makersweb 2021.01.30 3798
31 Qt Logging Rule, Qt 프레임워크 로그 출력 makersweb 2017.01.13 3700