/// <summary> /// Capture requirements related with SOAP header in Probe message. /// </summary> /// <param name="header">SOAP header.</param> private void CaptureHeaderRequirements(WsdHeader header) { // Since the message parsed by stack layer properly, capture the requirement directly. Site.CaptureRequirement( 171, @"[The schema definition of Header of Probe message is:]<s:Header ... > <a:Action ... > http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe </a:Action> <a:MessageID ... >xs:anyURI</a:MessageID> [<a:ReplyTo ... >endpoint-reference</a:ReplyTo>]? <a:To ... >xs:anyURI</a:To> ... </s:Header>"); if (null != header.ReplyTo) { // Since the message parsed by stack layer properly, capture the requirement directly. Site.CaptureRequirement( 172, "If [ReplyTo is] included in the header, it [ReplyTo] MUST be of type a:EndpointReferenceType [WS-Addressing]."); } // Add debug info. Site.Log.Add(TestTools.LogEntryKind.Debug, "To: {0}", header.To.Value); bool isR173Verified = string.Equals( header.To.Value, "urn:schemas-xmlsoap-org:ws:2005:04:discovery", System.StringComparison.OrdinalIgnoreCase); Site.CaptureRequirementIfIsTrue( isR173Verified, 173, "/s:Envelope/s:Header/a:To MUST be \"urn:schemas-xmlsoap-org:ws:2005:04:discovery\" [RFC 2141]."); }
/// <summary> /// Capture requirements related with SOAP header in ProbeMatch message. /// </summary> /// <param name="header">SOAP header.</param> private void CaptureHeaderRequirements(WsdHeader header) { // Since the message parsed by stack layer properly, capture the requirement directly. Site.CaptureRequirement( 171, @"[The schema definition of Header of Probe message is:]<s:Header ... > <a:Action ... > http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe </a:Action> <a:MessageID ... >xs:anyURI</a:MessageID> [<a:ReplyTo ... >endpoint-reference</a:ReplyTo>]? <a:To ... >xs:anyURI</a:To> ... </s:Header>"); }
/// <summary> /// Create a probe match message /// </summary> /// <param name="relatesTo">The URI of relates to</param> /// <param name="instanceId">Instance ID</param> /// <param name="messageNumber">Message number</param> /// <param name="matches">Probe match messages</param> /// <returns>The response message</returns> public SoapEnvelope CreateProbeMatchMessage(string relatesTo, string instanceId, uint messageNumber, ProbeMatchType[] matches) { WsdHeader header = new WsdHeader(); header.Action.Value = ProtocolStrings.ProbeMatchesAction; header.RelatesTo = new AttributedURI(); header.RelatesTo.Value = relatesTo; header.AppSequence = new AppSequenceType(); header.AppSequence.MessageNumber = 1; header.AppSequence.InstanceId = (uint)(this.serviceStartTime - this.baseTime).Seconds; header.To = new AttributedURI(); header.To.Value = "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"; ProbeMatchOp match = new ProbeMatchOp(); match.ProbeMatches = new ProbeMatchesType(); match.ProbeMatches.ProbeMatch = matches; SoapEnvelope resp = new SoapEnvelope(SoapMessageVersion.Soap11Wsa10, header, match); return resp; }