Добрый день! Подскажите как мне поменять SOAP-сообщение, отправляемое моим агентом? Конкретно надо убрать заголовок <soap:header></soap:header>
Сейчас у меня отправляется вот такое вот сообщение:
Код | 01.POST /onvif/services HTTP/1.1.. 02.Content-Type: application/soap+xml; charset=utf-8.. 03.Host: 77.73.27.108.. 04.Content-Length: 900.. 05.Accept-Encoding: gzip, deflate.. 06.Connection: Close.. 07... 08.<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> 09. <s:Header> 10. <a:Action s:mustUnderstand="1">http://www.onvif.org/ver10/device/wsdl/GetCapabilities<;/a:Action> 11. <a:MessageID>urn:uuid:d76fb8f6-7b4c-414f-a325-69a89ea4de28</a:MessageID> 12. <a:ReplyTo> 13. <a:Address>http://www.w3.org/2005/08/addressing/anonymous<;/a:Address> 14. </a:ReplyTo> 15. <VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo4knbG/2xfZOki420L0py14AAAAAg3znTqrIs0Woye9YEg4/TbS21OlYfYNPjFBVlKJ4D7MACQAA</VsDebuggerCausalityData> 16. <a:To s:mustUnderstand="1">http://77.73.27.108/onvif/services<;/a:To> 17. </s:Header> 18. <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 19. <GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl"> 20. <Category>Media</Category> 21. </GetCapabilities> 22. </s:Body> 23.</s:Envelope>
|
А надо, чтобы отправлялось вот какое:
Код | 01.POST /onvif/services HTTP/1.1.. 02.Content-Type: application/soap+xml; charset=utf-8.. 03.Host: 77.73.27.108.. 04.Content-Length: 900.. 05.Accept-Encoding: gzip, deflate.. 06.Connection: Close.. 07... 08.<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> 09. <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 10. <GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl"> 11. <Category>Media</Category> 12. </GetCapabilities> 13. </s:Body> 14.</s:Envelope>
|
Вот мой код агента:
Код | 01.static void Main(string[] args) 02. { 03. ServicePointManager.Expect100Continue = false; 04. 05. HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement(); 06. httpTransportBindingElement.AuthenticationScheme = AuthenticationSchemes.Basic; 07. httpTransportBindingElement.KeepAliveEnabled = false; 08. 09. SecurityBindingElement securityBindingElement = new SecurityBindingElement(); 10. 11. CustomBinding binding = new CustomBinding(); 12. binding.Elements.Add(httpTransportBindingElement); 13. 14. EndpointAddress DeviceEndPointAddress = new EndpointAddress("http://77.73.27.108:80/onvif/device_service"); 15. 16. string Username = "guest"; 17. string Password = "guest"; 18. 19. DeviceClient deviceClient = new DeviceClient(binding, DeviceEndPointAddress); 20. deviceClient.ClientCredentials.UserName.UserName = Username; 21.deviceClient.ClientCredentials.UserName.Password = Password; 22. 23. try 24. { 25. Console.WriteLine("Starting..."); 26. 27. Capabilities capabilities = deviceClient.GetCapabilities(new CapabilityCategory[] { CapabilityCategory.Media }); // Вызывается удаленный метод
|
|