Git Product home page Git Product logo

onvif-relay's People

Contributors

alex-g-bell avatar zebity avatar

Stargazers

 avatar

Watchers

 avatar  avatar

onvif-relay's Issues

JAX-WS Generating code with lower case operations with breaks WSDL compliance

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

JAX-WS SOAP 1.1 / 1.2 Client / Server Generated Code Asymmetry

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

Cannot auto build full project

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:

  • download and patch wsdl &
  • xsltproc binding customisation

scripts are not run automatically.

Need to create ant wrappers around these to allow automatic build.

GetCapabilities - Needs to handle inclusion of CapabilityCategory list

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.

Executes within Eclipse Environment but not from standalone Jars

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

Metro / CXF Interoperability Issue

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/

Test Harness (onvif-device) should have feature to record and replay responses

** 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.

Fails when WS-UsernameToken (WS-Security) is used with old ONVIF Device

Issue

ONVIF specification:
"The services defined in this standard shall be protected using digest authentication according to [RFC 2617] with the following exceptions.

  • legacy devices supporting [WS-UsernameToken] and
  • TLS client authorization."

Currently code supports Digest (RFC2617), but fails with older devices which only support WS-UsernameToken based authentication.

Need to add support for WS-Security

  • if get HTTP 400 with "SOAP:Fault env:Sender ter:NotAuthorized" result then add WS-Security headers and retry.

Expectation

Access should try:

  1. HTTP (no credential)
  2. HTTP 401 returned
  • Retry HTTP with Digest header
  1. HTTP 400 returned with SOAP NotAuthorized
  • Retry HTTP with WS-UsernameToken

NOTE: This may be require GetSystemDateTime to get clock of device for Auth Token generation

GetNetworkInterfaces - returns List<NetworkInterface>, but does not define set Method

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.