Closed pankaj-sixwares closed 4 years ago
Hey thanks for your interest Pankaj,
What's the error? have you look at ONVIF documentation ? It's really useful, you might find the solution of your problem.
Also all cameras are differents, make sure it's up to date.
Hi Remy,
Thanks for your reply. I am getting bad request error here. I am able to get services, device information's and profiles. But not able to get streams. I will go through the documentation but i am new to this area and it will take time to understand it fully. I found your article very handy and easy to understand, so it would be great if you can help in this. Below is the response that i got in android console.
/BODY: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" ><soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"></wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">
</wsse:Nonce><wsu:Created>2018-10-08T09:14:000Z</wsu:Created></wsse:UsernameToken></wsse:Security></soap:Header><soap:Body><GetServices xmlns="http://www.onvif.org/ver10/device/wsdl"><IncludeCapability>false</IncludeCapability></GetServices></soap:Body></soap:Envelope>
D/RESPONSE: Response{protocol=http/1.1, code=200, message=OK, url=http://80.229.39.131:8899/onvif/device_service}
D/RESULT: true
D/ONVIF: service URIs retrieved
D/BODY: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" ><soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"></wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">
</wsse:Nonce><wsu:Created>2018-10-08T09:14:000Z</wsu:Created></wsse:UsernameToken></wsse:Security></soap:Header><soap:Body><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"></GetDeviceInformation></soap:Body></soap:Envelope>
D/RESPONSE: Response{protocol=http/1.1, code=200, message=OK, url=http://80.229.39.131:8899/onvif/device_service}
D/RESULT: true
D/ONVIF: Device information:
Manufacturer: H264
Model: HI3516D_83H40
FirmwareVersion: V4.02.R12.00014840.10010.132200..ONVIF 2.4
SerialNumber: 20ca02e32c1fe804
D/BODY: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" ><soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"></wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">
</wsse:Nonce><wsu:Created>2018-10-08T09:14:000Z</wsu:Created></wsse:UsernameToken></wsse:Security></soap:Header><soap:Body><GetProfiles xmlns="http://www.onvif.org/ver10/media/wsdl"/></soap:Body></soap:Envelope>
D/RESPONSE: Response{protocol=http/1.1, code=200, message=OK, url=http://80.229.39.131:8899/onvif/device_service}
D/RESULT: true
D/ONVIF: 3 profiles retrieved.
D/BODY: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" ><soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"></wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">
</wsse:Nonce><wsu:Created>2018-10-08T09:14:000Z</wsu:Created></wsse:UsernameToken></wsse:Security></soap:Header><soap:Body><GetStreamUri xmlns="http://www.onvif.org/ver20/media/wsdl"><ProfileToken>000</ProfileToken><Protocol>RTSP</Protocol></GetStreamUri></soap:Body></soap:Envelope>
D/RESPONSE: Response{protocol=http/1.1, code=400, message=Bad Request, url=http://80.229.39.131:8899/onvif/device_service}
D/RESULT: false
Thanks & Regards Pankaj
same error i also fetching sir,
Pleasea help to us asap
Pankaj you got success with it ?
@pankaj-sixwares @DharmeshDha have you tried with all the media profiles available?
Hi Remy,
i have tried with all media profiles and i am getting the same error.
Thanks & Regards Pankaj
Hi Remy,
same error I also fetching sir, and I have tried with all media profiles and I am getting the same error.
please help me
Are you sure your camera are up to date? It's hard for me to help you without access to the camera.
Closing this one, since I don't have any updates.
Hi Remy Why you close all issues without any answer or any try to resolve the problem? I faced this problem too. I received "Response: 400 - Bad Request" and I think it is due to the body of the request. I don't have enough knowledge in this area but you might know how to change the request body to get a valid response. could you please try it?
Hi, It looks like a problem with request body XML namespace. I tested a request with body generated by the code here's body example:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" >
<soap:Body>
<GetStreamUri xmlns="http://www.onvif.org/ver20/media/wsdl">
<ProfileToken>Profile_0</ProfileToken>
<Protocol>RTSP</Protocol>
</GetStreamUri>
</soap:Body>
</soap:Envelope>
In my case it always return 400 - Bad Request Method 'GetStreamUri' not implemented: method name or namespace not recognized
. But when I changed GetStreamUri
XML namespace to xmlns="http://www.onvif.org/ver10/media/wsdl"
everything looks fine.
Hi, It looks like a problem with request body XML namespace. I tested a request with body generated by the code here's body example:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" > <soap:Body> <GetStreamUri xmlns="http://www.onvif.org/ver20/media/wsdl"> <ProfileToken>Profile_0</ProfileToken> <Protocol>RTSP</Protocol> </GetStreamUri> </soap:Body> </soap:Envelope>
In my case it always return 400 - Bad Request
Method 'GetStreamUri' not implemented: method name or namespace not recognized
. But when I changedGetStreamUri
XML namespace toxmlns="http://www.onvif.org/ver10/media/wsdl"
everything looks fine.
thanks, i fixed it by doing what you said.
How to get GetStreamUri form xmlns="http://www.onvif.org/ver20/media/wsdl".The only way to get stream url from "http://www.onvif.org/ver10/media/wsdl"?
Hello,
Thanks for sharing an interesting article on Implementing OnVifCamera. We are using the code and facing a problem while accessing getstreamuri. We are able to get device information, media profiles but it is giving bad request error on getstreamuri.
Please help.
Thanks & Regards Pankaj