我使用soap webservice发送短信 这是功能:
public static string SendSms(string Message, string Phone, string BranchName)
{
string result;
try
{
var sms = new WebServiceSMS.SendMessageSoapClient();
sms.SendSms(WebConfigurationManager.AppSettings["UserName"], WebConfigurationManager.AppSettings["Pwd"], Message, Phone, BranchName, "0");
result = "Successful";
return result;
}
catch
{
result = "failed";
return result;
}
}
XML响应看起来像这样:
如何在Web服务方法调用完成后从XML读取?
答案 0 :(得分:1)
看起来您正在寻找从sms.SendSMS()返回XML响应:
public static string SendSms(string Message, string Phone, string BranchName)
{
try
{
var sms = new WebServiceSMS.SendMessageSoapClient();
return sms.SendSms(WebConfigurationManager.AppSettings["UserName"], WebConfigurationManager.AppSettings["Pwd"], Message, Phone, BranchName, "0");
}
catch
{
return "Failed";
}
}