我很难通过添加服务参考添加服务来工作。我可以毫无问题地调用该服务,并得到回复(我可以在 Fiddler 中看到它):
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<executeResponse>
<request_number>REQ0048172</request_number>
</executeResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
但是,我executeResponse
在那里得到一个空值。Reference.cs 中的相关部分如下。
界面:
[System.ServiceModel.ServiceContractAttribute(Namespace="http://www.serviceprovider.com/service")]
public interface Soap {
// CODEGEN: Generating message contract since the operation execute is neither RPC nor document wrapped.
[System.ServiceModel.OperationContractAttribute(Action="http://www.serviceprovider.com/service/execute", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
executeResponse1 execute(executeRequest request);
}
客户:
public partial class SoapClient : System.ServiceModel.ClientBase<Soap>, Soap {
executeResponse1 Soap.execute(executeRequest request) {
return base.Channel.execute(request);
}
public executeResponse execute(execute execute1) {
executeRequest inValue = new executeRequest();
inValue.execute = execute1;
executeResponse1 retVal = ((Soap)(this)).execute(inValue);
return retVal.executeResponse;
}
}
执行响应1:
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class executeResponse1 {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://www.serviceprovider.com/service", Order=0)]
public executeResponse executeResponse;
}
执行响应:
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.serviceprovider.com/service")]
public partial class executeResponse : object, System.ComponentModel.INotifyPropertyChanged {
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
public string request_number { get; set; }
}
我不确定如何从 SOAP 响应返回到解决此问题。任何建议,将不胜感激。