Click here to Skip to main content
11,641,668 members (65,611 online)
Click here to Skip to main content

Tagged as

How do I make GSOAP support Unicode?

, 3 Feb 2011 CPOL 14.4K 3
Rate this:
Please Sign up or sign in to vote.
How do I make GSOAP support Unicode?
It's my first tip and trick, so please analyse it and give your suggestions.

Introduction
The gSOAP is an open source toolkit for SOAP/XML Web services. It is available at the link below:
GSoap 2.8.0 ->[^]

Using gSOAP, we can easily develop the SOAP and XML Web services in C/C++. We can use it to automatically convert XML to/from C and C++ data.

Purpose
GSoap does not support Unicode, this trick is helpful to make gSoap client that support Unicode data.

Steps to create gsoap client that supports unicode
1) Open command prompt.

2) Set the path of gsoap win32 folder.
cd PATH_OF_GSOAP_FOLDER\gsoap_2.8.0\gsoap-2.8\gsoap\bin\win32

3) Generate header file using wsdl2h.exe.
wsdl2h.exe -o OUTPUT_FILE_NAME.h -r xxx.xxx.xxx.xxx:xxxx PATH_OF_WSDL_FILE_NAME

Note: If proxy is enabled, than only use -r xxx.xxx.xxx.xxx:xxxx.

4) Add code in OUTPUT_FILE_NAME.h file:
class xsd__wstring : public xsd__anyType
{ public:
    std::wstring                          __item;
};

5) Update variable which you want to update on your code with std::string to std::wstring.

6) Now create client using this command:
soapcpp2.exe -I "gsoap2.8\import" -1 GSOAPCLIENT.h

7) After executing this line, a number of files are generated. These are:

a) SoapC.cpp
b) SoapH.h
c) soapClient.cpp
d) soapStub.h
e) .nsmap and .h file with same name
f) soapServer.cpp

Add these file to your source code.

Now you can send and receive Unicode data also using gSoap.

Thanks Rose | [Rose]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ShilpiP
Software Developer (Senior)
India India
5+ year experience in VC++ technology.
Worked as a Sr. Software Engineer with Webdunia.com (India) Pvt Ltd.

You may also be interested in...

Comments and Discussions

 
GeneralIt didnt work (2.8.15) Pin
ondera2-Aug-13 13:59
memberondera2-Aug-13 13:59 
GeneralDosnt seems to work with 2.8.6... Pin
Greg9718-Dec-11 20:11
memberGreg9718-Dec-11 20:11 
GeneralRe: Dosnt seems to work with 2.8.6... Pin
Crulex21-Mar-12 1:30
memberCrulex21-Mar-12 1:30 
GeneralReason for my vote of 5 It's really hard to find trick like... Pin
Dr.Luiji10-Sep-11 11:55
memberDr.Luiji10-Sep-11 11:55 
GeneralRe: Thanks Dr. Luiji. :) Pin
SP 2411-Sep-11 1:57
memberSP 2411-Sep-11 1:57 
GeneralHi Indivara, Thank you so much for your feedback. I will upd... Pin
Shilpi Boosar30-Jan-11 21:18
memberShilpi Boosar30-Jan-11 21:18 
GeneralFrom a complete layman's viewpoint - - You need to explain b... Pin
Indivara30-Jan-11 20:42
subeditorIndivara30-Jan-11 20:42 
GeneralThanks ! Pin
Alexandre GRANVAUD19-May-11 2:57
memberAlexandre GRANVAUD19-May-11 2:57 
GeneralRe: Thanks ! Pin
ShilpiP19-May-11 3:01
memberShilpiP19-May-11 3:01 
GeneralRe: Thanks ! Pin
Greg9718-Dec-11 20:03
memberGreg9718-Dec-11 20:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150731.1 | Last Updated 3 Feb 2011
Article Copyright 2011 by ShilpiP
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid