headers = new SoapHeaderCollection ();\r
}\r
\r
- internal SoapMessage (Stream stream, SoapHeaderCollection headers)\r
+ internal SoapMessage (Stream stream)\r
{\r
- this.headers = headers;\r
this.stream = stream;\r
}\r
\r
\r
public object GetReturnValue ()\r
{\r
- if (MethodInfo.IsVoid) return null;\r
- else return outParameters [0];\r
+ if (!MethodInfo.IsVoid && exception == null) return outParameters [0];\r
+ else return null;\r
+ }\r
+\r
+ internal void SetHeaders (SoapHeaderCollection headers)\r
+ {\r
+ this.headers = headers;\r
+ }\r
+\r
+ internal void SetException (SoapException ex)\r
+ {\r
+ exception = ex;\r
+ }\r
+\r
+ internal void CollectHeaders (object target, HeaderInfo[] headers, SoapHeaderDirection direction)\r
+ {\r
+ Headers.Clear ();\r
+ foreach (HeaderInfo hi in headers) \r
+ {\r
+ if ((hi.Direction & direction) != 0) \r
+ {\r
+ SoapHeader headerVal = hi.GetHeaderValue (target) as SoapHeader;\r
+ if (headerVal != null)\r
+ Headers.Add (headerVal);\r
+ }\r
+ }\r
+ }\r
+\r
+ internal void UpdateHeaderValues (object target, HeaderInfo[] headersInfo)\r
+ {\r
+ foreach (SoapHeader header in Headers)\r
+ {\r
+ HeaderInfo hinfo = FindHeader (headersInfo, header.GetType ());\r
+ if (hinfo != null)\r
+ hinfo.SetHeaderValue (target, header);\r
+ else\r
+ if (header.MustUnderstand)\r
+ throw new SoapHeaderException ("Unknown header", SoapException.MustUnderstandFaultCode);\r
+ header.DidUnderstand = false;\r
+ }\r
+ }\r
+\r
+ HeaderInfo FindHeader (HeaderInfo[] headersInfo, Type headerType)\r
+ {\r
+ foreach (HeaderInfo headerInfo in headersInfo)
+ if (headerInfo.HeaderType == headerType) return headerInfo;
+ return null;
}\r
\r
#endregion // Methods\r
}\r
-}\r
+}