tags:

views:

136

answers:

2

I'm using gSoap along with Qt for Symbian.

Under the emulator, the application compiles fine, but when I change the target of the compiler to compile for the device, I get the following error:

WARNING: Can't find following headers in System Include Path 
<netinet\tcp.h> 

This gets included from the stdsoap2.h file as follows:

#ifndef WITH_NOIO
# ifndef WIN32
#  ifndef PALM
#   include <sys/socket.h>
#   ifdef VXWORKS
#    include <sockLib.h>
#    include <selectLib.h>
#    ifndef _WRS_KERNEL
#     include <strings.h>
#    endif
#   else
#    ifndef SYMBIAN
#     include <strings.h>
#    endif
#   endif
#   ifdef SUN_OS
#    include <sys/stream.h>     /* SUN */
#    include <sys/socketvar.h>      /* SUN < 2.8 (?) */
#   endif
#   ifdef VXWORKS
#    ifdef _WRS_KERNEL
#     include <sys/times.h>
#    endif
#   else
#    include <sys/time.h>
#   endif
#   include <netinet/in.h>
#   ifdef OS390
#    include <netinet/tcp_var.h>
#   else
#     include <netinet/tcp.h>          /* TCP_NODELAY */
#   endif
#   include <arpa/inet.h>
#  endif
# endif
#endif

I'm stumped! The file cannot be found anywhere..

+1  A: 

This header is provided by the S60 SDK, and is located here:

%EPOCROOT%\epoc32\include\libc\netinet\tcp.h

In order to correctly resolve #include <netinet\tcp.h> therefore, your MMP file will need to contain the following line:

SYSTEMINCLUDE /epoc32/include/libc
Gareth Stockwell
Do you happen to know how I could write this in the .pro file? I tried the following but it didn't work:INCLUDEPATH += /epoc32/include/libc
sabbour
I just tested adding `INCLUDEPATH += /epoc32/include/lib` to my .pro file, ran qmake, and the generated .mmp file contains `SYSTEMINCLUDE /epoc32/include/libc`. What version of Qt are you using?
Gareth Stockwell
I'm using 4.6.3
sabbour
Had to write it as follows INCLUDEPATH += $$EPOCROOT\epoc32\include\libc
sabbour
A: 

To finally make it work, I had to port gSoap to use stdapis instead of libc. I removed one of the <netinet\tcp.h> lines and used <sys/select.h> instead.

You can find the ported stdsoap2.h file here: http://pastebin.com/xnrDbfFa

I also discovered that Symbian does not load STL by default, so all my methods that were returning std::vector and std::string are now not compiling.

Instead of opting to the -s flag to disable STL usage, I added the Symbian STL port to the INCLUDEPATH in the .pro file like so

symbian {
    INCLUDEPATH += $$EPOCROOT\epoc32\include\stdapis\stlport
    INCLUDEPATH += $$EPOCROOT\epoc32\include\stdapis\stlport\stl
}

And in the soapStub.h I had to include

#include <vector>
#include <string>

Also you should modify your typemap.dat and add the following:

# Symbian specific
xsd__dateTime = | std::string
xsd__long = | long
xsd__unsignedLong = | unsigned long
xsd__int = | int

in order to be able to compile, otherwise the compiler will complain about:

'soap_outdateTime' was not declared in this scope 
'soap_indateTime' was not declared in this scope 

since under Symbian, gSoap is built with the WITH_LEAN flag, hence some of the stuff are disabled (for example, no support for time_t serialization and no support for LONG64/ULONG64 serialization) hence the required typemap.dat overrides above.

Finally, for future reference, here are the command line arguments that I used to generate the files:

wsdl2h.exe -o service.h http://myservicelocation.com/DataDisplayingWCF.svc?wsdl

and then:

soapcpp2.exe -I "C:\gsoap-2.7\gsoap\custom;C:\gsoap-2.7\gsoap\import" "service.h" -ixw

You might also want to setup the namespaces in the typemap.dat and regenerate using wsdl2h. n

sabbour