zebity / onvif-relay Goto Github PK
View Code? Open in Web Editor NEWAn onvif device relay/device test harness
Home Page: https://tips.graphica.com.au/onvif-ws-client-consumption/
License: Other
An onvif device relay/device test harness
Home Page: https://tips.graphica.com.au/onvif-ws-client-consumption/
License: Other
Issues:
ONVIF WSDL specifies all operation starting with upper case letters:
Example:
<wsdl:operation name="GetDeviceInformation">
<wsdl:documentation>This operation gets basic device information from the device.</wsdl:documentation>
<wsdl:input message="tds:GetDeviceInformationRequest"/>
<wsdl:output message="tds:GetDeviceInformationResponse"/>
</wsdl:operation>
But JAX-WS converts these to lower case first letter ie "getDeviceInformation"
This means that the message interface is no longer conformant with WSDL.
Can this be disabled ?
Testing:
via curl
curl --verbose http://127.0.0.1:9080/onvif/device_service -H "Content-Type: text/xml" --data '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><getDeviceInformation xmlns="http://www.onvif.org/ver10"></getDeviceInformation></s:Body></s:Envelope>'
Works.
curl --verbose http://127.0.0.1:9080/onvif/device_service -H "Content-Type: text/xml" --data '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"></GetDeviceInformation></s:Body></s:Envelope>'
Fails
Issue:
Testing client and server code generation with JAX-WS SOAP Web Services it seems that the client is generating SOAP 1.2 requests while the server is providing SOAP 1.1 service.
SOAP 1.1 uses HTTP "Content-Type: text/xml"
SOAP 1.2 uses HTTP "Content-Type: application/xml+soap"
Result is that get exception due to having incompatible media types
Need to either change client to use SOAP 1.1 or change server to use provide SOAP 1.2
Environment:
Ubuntu: 22.04
OpenJDK: 11
Maven Dependencies:
JAVA EE/JAKARTA TRANSITIONAL:
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.3</version>
<!-- scope>runtime</scope -->
</dependency>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.3</version>
</dependency>
<plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.5</version>
...
</plugin>
NOTE: Same problem using more current Jakarta dependencies
Testing:
via curl and generated Java code.
See here for details: ONVIF Web Services Client Consumption with Java
Problem:
To build this code requires:
Metro wsimport and scripts or
CXF WSDL2Java tool
In case of Metro the MVN pom does not allow for generating multiple java code sets from multiple wsdl files (appear to only support single wsdl...)
For both Metro and CXF build the extra:
scripts are not run automatically.
Need to create ant wrappers around these to allow automatic build.
Issue
GetCapabilities is an example of ONVIF get request that takes as input the scope of request (via list of CapabilityCategory).
So need to have this list input to the request.
JSON would be like:
{ "category": [ "All"] }
Without having this input the introspection call fails,
Expectation
Introspection call should be able to handle JSON based request payload.
Issue:
Currently this code runs when executed within Eclipse but gets Null Pointer exception when run directly from Jar files.
I have tried to address this by changing to "Shade" jar Maven plugin but still have problem.
It appears that there is conflicts within or missing dependency.
Reproducing Problem:
Build device, client or relay using Maven "mvn install" which will create executable Jar flles in corresponding Maven module target directories and then run via jar: "java -jar <The.Jar> -c ~/etc/onvif-relay.ini" (for example)
Cause:
Likely due to subtle dependency issse
Problem:
Having build server code via Metro libraries and tools I could not get cxf based client to work with this.
So there appear to be issue with JAX-WS interoperability.
Target Result:
It would be desirable to build server (test device) using Metro but have CXF client as this provides digest authentication while Metro does not/
** Issue **
Currently test harness (onvif-device) requires that you code the "fake" device responses.
This is not scalable.
Need to change it so that there is way to record responses from real ONVIF devices (this could be done via proxy-relay record feature) and the plays these back via the test harness.
Recorded responses should just be JSON serialization dumps.
** Expectation **
To be able to have full scripted play (of onvif requests) which get recorded for later use by test harness.
Test harness need to "adjust some responses which have time related response.
Issue
ONVIF specification:
"The services defined in this standard shall be protected using digest authentication according to [RFC 2617] with the following exceptions.
Currently code supports Digest (RFC2617), but fails with older devices which only support WS-UsernameToken based authentication.
Need to add support for WS-Security
Expectation
Access should try:
NOTE: This may be require GetSystemDateTime to get clock of device for Auth Token generation
Issue
GetNetworkInterfaces is an example of type that does not include a "set" method, to set the list of results.
Rather it provides a "List getNetworkInterfaces();"
Which then requires you to use "add" to add the individual items to.
The problems is that you copy data from provided list to new list requires instansiating list of known type.
You cannot do:
List srclist = (List)gotlist;
List tarlist = (Listinvoke-get-via-reflection;
for (int i = 0; i < srclist.size(); i++) {
tarlist.add(srclist.get(i));
}
Diagnostic
Need to find the type of the provided List and then create the new list do it matches the type.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.