Atitit Java onvif Open source class library Getprofiles Getstreamuri

Source: Internet
Author: User
Tags base64 soap wsdl

Atitit Java onvif Open source class library Getprofiles Getstreamuri

1. ONVIF Java Library by Milgo1

1.1. Https://github.com/milg0/onvif-java-lib4

1.2. Getprofiles Respones File4

1.3. Getstreamuri:rtsp://192.168.31.144:10554/tcp/av0_04

1.4. Code---5

1. ONVIF Java Library by Milgo

Non-Profit, Analytics, security

The ONVIF Java Library by Milgo the "the" the "the" the "the" the "the" the "the" the "the" interact with the API features related Unication between ip-based security products. ONVIF stands for the Open Network Video Interface forum. ONVIF API is targeted to installers, system integrators, architects, engineers, and end users.

Nvifdevice NVT = new Onvifdevice ("192.168.0.20", "admin", "password");

Nvt.getdevices (); Basic methods for configuration and information

Nvt.getmedia (); Methods to get media information like stream or screenshot URIs or to change your video encoder configuration

Nvt.getimaging (); A few functions to change your image settings, really just for your image settings!

NVT.GETPTZ (); Functionality to move your camera (if supported!)

Our A snapshot URI of We-camera (not every must support, but most-NVT do). So we'll work on with our media methods and there are some methods to achieve our goal. Don ' t get irritated by the fact so there are methods to get Snapshot-and Screenshot-uris, they return the same and have Just different names.

Getdefaultsnapshoturi (): String

Getsnapshoturi (profiletoken:string): String

You can get your device profiles with the initial devices.

Onvifdevice NVT = new Onvifdevice ("192.168.0.20", "admin", "password");

list<profile> profiles = Nvt.getdevices (). Getprofiles ();

Snapshot URI.

Import java.net.ConnectException;

Import java.util.List;

Import javax.xml.soap.SOAPException;

Import Org.onvif.ver10.schema.Profile;

Import De.onvif.soap.OnvifDevice;

public class Onviftest {

public static void Main (string[] args) {

try {

Onvifdevice NVT = new Onvifdevice ("192.168.0.20", "admin", "password");

list<profile> profiles = Nvt.getdevices (). Getprofiles ();

String Profiletoken = profiles.get (0). GetToken ();

System.out.println ("Snapshot URI:" +nvt.getmedia (). Getsnapshoturi (Profiletoken));

}

catch (Connectexception e) {

System.err.println ("Could not connect to NVT.");

}

catch (SoapException e) {

E.printstacktrace ();

}

}

} 1.1. https://github.com/milg0/onvif-java-lib 1.2. getprofiles respones file

1.3. getstreamuri:rtsp://192.168.31.144:10554/tcp/av0_0

Request SOAP Message (Getstreamuri): <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/><wsse:password Type= "http://docs.oasis-open.org/ Wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passworddigest ">k3vtv2zkadcl0dfdqz/cjbspcu8=</ Wsse:password><wsse:nonce encodingtype= "http://docs.oasis-open.org/wss/2004/01/ Oasis-200401-wss-soap-message-security-1.0#base64binary ">mtq4mzgwmzuymw==</wsse:nonce><wsu:created >2016-12-21t15:04:00z</wsu:created></wsse:usernametoken></wsse:security></env:header ><env:body><ns2:getstreamuri xmlns:ns10= "http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns11= "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/wsrf/rp-2 "xmlns:ns7=" http://docs.oasis-open.org/wsn/t-1 "xmlns:ns8=" http://www.w3.org/2004/ 08/xop/include "Xmlns:xmime=" Http://www.w3.org/2005/05/xmlmime "><ns2:streamsetup/><ns2:profiletoken >PROFILE_000</ns2:ProfileToken></ns2:GetStreamUri></env:Body></env:Envelope>

Response SOAP Message (getstreamuriresponse): <?xml version= "1.0" encoding= "UTF-8"? ><s:envelope xmlns:s= " Http://www.w3.org/2003/05/soap-envelope "xmlns:e=" http://www.w3.org/2003/05/soap-encoding "xmlns:xsi=" http:// Www.w3.org/2001/XMLSchema-instance "xmlns:wsa=" http://www.w3.org/2005/08/addressing "xmlns:xmime=" http:// Www.w3.org/2005/05/xmlmime "xmlns:tns1=" Http://www.onvif.org/ver10/topics "xmlns:xs=" http://www.w3.org/2001/ XmlSchema "xmlns:xop=" Http://www.w3.org/2004/08/xop/include "xmlns:tt=" Http://www.onvif.org/ver10/schema "xmlns: Wsnt= "Http://docs.oasis-open.org/wsn/b-2" xmlns:wstop= "http://docs.oasis-open.org/wsn/t-1" xmlns:tds= "http://" WWW.ONVIF.ORG/VER10/DEVICE/WSDL "xmlns:trt=" http://www.onvif.org/ver10/media/wsdl "xmlns:tev=" http:// WWW.ONVIF.ORG/VER10/EVENTS/WSDL "xmlns:tptz=" http://www.onvif.org/ver20/ptz/wsdl "xmlns:timg=" http:// WWW.ONVIF.ORG/VER20/IMAGING/WSDL "xmlns:ter=" Http://www.onvif.org/ver10/error "&GT;&LT;S:BODY&GT;&LT;TRT: Getstreamuriresponse><trt:mediAuri><tt:uri>rtsp://192.168.31.144:10554/tcp/av0_0</tt:uri><tt:invalidafterconnect>false </tt:invalidafterconnect><tt:invalidafterreboot>false</tt:invalidafterreboot><tt:timeout &GT;PT60S&LT;/TT:TIMEOUT&GT;&LT;/TRT:MEDIAURI&GT;&LT;/TRT:GETSTREAMURIRESPONSE&GT;&LT;/S:BODY&GT;&LT;/S: Envelope>

Getstreamuri:rtsp://192.168.31.144:10554/tcp/av0_0

1.4. Code---

package Com.attilax.video;

/**

* @author Attilax

* December 21, 2016 10:38:11

*/

import java.io.IOException;

import java.net.ConnectException;

import java.util.List;

import javax.xml.soap.SOAPException;

import Org.onvif.ver10.media.wsdl.GetStreamUri;

import org.onvif.ver10.media.wsdl.GetStreamUriResponse;

import org.onvif.ver10.schema.Profile;

import Org.onvif.ver10.schema.StreamSetup;

import Org.onvif.ver10.schema.Transport;

import De.onvif.soap.OnvifDevice;

Public class onviftest {

Public Static void Main (String[] args) {

Org.apache.commons.codec.binary.Base64

Org.apache.commons.codec.binary.Base64

Try {

Onvifdevice NVT = new Onvifdevice ("192.168.0.20", "admin",

"Password");

Onvifdevice NVT = new onvifdevice ("192.168.31.144:10080", "", "");

list<profile> Profiles = Nvt.getdevices (). Getprofiles ();

for ( Profile profile: Profiles) {

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.