Giter Site home page Giter Site logo

onvif-java-lib's People

Forkers

e-lionel

onvif-java-lib's Issues

Error calling setVideoEncoderConfiguration media.wsdl

Hi,
I have added a method to MediaDevices.java in order to set video encoder 
configuration. This is my implementation:


/*******************************************************************************
******************************/
    public boolean setVideoEncoderConfiguration(VideoEncoderConfiguration videoEncoderConfiguration) {
        SetVideoEncoderConfiguration request = new SetVideoEncoderConfiguration();
        SetVideoEncoderConfigurationResponse response = new SetVideoEncoderConfigurationResponse();

        request.setConfiguration(videoEncoderConfiguration);
        request.setForcePersistence(true);

        try {
            response = (SetVideoEncoderConfigurationResponse) soap.createSOAPMediaRequest(request, response, true);
        }
        catch (SOAPException | ConnectException e) {
            e.printStackTrace();
            return false;
        }

        if (response == null) {
            return false;
        }

        return true;
    }
/*******************************************************************************
******************************/

When I call to this method using as parameter what I have got from calling to 
getVideoEncoderConfigurations (a VideoEncoderConfiguration object),
I got an error in SOAP.java (createSOAPRequest method).

Oct 03, 2014 1:44:02 PM 
com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPPart1_2Impl 
createEnvelopeFromSource
SEVERE: SAAJ0415: InputStream does not represent a valid SOAP 1.2 Message
javax.xml.soap.SOAPException: InputStream does not represent a valid SOAP 1.2 
Message
    at com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPPart1_2Impl.createEnvelopeFromSource(SOAPPart1_2Impl.java:72)
    at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:128)
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.getSOAPBody(MessageImpl.java:1351)
    at de.onvif.soap.SOAP.createSOAPRequest(SOAP.java:96)
    at de.onvif.soap.SOAP.createSOAPMediaRequest(SOAP.java:48)
    at de.onvif.soap.devices.MediaDevices.setVideoEncoderConfiguration(MediaDevices.java:180)
    at Main.main(Main.java:67)
Unhandled exception: InputStream does not represent a valid SOAP 1.2 Message



I seems that I'm receiving a SOAP 1.1 message but a SOAP 1.2 message is 
expected.

Using wireshark I have got the network traffic of failing SOAP command:

POST /onvif/services HTTP/1.1
Accept: application/soap+xml, text/html, image/gif, image/jpeg, *; q=.2, */*; 
q=.2
Content-Type: application/soap+xml; charset=utf-8
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.7.0_67
Host: 192.168.3.204
Connection: keep-alive
Content-Length: 2051

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <env:Header>
        <wsse:Security>
            <wsse:UsernameToken>
                <wsse:Username>onvif</wsse:Username>
                <wsse:Password
                    Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">WMA1PQro4b/ifF46z8cyT4Qcr1U=</wsse:Password>
                <wsse:Nonce
                    EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">MTgxMjEzMjA2NQ==</wsse:Nonce>
                <wsu:Created>2014-10-3T11:45:59Z</wsu:Created>
            </wsse:UsernameToken>
        </wsse:Security>
    </env:Header>
    <env:Body>
        <ns2:SetVideoEncoderConfiguration
            xmlns:ns10="http://www.onvif.org/ver10/schema" xmlns:ns2="http://www.onvif.org/ver10/media/wsdl"
            xmlns:ns3="http://www.w3.org/2005/08/addressing" xmlns:ns4="http://docs.oasis-open.org/wsn/b-2"
            xmlns:ns5="http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns6="http://docs.oasis-open.org/wsn/t-1"
            xmlns:ns7="http://www.w3.org/2004/08/xop/include" xmlns:ns9="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
            <ns2:Configuration token="0">
                <ns10:Name>user0</ns10:Name>
                <ns10:UseCount>0</ns10:UseCount>
                <ns10:Encoding>JPEG</ns10:Encoding>
                <ns10:Resolution>
                    <ns10:Width>1024</ns10:Width>
                    <ns10:Height>768</ns10:Height>
                </ns10:Resolution>
                <ns10:Quality>80.0</ns10:Quality>
                <ns10:RateControl>
                    <ns10:FrameRateLimit>25</ns10:FrameRateLimit>
                    <ns10:EncodingInterval>0</ns10:EncodingInterval>
                    <ns10:BitrateLimit>0</ns10:BitrateLimit>
                </ns10:RateControl>
                <ns10:Multicast>
                    <ns10:Address>
                        <ns10:Type>IPv4</ns10:Type>
                        <ns10:IPv4Address>0.0.0.0</ns10:IPv4Address>
                    </ns10:Address>
                    <ns10:Port>0</ns10:Port>
                    <ns10:TTL>5</ns10:TTL>
                    <ns10:AutoStart>false</ns10:AutoStart>
                </ns10:Multicast>
                <ns10:SessionTimeout>PT60S</ns10:SessionTimeout>
            </ns2:Configuration>
            <ns2:ForcePersistence>true</ns2:ForcePersistence>
        </ns2:SetVideoEncoderConfiguration>
    </env:Body>
</env:Envelope>


HTTP/1.1 200 OK
Server: gSOAP/2.7
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 2126
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://tempuri.org/xmime.xsd"
    xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2"
    xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tt="http://www.onvif.org/ver10/schema"
    xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:aa="http://www.axis.com/vapix/ws/action1"
    xmlns:aev="http://www.axis.com/vapix/ws/event1" xmlns:tan1="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding"
    xmlns:tan2="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding"
    xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
    xmlns:tev1="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding"
    xmlns:tev2="http://www.onvif.org/ver10/events/wsdl/EventBinding"
    xmlns:tev3="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding"
    xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
    xmlns:tev4="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding"
    xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl"
    xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl"
    xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics"
    xmlns:tnsaxis="http://www.axis.com/2009/event/topics">
    <SOAP-ENV:Header></SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <trt:SetVideoEncoderConfigurationResponse></trt:SetVideoEncoderConfigurationResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>



I realize that reponse to this method is SOAP 1.1(<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/") while request is 
SOAP 1.2 (<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope")

The method seems to work, but I got an error processing SOAP response.

Any ideas?

Thanks,

Paco






Original issue reported on code.google.com by [email protected] on 3 Oct 2014 at 11:51

Axis cameras' replay attack protection thwarts initialization

> What steps will reproduce the problem?
1. Instantiate an OnvifDevice against an Axis camera (M5014). Fails due to 
authorization failure calling getCapabilities() in init().

> What is the expected output? What do you see instead?
Expected initialization to succeed.

> What version of the product are you using? On what operating system?
Latest source from SVN running from Eclipse on Windows


> Please provide any additional information below.

The initialization fails because Axis cameras check the created date in the 
SOAP message, and compare it against its internal clock to prevent replay 
attacks. (This protection can be disabled in the camera's configuration, but i 
would like to make connectivity work with minimal effort from the user.) 
Initialization should include a call to GetSystemDateAndTime, and then use the 
difference between the local clock and the camera's clock in the creation of 
the Created time for authentication purposes.

Original issue reported on code.google.com by [email protected] on 5 Nov 2014 at 3:16

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.