Добрый день. Подскажите как мне сформировать, используя WCF, заголовок в Soap-сообщении, которое отправляет мой агент. Мне надо, чтобы отправлялось?
| Код | <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/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:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsrf/r-2" xmlns:xm="http://www.w3.org/2005/05/xmlmime" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsbf2="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wst1="http://docs.oasis-open.org/wsn/t-1" xmlns:ns10="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:ns3="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:ns4="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:ns5="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:ns6="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:ns7="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:ns8="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:ns9="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver10/imaging/wsdl" xmlns:tptz="http://www.onvif.org/ver10/ptz/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl"> <SOAP-ENV:Header> <wsse:Security SOAP-ENV:mustUnderstand="true"> <wsse:UsernameToken> <wsse:Username>root</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">nVvsOMt4eeGQGqEQOZEeI64QcFc=</wsse:Password> <wsse:Nonce>VIj5ThAtXHfWNC6h73y3n3PouZg=</wsse:Nonce> <wsu:Created>2011-12-27T08:56:52Z</wsu:Created> </wsse:UsernameToken> </wsse:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> <trt:GetProfiles> </trt:GetProfiles> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
|
Надо, чтобы в хидере соапа была строчка с wsse. Сейчас у меня вот, что генерируется:
| Код | <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header> <a:Action s:mustUnderstand="1">http://www.onvif.org/ver10/device/wsdl/GetCapabilities</a:Action> <a:MessageID>urn:uuid:9b2fe46d-2dfc-4e6c-a863-01e72c477bf7</a:MessageID> <a:ReplyTo> <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address> </a:ReplyTo> <VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPoypI5trSDuRPnTDlOv7qzwAAAAAACsWNFOC09UKrvWueLtfmolpkuh16AfRKvfqTXBNXJhQACQAA</VsDebuggerCausalityData> <a:To s:mustUnderstand="1">http://192.168.137.164/onvif/device_service</a:To> </s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl"> <Category>All</Category> </GetCapabilities> </s:Body> </s:Envelope>
|
А вот код моего агента:
| Код | HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement(); httpTransportBindingElement.AuthenticationScheme = AuthenticationSchemes.Digest; httpTransportBindingElement.KeepAliveEnabled = false; CustomBinding binding = new CustomBinding(httpTransportBindingElement); EndpointAddress DeviceEndPointAddress = new EndpointAddress("http://192.168.137.164:80/onvif/device_service"); DeviceClient deviceClient = new DeviceClient(binding, DeviceEndPointAddress);
deviceClient.ClientCredentials.HttpDigest.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; deviceClient.ClientCredentials.HttpDigest.ClientCredential = new NetworkCredential("root", "root"); deviceClient.ClientCredentials.UserName.UserName = "root"; deviceClient.ClientCredentials.UserName.Password = "root"; Onvif.DeviceManagment.Capabilities capabilities = deviceClient.GetCapabilities(new CapabilityCategory[] { CapabilityCategory.All }); // вызываю удаленную функцию
|
|