当前位置:编程学习 > C#/ASP.NET >>

高手请出,请教联通webservice短信接口调用问题!!!

--------------------编程问答-------------------- 上一贴,字数限制,附上Webservice消息发送接口报文样例:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Header>
        <m:SpInfo m:SpID="smwsp1" xmlns:m="http://smsmonitor.asiainfo.com" m:SpPassword="smwsp1"
        />
        <m:TransactionInfo xmlns:m="http://smsmonitor.asiainfo.com" m:LinkID="25712944"
        />
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <m:send xmlns:m="http://smsmonitor.asiainfo.com">
            <m:taskID>
                TaskID-003761653
            </m:taskID>
            <m:mobileNumber>
                8613301261178
            </m:mobileNumber>
            <m:channelID>
                106557503
            </m:channelID>
            <m:messageClass>
                1
            </m:messageClass>
            <m:title>
            </m:title>
            <m:content>
                This is test message
            </m:content>
            <m:method>
                1
            </m:method>
            <m:scheduledTime>
            </m:scheduledTime>
            <m:repeatTime>
            </m:repeatTime>
            <m:repeatInterval>
            </m:repeatInterval>
            <m:repeatUnit>
            </m:repeatUnit>
            <m:permitedPeriod>
                00:00-23:59
            </m:permitedPeriod>
            <m:priority>
                3
            </m:priority>
        </m:send>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--------------------编程问答-------------------- 下面是我用wsdl.exe生成的CS代码

1、ServerInterface.wsdl -〉smsServerProxyClass.cs
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18051
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

// 
// This source code was auto-generated by wsdl, Version=4.0.30319.17929.
// 


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="SMServiceHttpBinding", Namespace="http://smsmonitor.asiainfo.com")]
public partial class SMService : System.Web.Services.Protocols.SoapHttpClientProtocol {
    
    private System.Threading.SendOrPostCallback sendOperationCompleted;
    
    /// <remarks/>
    public SMService() {
        this.Url = "SERVICE_URL";
    }
    
    /// <remarks/>
    public event sendCompletedEventHandler sendCompleted;
    
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://smsmonitor.asiainfo.com", ResponseNamespace="http://smsmonitor.asiainfo.com", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("out", IsNullable=true)]
    public string send(
                [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string taskID, 
                [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string mobileNumber, 
                [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string channelID, 
                int messageClass, 
                [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string title, 
                [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string content, 
                int method, 
                [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string scheduledTime, 
                int repeatTime, 
                [System.Xml.Serialization.XmlIgnoreAttribute()] bool repeatTimeSpecified, 
                int repeatInterval, 
                [System.Xml.Serialization.XmlIgnoreAttribute()] bool repeatIntervalSpecified, 
                int repeatUnit, 
                [System.Xml.Serialization.XmlIgnoreAttribute()] bool repeatUnitSpecified, 
                [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string permitedPeriod, 
                int priority) {
        object[] results = this.Invoke("send", new object[] {
                    taskID,
                    mobileNumber,
                    channelID,
                    messageClass,
                    title,
                    content,
                    method,
                    scheduledTime,
                    repeatTime,
                    repeatTimeSpecified,
                    repeatInterval,
                    repeatIntervalSpecified,
                    repeatUnit,
                    repeatUnitSpecified,
                    permitedPeriod,
                    priority});
        return ((string)(results[0]));
    }
    
    /// <remarks/>
    public System.IAsyncResult Beginsend(
                string taskID, 
                string mobileNumber, 
                string channelID, 
                int messageClass, 
                string title, 
                string content, 
                int method, 
                string scheduledTime, 
                int repeatTime, 
                bool repeatTimeSpecified, 
                int repeatInterval, 
                bool repeatIntervalSpecified, 
                int repeatUnit, 
                bool repeatUnitSpecified, 
                string permitedPeriod, 
                int priority, 
                System.AsyncCallback callback, 
                object asyncState) {
        return this.BeginInvoke("send", new object[] {
                    taskID,
                    mobileNumber,
                    channelID,
                    messageClass,
                    title,
                    content,
                    method,
                    scheduledTime,
                    repeatTime,
                    repeatTimeSpecified,
                    repeatInterval,
                    repeatIntervalSpecified,
                    repeatUnit,
                    repeatUnitSpecified,
                    permitedPeriod,
                    priority}, callback, asyncState);
    }
    
    /// <remarks/>
    public string Endsend(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((string)(results[0]));
    }
    
    /// <remarks/>
    public void sendAsync(
                string taskID, 
                string mobileNumber, 
                string channelID, 
                int messageClass, 
                string title, 
                string content, 
                int method, 
                string scheduledTime, 
                int repeatTime, 
                bool repeatTimeSpecified, 
                int repeatInterval, 
                bool repeatIntervalSpecified, 
                int repeatUnit, 
                bool repeatUnitSpecified, 
                string permitedPeriod, 
                int priority) {
        this.sendAsync(taskID, mobileNumber, channelID, messageClass, title, content, method, scheduledTime, repeatTime, repeatTimeSpecified, repeatInterval, repeatIntervalSpecified, repeatUnit, repeatUnitSpecified, permitedPeriod, priority, null);
    }
    
    /// <remarks/>
    public void sendAsync(
                string taskID, 
                string mobileNumber, 
                string channelID, 
                int messageClass, 
                string title, 
                string content, 
                int method, 
                string scheduledTime, 
                int repeatTime, 
                bool repeatTimeSpecified, 
                int repeatInterval, 
                bool repeatIntervalSpecified, 
                int repeatUnit, 
                bool repeatUnitSpecified, 
                string permitedPeriod, 
                int priority, 
                object userState) {
        if ((this.sendOperationCompleted == null)) {
            this.sendOperationCompleted = new System.Threading.SendOrPostCallback(this.OnsendOperationCompleted);
        }
        this.InvokeAsync("send", new object[] {
                    taskID,
                    mobileNumber,
                    channelID,
                    messageClass,
                    title,
                    content,
                    method,
                    scheduledTime,
                    repeatTime,
                    repeatTimeSpecified,
                    repeatInterval,
                    repeatIntervalSpecified,
                    repeatUnit,
                    repeatUnitSpecified,
                    permitedPeriod,
                    priority}, this.sendOperationCompleted, userState);
    }
    
    private void OnsendOperationCompleted(object arg) {
        if ((this.sendCompleted != null)) {
            System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
            this.sendCompleted(this, new sendCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
        }
    }
    
    /// <remarks/>
    public new void CancelAsync(object userState) {
        base.CancelAsync(userState);
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
public delegate void sendCompletedEventHandler(object sender, sendCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class sendCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    
    private object[] results;
    
    internal sendCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
            base(exception, cancelled, userState) {
        this.results = results;
    }
    
    /// <remarks/>
    public string Result {
        get {
            this.RaiseExceptionIfNecessary();
            return ((string)(this.results[0]));
        }
    }
}

--------------------编程问答--------------------

2、ClientInterface.wsdl -〉smsClientProxyClass.cs
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18051
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

// 
// This source code was auto-generated by wsdl, Version=4.0.30319.17929.
// 


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="SpSMServiceHttpBinding", Namespace="http://smsmonitor.asiainfo.com")]
public partial class SpSMService : System.Web.Services.Protocols.SoapHttpClientProtocol {
    
    private System.Threading.SendOrPostCallback reportOperationCompleted;
    
    private System.Threading.SendOrPostCallback notificationOperationCompleted;
    
    /// <remarks/>
    public SpSMService() {
        this.Url = "SERVICE_URL";
    }
    
    /// <remarks/>
    public event reportCompletedEventHandler reportCompleted;
    
    /// <remarks/>
    public event notificationCompletedEventHandler notificationCompleted;
    
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://smsmonitor.asiainfo.com", ResponseNamespace="http://smsmonitor.asiainfo.com", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public void report([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string messageID, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string mobileNumber, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string statusCode, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string timeStamp) {
        this.Invoke("report", new object[] {
                    messageID,
                    mobileNumber,
                    statusCode,
                    timeStamp});
    }
    
    /// <remarks/>
    public System.IAsyncResult Beginreport(string messageID, string mobileNumber, string statusCode, string timeStamp, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("report", new object[] {
                    messageID,
                    mobileNumber,
                    statusCode,
                    timeStamp}, callback, asyncState);
    }
    
    /// <remarks/>
    public void Endreport(System.IAsyncResult asyncResult) {
        this.EndInvoke(asyncResult);
    }
    
    /// <remarks/>
    public void reportAsync(string messageID, string mobileNumber, string statusCode, string timeStamp) {
        this.reportAsync(messageID, mobileNumber, statusCode, timeStamp, null);
    }
    
    /// <remarks/>
    public void reportAsync(string messageID, string mobileNumber, string statusCode, string timeStamp, object userState) {
        if ((this.reportOperationCompleted == null)) {
            this.reportOperationCompleted = new System.Threading.SendOrPostCallback(this.OnreportOperationCompleted);
        }
        this.InvokeAsync("report", new object[] {
                    messageID,
                    mobileNumber,
                    statusCode,
                    timeStamp}, this.reportOperationCompleted, userState);
    }
    
    private void OnreportOperationCompleted(object arg) {
        if ((this.reportCompleted != null)) {
            System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
            this.reportCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
        }
    }
    
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://smsmonitor.asiainfo.com", ResponseNamespace="http://smsmonitor.asiainfo.com", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public void notification([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string mobileNumber, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string channelID, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string content, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] string timeStamp) {
        this.Invoke("notification", new object[] {
                    mobileNumber,
                    channelID,
                    content,
                    timeStamp});
    }
    
    /// <remarks/>
    public System.IAsyncResult Beginnotification(string mobileNumber, string channelID, string content, string timeStamp, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("notification", new object[] {
                    mobileNumber,
                    channelID,
                    content,
                    timeStamp}, callback, asyncState);
    }
    
    /// <remarks/>
    public void Endnotification(System.IAsyncResult asyncResult) {
        this.EndInvoke(asyncResult);
    }
    
    /// <remarks/>
    public void notificationAsync(string mobileNumber, string channelID, string content, string timeStamp) {
        this.notificationAsync(mobileNumber, channelID, content, timeStamp, null);
    }
    
    /// <remarks/>
    public void notificationAsync(string mobileNumber, string channelID, string content, string timeStamp, object userState) {
        if ((this.notificationOperationCompleted == null)) {
            this.notificationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnnotificationOperationCompleted);
        }
        this.InvokeAsync("notification", new object[] {
                    mobileNumber,
                    channelID,
                    content,
                    timeStamp}, this.notificationOperationCompleted, userState);
    }
    
    private void OnnotificationOperationCompleted(object arg) {
        if ((this.notificationCompleted != null)) {
            System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
            this.notificationCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
        }
    }
    
    /// <remarks/>
    public new void CancelAsync(object userState) {
        base.CancelAsync(userState);
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
public delegate void reportCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
public delegate void notificationCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
--------------------编程问答-------------------- 我也遇到这个问题了,快来人啊 --------------------编程问答--------------------
引用 4 楼 qq357112618 的回复:
我也遇到这个问题了,快来人啊

兄弟,你什么时候有眉目了,来说一声啊 --------------------编程问答-------------------- 直接引用就可以了,这个简单吧 --------------------编程问答-------------------- 楼主:建议你先在IDE里添加WEB引用,把功能都实现了再说。动态调用WS的贴子很多,搜一下即可。  --------------------编程问答-------------------- 联通的这个web服务是官方发布的吗?你是哪里得到这个服务地址的呀?我在.NET中添加服务引用,前往后提示找到0个方法
--------------------编程问答-------------------- 其实这个很简单呀,那是WSDL调用远程服务的方法,你只要知道什么调用就可以了,不用去研究那个代码 --------------------编程问答--------------------
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="MWSeviceDemo.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Web短信测试</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 264px; POSITION: absolute; TOP: 64px" runat="server"
Width="145" Height="24px"></asp:TextBox>
<asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 192px; POSITION: absolute; TOP: 64px" runat="server">用户名</asp:Label>
<asp:Label id="Label2" style="Z-INDEX: 103; LEFT: 192px; POSITION: absolute; TOP: 96px" runat="server"
Height="10px">密码</asp:Label>
<asp:TextBox id="TextBox2" style="Z-INDEX: 104; LEFT: 264px; POSITION: absolute; TOP: 96px" runat="server"
Width="145px" Height="24px"></asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 105; LEFT: 504px; POSITION: absolute; TOP: 64px" runat="server"
Width="81" Text="发普通信息"></asp:Button>
<asp:Label id="Label3" style="Z-INDEX: 106; LEFT: 192px; POSITION: absolute; TOP: 128px" runat="server"
Height="10px">信息内容</asp:Label>
<asp:Label id="Label4" style="Z-INDEX: 107; LEFT: 192px; POSITION: absolute; TOP: 208px" runat="server"
Height="10px">手机号码</asp:Label>
<asp:Label id="Label5" style="Z-INDEX: 108; LEFT: 192px; POSITION: absolute; TOP: 240px" runat="server"
Height="10px">号码个数</asp:Label>
<asp:TextBox id="TextBox3" style="Z-INDEX: 109; LEFT: 264px; POSITION: absolute; TOP: 128px"
runat="server" Width="424px" Height="72px" TextMode="MultiLine"></asp:TextBox>
<asp:TextBox id="TextBox4" style="Z-INDEX: 110; LEFT: 264px; POSITION: absolute; TOP: 208px"
runat="server" Width="145px" Height="24px"></asp:TextBox>
<asp:TextBox id="TextBox5" style="Z-INDEX: 111; LEFT: 264px; POSITION: absolute; TOP: 240px"
runat="server" Width="145px" Height="24px">1</asp:TextBox>
<asp:ListBox id="ListBox1" style="Z-INDEX: 112; LEFT: 192px; POSITION: absolute; TOP: 304px"
runat="server" Width="344px" Height="112px"></asp:ListBox>
<asp:Button id="Button2" style="Z-INDEX: 113; LEFT: 504px; POSITION: absolute; TOP: 96px" runat="server"
Width="81px" Text="帐户查询"></asp:Button>
<asp:Button id="Button3" style="Z-INDEX: 114; LEFT: 600px; POSITION: absolute; TOP: 96px" runat="server"
Width="81px" Text="接收信息"></asp:Button>
<asp:Button id="Button4" style="Z-INDEX: 115; LEFT: 504px; POSITION: absolute; TOP: 208px" runat="server"
Width="81px" Text="读报告"></asp:Button>
<asp:Button id="Button5" style="Z-INDEX: 116; LEFT: 504px; POSITION: absolute; TOP: 240px" runat="server"
Width="80px" Text="发双向信息"></asp:Button>
<asp:Label id="Label6" style="Z-INDEX: 117; LEFT: 232px; POSITION: absolute; TOP: 24px" runat="server"
Width="240px">网关WebService调用示例程序</asp:Label>
<asp:TextBox id="TextBox6" style="Z-INDEX: 118; LEFT: 264px; POSITION: absolute; TOP: 272px"
runat="server"></asp:TextBox>
<asp:Label id="Label7" style="Z-INDEX: 119; LEFT: 200px; POSITION: absolute; TOP: 272px" runat="server">子端口:</asp:Label></FONT>
</form>
</body>
</HTML>


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace MWSeviceDemo
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
MWSeviceDemo.MW.wmgw ws;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.TextBox TextBox3;
protected System.Web.UI.WebControls.TextBox TextBox4;
protected System.Web.UI.WebControls.TextBox TextBox5;
protected System.Web.UI.WebControls.ListBox ListBox1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Button Button3;
protected System.Web.UI.WebControls.Button Button5;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.TextBox TextBox6;
protected System.Web.UI.WebControls.Label Label7;
protected System.Web.UI.WebControls.Button Button4;

private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
ws = new MWSeviceDemo.MW.wmgw();
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{    
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
this.Button4.Click += new System.EventHandler(this.Button4_Click);
this.Button5.Click += new System.EventHandler(this.Button5_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Button1_Click(object sender, System.EventArgs e)
{
//单发
int result;
result=ws.MongateSendSms(TextBox1.Text,TextBox2.Text,TextBox4.Text,TextBox3.Text);
if(result > 0)
ListBox1.Items.Insert(0,"发送信息成功!");
else
ListBox1.Items.Insert(0,"发送信息失败!返回:"+result.ToString());
}

private void Button2_Click(object sender, System.EventArgs e)
{
int bal=ws.MongateQueryBalance(TextBox1.Text,TextBox2.Text);
int use=ws.MongateQueryUsed(TextBox1.Text,TextBox2.Text);
if(bal>=0 && use >=0){ListBox1.Items.Insert(0,"帐户余额:"+bal.ToString()+";帐户已用:"+use.ToString());}
else{ListBox1.Items.Insert(0,"返回:" + bal.ToString()+","+use.ToString());}
}

private void Button3_Click(object sender, System.EventArgs e)
{
string []result = ws.MongateCsGetSmsExEx(TextBox1.Text,TextBox2.Text);
if(result==null){ListBox1.Items.Insert(0,"无信息");}
else
foreach (string s in result)
{
ListBox1.Items.Insert(0,new ListItem(s,""));
}
}

private void Button4_Click(object sender, System.EventArgs e)
{
string []result = ws.MongateCsGetStatusReportExEx(TextBox1.Text,TextBox2.Text);
if(result==null){ListBox1.Items.Insert(0,"无状态报告");}
else
foreach (string s in result)
{
ListBox1.Items.Insert(0,new ListItem(s,""));
}
}

private void Button5_Click(object sender, System.EventArgs e)
{
string []ret=null;
//子端口发送
ret = ws.MongateCsSPSendSmsExEx(TextBox1.Text,TextBox2.Text,TextBox4.Text,TextBox3.Text,this.TextBox6.Text);
if(ret[0] == null)
{
ListBox1.Items.Insert(0,"发送信息成功!信息编号:"+ret[1]);
ListBox1.Items.Insert(0,"正确号码:"+ret[2]);
ListBox1.Items.Insert(0,"错误号码:"+ret[3]);
}
else
{
ListBox1.Items.Insert(0,"发送失败:" + ret[0] + "错误号码:"+ret[2]);
}
}
}
}


参考以上. --------------------编程问答-------------------- 除
补充:.NET技术 ,  Web Services
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,