Generate working Onvif code with wsdl2cpp

杀马特。学长 韩版系。学妹 提交于 2020-01-06 18:08:52

问题


I generated the DeviceMgmt stub from cmd with

WSDL2CPP.bat -uri http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl -u -d adb -o OutputDirectory

The first time, I got an error like "No service was found" and I solved it by adding this:

<wsdl:service name="OnvifService">
  <wsdl:port name="OnvifEndpoint" binding="DeviceBinding">
    <soap:address location="http://www.onvif.org/ver10/device/wsdl"/>
  </wsdl:port>
</wsdl:service>

in devicemgmt.wsdl

I opened the generated project in VS2012 and set the project configuration type to dynamic library. After I compiled it I got a lot of errors like:

Error   907 error C2065: 'element' : undeclared identifier  d:\projects\onvif\devicemgmtservice\src\unsupportedpolicyrequestfaulttype.cpp   878
Error   1725    error C2143: syntax error : missing ';' before '*'  d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.h    46
Error   1726    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.h    46
Error   1731    error C2061: syntax error : identifier 'axutil_duration_t'  d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.h    206
Error   2872    error C2143: syntax error : missing ';' before '*'  d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.h    46
Error   2873    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.h    46  error C2660: 'axutil_base64_binary_set_encoded_binary' : function does not take 1 arguments d:\projects\onvif\devicemgmtservice\src\motionincells.cpp   343
Error   4114    error C2059: syntax error : ')' d:\projects\onvif\devicemgmtservice\src\motionincells.cpp   344
Error   4256    error C2065: 'cp' : undeclared identifier   d:\projects\onvif\devicemgmtservice\src\messagetypes_type0.cpp  81
Error   4257    error C2065: 'cp' : undeclared identifier   d:\projects\onvif\devicemgmtservice\src\messagetypes_type0.cpp  83
Error   4258    error C2065: 'cp' : undeclared identifier   d:\projects\onvif\devicemgmtservice\src\messagetypes_type0.cpp  85
Error   4259    error C2065: 'cp' : undeclared identifier   d:\projects\onvif\devicemgmtservice\src\messagetypes_type0.cpp  86
Error   4260    error C2065: 'cp' : undeclared identifier   d:\projects\onvif\devicemgmtservice\src\messagetypes_type0.cpp  100
Error   4261    error C2065: 'cp' : undeclared identifier   d:\projects\onvif\devicemgmtservice\src\messagetypes_type0.cpp  108
Error   4262    error C2664: 'axutil_qname_free' : cannot convert parameter 1 from 'void *' to 'axutil_qname *' d:\projects\onvif\devicemgmtservice\src\messagetypes_type0.cpp  416
Error   4695    error C2065: 'element' : undeclared identifier  d:\projects\onvif\devicemgmtservice\src\invalidfilterfaulttype.cpp  878
Error   6379    error C2065: 'env' : undeclared identifier  d:\projects\onvif\devicemgmtservice\src\attributedqnametype.cpp 88
Error   6380    error C2227: left of '->allocator' must point to class/struct/union/generic type    d:\projects\onvif\devicemgmtservice\src\attributedqnametype.cpp 88
Error   6381    error C2227: left of '->malloc_fn' must point to class/struct/union/generic type    d:\projects\onvif\devicemgmtservice\src\attributedqnametype.cpp 88
Error   6382    error C2065: 'prefix' : undeclared identifier   d:\projects\onvif\devicemgmtservice\src\attributedqnametype.cpp 89
Error   6383    error C2065: 'prefix' : undeclared identifier   d:\projects\onvif\devicemgmtservice\src\attributedqnametype.cpp 90
Error   6518    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.h    46
Error   6523    error C2061: syntax error : identifier 'axutil_duration_t'  d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.h    206
Error   6524    error C3861: 'axutil_duration_create_from_string': identifier not found d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.cpp  132
Error   6525    error C2039: '_duration' : is not a member of 'org_xmlsoap_schemas_soap_envelope::AbsoluteOrRelativeTimeType::<unnamed-type-memberType>'    d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.cpp  229
Error   6526    error C3861: 'axutil_duration_serialize_duration': identifier not found d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.cpp  229
Error   6527    error C2143: syntax error : missing ';' before '*'  d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.cpp  437
Error   6528    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.cpp  437
Error   6529    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.cpp  439
Error   6530    error C2039: '_duration' : is not a member of 'org_xmlsoap_schemas_soap_envelope::AbsoluteOrRelativeTimeType::<unnamed-type-memberType>'    d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.cpp  442
Error   6531    error C2059: syntax error : ')' d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.cpp  444
Error   6532    error C2065: 'member_type' : undeclared identifier  d:\projects\onvif\devicemgmtservice\src\absoluteorrelativetimetype.cpp  448
Error   6539    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_registry.h  65
Error   6540    error C2061: syntax error : identifier 'neethi_operator_t'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_assertion.h 179
Error   6541    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    58
Error   6542    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    58
Error   6543    error C2086: 'int neethi_policy_t' : redefinition   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    58
Error   6544    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    62
Error   6545    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    79
Error   6546    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    79
Error   6547    error C2086: 'int neethi_policy_t' : redefinition   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    79
Error   6548    error C2061: syntax error : identifier 'neethi_policy_t'    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    83
Error   6549    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    83
Error   6550    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    103
Error   6551    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    103
Error   6552    error C2086: 'int neethi_policy_t' : redefinition   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    103
Error   6553    error C2061: syntax error : identifier 'neethi_policy_t'    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    106
Error   6554    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    108
Error   6555    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    122
Error   6556    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    122
Error   6557    error C2086: 'int neethi_policy_t' : redefinition   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    122
Error   6558    error C2061: syntax error : identifier 'neethi_policy_t'    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    125
Error   6559    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    126
Error   6560    error C2065: 'policy' : undeclared identifier   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    136
Error   6561    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_engine.h    137
Error   6562    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_util.h  38
Error   6563    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_util.h  38
Error   6564    error C2086: 'int neethi_policy_t' : redefinition   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_util.h  38
Error   6565    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_util.h  41
Error   6566    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_util.h  43
Error   6567    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_util.h  43
Error   6568    error C2086: 'int neethi_policy_t' : redefinition   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_util.h  43
Error   6569    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_util.h  46
Error   6570    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethipolicy.h 53
Error   6571    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethipolicy.h 53
Error   6572    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethipolicy.h 60
Error   6573    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethipolicy.h 60
Error   6575    error C2061: syntax error : identifier 'neethi_policy_t'    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethipolicy.h 66
Error   6576    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\serviceclient.h    84
Error   6577    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\serviceclient.h    84
Error   6586    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\serviceclient.h    386
Error   6587    error C2071: 'wso2wsf::ServiceClient::axis2_svc_client_t' : illegal storage class   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\serviceclient.h    386
Error   6588    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\serviceclient.h    386
Error   6590    error C2378: 'neethi_policy_t' : redefinition; symbol cannot be overloaded with a typedef   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    38
Error   6591    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    40
Error   6592    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    40
Error   6593    error C2086: 'int neethi_policy_t' : redefinition   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    40
Error   6594    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    42
Error   6595    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    46
Error   6596    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    47
Error   6597    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    51
Error   6598    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    52
Error   6599    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    56
Error   6600    error C2065: 'arraylist' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    57
Error   6601    error C2275: 'axutil_array_list_t' : illegal use of this type as an expression  d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    57
Error   6602    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    58
Error   6603    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    62
Error   6604    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    63
Error   6605    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    68
Error   6606    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    69
Error   6607    error C2065: 'normalized_neethi_policy' : undeclared identifier d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    73
Error   6608    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    74
Error   6609    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    78
Error   6610    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    79
Error   6611    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    83
Error   6612    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    84
Error   6613    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    88
Error   6614    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    89
Error   6615    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    94
Error   6616    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    95
Error   6617    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    99
Error   6618    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    100
Error   6619    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    105
Error   6620    error C2065: 'parent' : undeclared identifier   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    106
Error   6621    error C2275: 'axiom_node_t' : illegal use of this type as an expression d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    106
Error   6622    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    107
Error   6623    error C2065: 'policy' : undeclared identifier   d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    111
Error   6624    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    112
Error   6625    error C2065: 'neethi_policy' : undeclared identifier    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    117
Error   6626    error C2059: syntax error : 'const' d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\neethi_policy.h    118
Error   6627    error C2061: syntax error : identifier 'neethi_policy_t'    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\axis2_svc_client.h 602
Error   6628    error C2061: syntax error : identifier 'neethi_policy_t'    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\axis2_policy_include.h 110
Error   6629    error C2061: syntax error : identifier 'neethi_policy_t'    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\axis2_policy_include.h 117
Error   6630    error C2061: syntax error : identifier 'neethi_policy_t'    d:\wso\wso2-wsf-cpp-bin-2.1.0-win32\wso2-wsf-cpp-bin-2.1.0-win32\include\axis2_policy_include.h 124
Error   6631    error C2143: syntax error : missing ';' before '*'  d:\wso\wso2-

Has someone generated working code for Onvif using WSO2? What am I doing wrong?


回答1:


Have not tried using WSO2, but have used svcutil.exe.

I added my client proxy using Visual Studio 2012,

  1. Add new Project, new ClassLibrary
  2. in solution explorer use the add new service reference context menu
  3. In the address, use url to the wsdl http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl
  4. Clik Go
  5. Select an apropiate name, like OnvifDeviceService.
  6. Clik Ok

This will auto generate the proxy for you. Mind that Onvif is using Soap12, so basicHttpBinding is out the window as this uses Soap1.1.

Use a WsHttpBinding or a custom binding to connect to your device.

Use the built in method for scanning for devices. Add a reference to System.ServiceModel.Discovery assembly, and this code will scan your network for devices. Some filtering for onvif devices must be implemented.

private FindResponse ScanNetwork(string scopeMathcBy, int iTimeoutMilliseconds)
    {
        ServicePointManager.Expect100Continue = false;

        UdpDiscoveryEndpoint oUdpDiscoveryEndpoint = new UdpDiscoveryEndpoint(DiscoveryVersion.WSDiscoveryApril2005);
        DiscoveryClient oDiscoveryClient = new DiscoveryClient(oUdpDiscoveryEndpoint);

        // Create FindCriteria 
        var findCriteria = new FindCriteria
        {
            Duration = TimeSpan.FromMilliseconds(iTimeoutMilliseconds)
        };
        if (scopeMathcBy != null)
        {
            findCriteria.ScopeMatchBy = new Uri(scopeMathcBy);
        }

        var findResponse = oDiscoveryClient.Find(findCriteria);
        return findResponse;
    }



回答2:


Solved! The problem was in include order. I have rearranged #include directives and i added some includes were needed. But there where still 2 error that was easily removed just looking in the generated code.



来源:https://stackoverflow.com/questions/16523992/generate-working-onvif-code-with-wsdl2cpp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!