lagurus / onvif-java-lib Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/onvif-java-lib
Automatically exported from code.google.com/p/onvif-java-lib
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
Would be nice if device discovery could be added.
Original issue reported on code.google.com by [email protected]
on 5 Nov 2014 at 4:19
> 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
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.