You simply define the structure of the detail section using XML Schema.
Then, refer to it in the <wsdl:message> element that defines the fault
message. Refer to the fault message in the <wsdl:fault> section using the
type attribute.
Then, all you have to do is construct an instance of your fault detail and
provide it to the SoapException constructor.
I don't have time to find or create an example today, but let me know if
you're still stuck after this and I'll try to make time.
I have created structure for the detail section
<s:complexType name="detail">
<s:sequence>
<s:element name="ErrorCode" type="s:int"/>
<s:element name="Message" type="s:string"/>
</s:sequence>
</s:complexType>
then added a message
<wsdl:message name="FaultError" type="tns:detail"/>
then added fault to the operation
<wsdl:fault name="FaultName" message="tns:FaultError"/>
and then after adding <soap12:fault name="FaultName" use="literal"/>
in the soap 12 section, the editor stopped to complain.
On the server side, I follow the sample to raise the exception with
something like
XmlDocument doc = new XmlDocument();
XmlNode detail = doc.CreateNode(XmlNodeType.Element,
SoapException.DetailElementName.Name,
SoapException.DetailElementName.Namespace);
XmlNode errorType = doc.CreateNode(XmlNodeType.Element,
"ErrorCode", myNS);
errorType.InnerText = "-1";
XmlNode lineNum = doc.CreateNode(XmlNodeType.Element,
"Message", myNS);
lineNum.InnerText = "Error";
detail.AppendChild(errorType);
detail.AppendChild(lineNum);
string errorMsg = "An error was received while processing the
message (see Detail element for more information)";
SoapException exc = new SoapException(errorMsg,
SoapException.ClientFaultCode, "", detail);
throw exc;
Anything I should pay attention on the "Fault Name" in the <wsdl:fault
name="FaultName" message="tns:FaultError"/>?
What is the correspondence between soap exception details and this
FaultName?
Thanks in advance.