4

I am using Visual Studio and GSOAP 2.8.15 to create a C++ Onvif client.

I have run these commands to create source code:

> wsdl2h -P -x -o onvif.h http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl

> soapcpp2 -i -C -IC:\gsoap-2.8.15\gsoap;C:\gsoap-2.8.15\gsoap\import onvif.h

Then I put these files in my MSVC solution:

duration.h/.cpp
soapH.h/soapC.cpp
stdsoap2.h/.cpp

I added this file to the directory but not to the solution:

soapStub.h

I added this as a #define to the compilation:

WITH_NONAMESPACES

I added this include to the main file of my program:

#include "soapDeviceBindingProxy.h"

This gives me a DeviceBindingProxy object, but I don't know what to do with it. I want to connect to an Onvif camera at a known ip address and request information about the device.

The GSOAP examples aren't specific to Onvif, and the Onvif pseudo-code examples aren't specific to GSOAP. Any help would be appreciated.

Pierre Fourgeaud
  • 14,290
  • 1
  • 38
  • 62
Tim
  • 41
  • 1
  • 3
  • 1
    It's been a long time since this question was asked, but someone may find this helpful: https://github.com/tonyhu/gsoap-onvif/blob/master/main.cpp . It's really just code that describes what @Daddy32 has explained below, and should help people in getting started. – Zaxter Jun 15 '15 at 10:24

1 Answers1

1

Just open the definition of DeviceBindingProxy object (or even better: run a doxygen on the gSoap-generated source files and enjoy comfortable HTML documentation).

It should contain a separate method for each action the service provides, named exactly as per service definition.

Each of the methods should take two parameters: request & response (their types are pointers to gSoap-generated structures: see their definition/documentation for details).

All you need to do is create instances of request & response, fill the request, pass pointers to both to this method and harvest the data from (already parsed) response.

Daddy32
  • 429
  • 4
  • 16