한국어
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 85857
79 QThread 소개 및 예제 makersweb 2019.12.25 19443
78 ApplicationWindow 와 메뉴바(MenuBar)구성 file makersweb 2020.01.04 1499
77 Qt 멀티 스레드 프로그래밍 시 유의해야 할 몇 가지 makersweb 2020.01.13 4867
76 Qt로 XML 파싱 : Qt 6에서 업데이트된 (Parsing XML with Qt: Updates for Qt 6) [1] j2doll 2020.01.16 979
75 2020년에 변경되는 Qt 오퍼 (Qt offering changes 2020) [2] j2doll 2020.01.31 720
74 QOpenGLWidget 을 투명하게 적용 file makersweb 2020.02.05 1031
73 라즈베리파이4에 대한 Qt 5.14.1 크로스컴파일 [1] file makersweb 2020.02.12 4449
72 QLabel의 텍스트 색과 배경색을 변경 makersweb 2020.02.25 6607
71 Qt로 작성된 안드로이드 APP에 Splash Screen을 추가 file makersweb 2020.03.10 883
70 컨테이너 클래스 - QVector makersweb 2020.03.17 2835
69 콘솔에서 사용자 입력받기 file makersweb 2020.03.22 51844
68 Qt 5.15 및 Qt 6의 출시 일정 makersweb 2020.04.09 932
67 재진입(Reentrancy) 및 스레드 안전성(Thread-Safety) makersweb 2020.04.19 1216
» Qt기반의 서버와 클라이언트간 SOAP(Simple Object Access Protocol) file makersweb 2020.05.11 971
65 ShaderEffect QML Type을 이용한 버튼 클릭 효과 file makersweb 2020.05.22 1086
64 Embedded Linux 에서 Qt 및 Graphics Stack file 운영자 2020.05.27 612
63 Qt MQTT 에 대해서 file makersweb 2020.06.02 959
62 최초의 Qt 6.0 스냅샷 제공 (First Qt 6.0 Snapshot Available) j2doll 2020.06.21 591
61 Qt로 데이터를 직렬화(serialization)하는 방법 makersweb 2020.08.04 2052
60 UI 폼(Form)작성 시 탭 순서(Tab Order) 설정 file makersweb 2020.08.24 2771