I am trying to generate code using wsdl2h/soap2cpp for the onvif media WSDL http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl. This wsdl have some dependencies.
Reading the gSOAP FAQ http://www.cs.fsu.edu/~engelen/soapfaq.html, I finally extract the needed namespaces in following typemap.dat
trt = "http://www.onvif.org/ver10/media/wsdl"
tt = "http://www.onvif.org/ver10/schema"
wsnt = "http://docs.oasis-open.org/wsn/b-2"
wsrfbf = "http://docs.oasis-open.org/wsrf/bf-2"
wstop = "http://docs.oasis-open.org/wsn/t-1"
xop="http://www.w3.org/2004/08/xop/include"
wsa5 = <http://www.w3.org/2005/08/addressing>
With this mapping the gSOAP code generator run correctly :
wsdl2h media.wsdl
soapcpp2 -2ix media.h -I /usr/share/gsoap/import
But this need to have an internet connection. I would like to build with files that are stored locally.
In the wsdl2h help there is an option that looks interesting :
-i don't import (advanced option)
So I download what was downloaded by wsdl2h :
- http://www.onvif.org/onvif/ver10/schema/onvif.xsd
- http://docs.oasis-open.org/wsn/b-2.xsd
- http://www.w3.org/2004/08/xop/include
- http://docs.oasis-open.org/wsrf/bf-2.xsd
- http://docs.oasis-open.org/wsn/t-1.xsd
And next run
wsdl2h -im media.wsdl onvif.xsd b-2.xsd include bf-2.xsd t-1.xsd
soapcpp2 -2ix media.h -I /usr/share/gsoap/import
But this fails with this kind of output :
** The gSOAP code generator for C and C++, soapcpp2 release 2.8.7
** Copyright (C) 2000-2011, Robert van Engelen, Genivia Inc.
** All Rights Reserved. This product is provided "as is", without any warranty.
** The soapcpp2 tool is released under one of the following two licenses:
** GPL or the commercial license by Genivia Inc.
media.h(164): syntax error
media.h(163): Syntax error: declaration expected
media.h(173): syntax error
...
In media.h the code reference strucure coming from ws-addressing. Next I tried different things importing more xsd but I did not find a way to resolve the missing dependencies. Perhaps this is not the proper way to build from local file. Anyway I would like to avoid any modification in the wsdls and xsd files. An alternative could be a catalog to map the remote url to local url (like Apache CXF) but I did not find anything like this in gSOAP documentation.
Thanks for sharing your experiences.