How can I read SOAP message response? [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
开发者_JAVA技巧 Improve this questionIn the past I've always used class proxy to communicate with WebService.
Now I want to use SOAP message. I developed a .ddl that do this, and all goes fine.
My question is: Is there any standard (method-code-framework class) that can read and parse the SOAP message response?
Here is an example. I send SOAP message to delete all records.
I get the following response:<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:removeAllVODResponse xmlns:ns="http://ws.cms.guardian">
<ns:return xsi:type="ax21:Result" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ax21="http://dto.ws.cms.guardian/xsd">
<ax21:message>REMOVED ALL</ax21:message>
<ax21:type>SUCCESS</ax21:type>
</ns:return>
</ns:removeAllVODResponse>
</soapenv:Body>
</soapenv:Envelope>
How can parse the 2 element message/type to this class:
public partial class Result {
private string messageField;
private string typeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string message {
get {
return this.messageField;
}
set {
this.messageField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string type {
get {
return this.typeField;
}
set {
this.typeField = value;
}
}
}
精彩评论