我需要在VS 2013中创建一个win表单应用程序,它将把wsdl文件作为webReference。它将调用一个wsdl:operation“Init”,它将以下xml发送到Web服务:
Wsdl包含操作:
<wsdl:operation name="Init">
<wsdl:input message="wl:InitRequest"/>
<wsdl:output message="wl:InitResponse"/>
</wsdl:operation>
Init SOAP xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.asdfgh.org/lala/log">
<soapenv:Header/>
<soapenv:Body>
<web:Init>
<web:Phase>`TST`</web:Phase>
</web:Init>
</soapenv:Body>
</soapenv:Envelope>
它会发回一个回复InitResponse:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.asdfgh.org/lala/log">
<soapenv:Header/>
<soapenv:Body>
<wl:InitResponse xmlns:wl="http://www.asdfgh.org/lala/log">
<Data>
<NUMBER>1234</NUMBER>
<TEXT1>ABCDEF</TEXT1>
<TEXT2>QWERTY</TEXT2>
</Data>
</wl:InitResponse>
</soapenv:Body>
</soapenv:Envelope>
如何阅读回复并在MessageBox.Show();
中显示输出以下是由Init。上的wsdl组成的类。
public partial class Init {
private string phaseField;
/// <remarks/>
public string Phase {
get {
return this.phaseField;
}
set {
this.phaseField = value;
}
}
}
下面是由initResponse上的wsdl组成的类(有趣的是,它没有创建任何名为InitResponse的类。它创建了InitResponseData - 我想知道为什么)
public partial class InitDSDResponseData {
private string NUMBERField;
private string TEXT1Field;
private string TEXT2Field;
/// <remarks/>
public string NUMBER {
get {
return this.NUMBERField;
}
set {
this.NUMBERField = value;
}
}
/// <remarks/>
public string TEXT1 {
get {
return this.TEXT1Field;
}
set {
this.TEXT1Field = value;
}
}
/// <remarks/>
public string TEXT2 {
get {
return this.TEXT2Field;
}
set {
this.TEXT2Field = value;
}
}
}
在按钮单击事件上,我想将消息框中的响应xml显示为字符串。我该怎么办?如何通过c#?
调用Init操作