한국어
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 85821
49 Qt 하이브리드 애플리케이션(Hybrid App) 개발 file makersweb 2023.02.08 845
48 Widgets(C++) 기반의 기본 스타일을 Dark 테마 및 Material 디자인 스타일로 바꾸기 file makersweb 2023.01.28 1115
47 Qt Property(속성) 시스템 makersweb 2023.01.08 1717
46 VTK 를 사용해서 강력한 시각화(3D, Plotting, Chart)Qt 응용프로그램 개발하기 file makersweb 2022.10.16 1574
45 QProcess 보안 권고 리뷰 file makersweb 2022.09.18 585
44 clazy 로 13개의 시그널, 슬롯 오류 해결 makersweb 2022.08.23 564
43 단일 인스턴스 Qt 응용 프로그램(Single-instance Application) makersweb 2022.06.23 700
42 VirtualKeyboard 스타일 커스터 마이징 makersweb 2022.03.13 462
41 Qt 응용프로그램에서 PDF 문서 렌더링 file makersweb 2021.09.23 676
40 Qt 를 사용하거나 기반으로 하는 응용프로그램 file makersweb 2021.01.30 3785
39 UI 폼(Form)작성 시 탭 순서(Tab Order) 설정 file makersweb 2020.08.24 2770
» Qt기반의 서버와 클라이언트간 SOAP(Simple Object Access Protocol) file makersweb 2020.05.11 969
37 콘솔에서 사용자 입력받기 file makersweb 2020.03.22 51842
36 QOpenGLWidget 을 투명하게 적용 file makersweb 2020.02.05 1031
35 2020년에 변경되는 Qt 오퍼 (Qt offering changes 2020) [2] j2doll 2020.01.31 720
34 Qt 멀티 스레드 프로그래밍 시 유의해야 할 몇 가지 makersweb 2020.01.13 4863
33 Qt의 오픈소스 라이센스 소개 file makersweb 2019.12.15 12547
32 Qt Marketplace 발표 makersweb 2019.12.02 617
31 QOpenVirtualkeyboard(Qt 5용 한글 및 영문, 숫자 가상키보드) file makersweb 2019.11.27 2240
30 많은 리소스를 사용하는 Qt프로젝트에서 고려해봐야 할 qmake 옵션 makersweb 2019.10.11 1236