title: ONVIF GetStreamURL C#
body: <p>I'm trying to get stream URL using ONVIF, and I'm stucked. Method GetStreamURL always returns Null, but when I'm sniffing traffic in wireshark I get correct responses from camera. Maybe someone had similar problem and can help me? My code looks like this:</p>
  
  <pre><code>HttpTransportBindingElement httpBinding = new HttpTransportBindingElement();
  EndpointAddress serviceAddress = new EndpointAddress(__url);
  TextMessageEncodingBindingElement messegeElement = new TextMessageEncodingBindingElement();
  
  httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest;
  messegeElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.WSAddressing10);
  
  CustomBinding bind = new CustomBinding(messegeElement, httpBinding);
  ONVIF.onvifMedia.mediaClient mclient = new ONVIF.onvifMedia.mediaClient(bind, serviceAddress);
  
  ONVIF.onvifMedia.StreamSetup streamSetup = new ONVIF.onvifMedia.StreamSetup();
  streamSetup.Stream = ONVIF.onvifMedia.StreamType.RTPUnicast;
  
  streamSetup.Transport = new ONVIF.onvifMedia.Transport();
  streamSetup.Transport.Protocol = ONVIF.onvifMedia.TransportProtocol.RTSP;
  
  mediaUri uri = new mediaUri();
  Profile[] profiles;
  
  log.Debug("Trying to fetch profiles");
  profiles = mclient.GetProfiles();
  
  foreach (Profile item in profiles)
  {
     uri = mclient.GetStreamUri(streamSetup, item.token);
  }
  </code></pre>