Reputation: 9037
We're using gSoap 2.8.106 (since that's what Yocto Kirkstone provides). We've taken https://github.com/KoynovStas/onvif_srvd as a base and started implementing ONVIF S and T Profile. T Profile requires additional event filtering as can be seen in tests like EVENT-2-1-26-v17.06 BASIC NOTIFICATION INTERFACE – TOPIC SUB-TREE IN PULLMESSAGES FILTER. In EventBindingService::CreatePullPointSubscription
you receive a _tev__CreatePullPointSubscription
pointer. There's a member Filter
which points to wsnt__FilterType
:
/* complex XML schema type 'tev:CreatePullPointSubscription': */
class SOAP_CMAC _tev__CreatePullPointSubscription {
public:
/// Optional element 'tev:Filter' of XML schema type 'wsnt:FilterType'
wsnt__FilterType *Filter;
But wsnt__FilterType
doesn't have anything in it:
/* complex XML schema type 'wsnt:FilterType': */
class SOAP_CMAC wsnt__FilterType : public soap_dom_element {
public:
/// XML DOM element node graph
std::vector<struct soap_dom_element> __any;
On gSOAP - ONVIF examples: ONVIF_Extensibility it explains:
ONVIF data types may be extensible, permitting additional elements and/or attributes. However, most scenarios associated with profiles do not require these extensions so we remove them by default to reduce the size of the generated source code.
If specific element and/or attribute extensions to a complexType are still required in specific cases, then we simply use the typemap.dat file to add these as additional optional members to the generated classes/structs.
Likewise, we add the following line to typemap.dat to add the wsnt:TopicExpression element to the tt:Filter element of tt:Events of the Events ONVIF WSDL:
tt__EventFilter = $ wsnt__TopicExpressionType *wsnt__TopicExpression;
If I do that then tt__EventFilter
changes to:
class SOAP_CMAC tt__EventFilter : public wsnt__FilterType {
public:
/// XML DOM attribute list
/// Typedef xsd__anyAttribute with custom serializer for struct soap_dom_attribute
struct soap_dom_attribute __anyAttribute;
/// Optional element 'wsnt:TopicExpression' of XML schema type 'wsnt:TopicExpressionType'
wsnt__TopicExpressionType *wsnt__TopicExpression;
But that's not wsnt__FilterType
which is what I'm getting from _tev__CreatePullPointSubscription
. So what's the intention here?
I can change the line in typemap.dat
to:
wsnt__FilterType = $ wsnt__TopicExpressionType *wsnt__TopicExpression;
then wsnt__FilterType
becomes:
class SOAP_CMAC wsnt__FilterType : public soap_dom_element {
public:
/// XML DOM element node graph
std::vector<struct soap_dom_element> __any;
/// Optional element 'wsnt:TopicExpression' of XML schema type 'wsnt:TopicExpressionType'
wsnt__TopicExpressionType *wsnt__TopicExpression;
Using wsnt__TopicExpressionType
I can read Dialect
but that's all there is. How can I read the rest of the filter details?
Once I read the filter, is there an implementation for it anywhere or do I have to write this from scratch?
Upvotes: 0
Views: 231
Reputation: 81
Add the following lines to the wsdl/typemap.dat
file passed into wsdl2h
:
wsnt__FilterType = $ std::vector<wsnt__TopicExpressionType*> TopicExpression 0; ///< Multiple elements.
wsnt__FilterType = $ std::vector<wsnt__QueryExpressionType*> MessageContent 0; ///< Multiple elements.
This will include serialization and deserialization code for the specified elements.
You should be able to get the Topic Expression from the soap_dom_element
__any
:
std::string topic = topicExpression->__any.get_text();
Upvotes: 0