消息提交 ASPX 示例
本主题提供可用于将服务内容提交到专用进程的示例 .aspx 代码。 可以使用此 .aspx 代码而不是业务线 (LOB) 应用程序。
演示
此代码演示如何调用 SubmitRNIF
方法来提交消息,其中包括:
设置来自应用程序的消息参数输入
设置邮件类别
如果提交的值为 null 或空,则为消息生成合作伙伴接口流程 (PIP) 实例
生成输入附件文件数组和备注
示例
此代码接受来自前端应用程序(如浏览器、InfoPath® 或 Microsoft® Word)的输入,并生成发起方专用进程可以使用的 XML 文档。
LOBWebApplication 实用工具包含以下代码。 有关详细信息,请参阅 LOBWebApplication。
using System;
using System.IO;
using System.Text;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.SessionState;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Solutions.BTARN.SubmitRNIF;
namespace Microsoft.Solutions.BTARN.SDK
{
/// <summary>
/// Calls SubmitRNIF to submit service content to the BTARN private process.
/// </summary>
public class AspxLobApplication : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
Request.ValidateInput();
string sPipCode=Request["PipCode"];
string sPipVersion=Request["PipVersion"];
string sPipInstanceID=Request["PipInstanceID"];
string sPipCategory=Request["PipCategory"];
string sPipSource=Request["PipSource"];
string sPipDestination=Request["PipDestination"];
string sFileName1=Request["FileName1"];
string sFileName2=Request["FileName2"];
string sRemark1=Request["Remark1"];
string sRemark2=Request["Remark2"];
string[] aInputFiles = new string[2];
string[] aRemarks = new string[2];
string sContent = Request["Textarea1"];
SubmitRNIF.SubmitRNIF MessageSubmitter = new SubmitRNIF.SubmitRNIF();
//The message category
SubmitRNIF.SubmitRNIF.MessageCategory mc;
if(sPipCategory.ToUpper() == "RESPONSE")
mc=SubmitRNIF.SubmitRNIF.MessageCategory.Response;
else
mc=SubmitRNIF.SubmitRNIF.MessageCategory.Action;
//Generate a PIP instance ID if the submitted value is null or empty
if(sPipInstanceID.Length==0)
sPipInstanceID=Guid.NewGuid().ToString();
//Generate the input attachment files array and its associated remarks
if(sFileName1!=null && sFileName1.Length>0) aInputFiles[0]=sFileName1;
if(sFileName2!=null && sFileName2.Length>0) aInputFiles[1]=sFileName1;
if(sRemark1!=null && sRemark1.Length>0) aRemarks[0]=sRemark1;
if(sRemark2!=null && sRemark2.Length>0) aRemarks[1]=sRemark2;
if(sFileName1==null && sFileName2==null)
MessageSubmitter.SubmitMessage(mc, sPipSource, sPipDestination, sPipCode, sPipInstanceID, sPipVersion, sContent);
else
MessageSubmitter.SubmitMessage(mc, sPipSource, sPipDestination, sPipCode, sPipInstanceID, sPipVersion, sContent, aInputFiles);
}
#region Web Form Designer generated code
...
}
}
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈