• C#开发XML WebService接口(SOAP)


    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Web;
    using System.Web.Services;
    using BX.Interface;

    namespace WebService
    {
        
    /// <summary>
        
    /// Service1 的摘要说明。
        
    /// </summary>

        public class doService : System.Web.Services.WebService
        
    {

    /// <summary>
            
    /// 网上报销系统WebService服务通用调用方法
            
    /// </summary>
            
    /// <param name="ifCode">接口标识</param>
            
    /// <param name="ifPass">校验码</param>
            
    /// <param name="ifEvent">操作方式(可空)</param>
            
    /// <param name="ifInfo">传入的XML信息</param>
            
    /// <returns></returns>

            [WebMethod]
            
    public string IfService(string ifCode,string ifPass,string ifEvent,string ifInfo)
            
    {
                ifCode 
    = ifCode.Trim();
                ifPass 
    = ifPass.Trim();
                ifEvent 
    = ifEvent.Trim();
                ifInfo 
    = ifInfo.Trim();

                
    string IReceiveContract_Id = System.Configuration.ConfigurationSettings.AppSettings["IReceiveContract_Id"].Trim();
                
    string IReceiveContract_PSW = System.Configuration.ConfigurationSettings.AppSettings["IReceiveContract_PSW"].Trim();
                
    string IReceiveNoContract_Id = System.Configuration.ConfigurationSettings.AppSettings["IReceiveNoContract_Id"].Trim();
                
    string IReceiveNoContract_PSW = System.Configuration.ConfigurationSettings.AppSettings["IReceiveNoContract_PSW"].Trim();

                
    if(ifCode.Equals(IReceiveContract_Id))
                
    {
                    
    if(!ifPass.Equals(IReceiveContract_PSW))
                        
    return ICommon.createResultXML(2,"","");
                    
    return IApplyContract.ReceiveApply(ifCode,ifInfo);
                }

                
    else if(ifCode.Equals(IReceiveNoContract_Id))
                
    {
                    
    if(!ifPass.Equals(IReceiveNoContract_PSW))
                        
    return ICommon.createResultXML(2,"","");
                    
    return IApplyNoContract.ReceiveApply(ifCode,ifInfo);
                }

                
    else
                
    {            
                    
    return ICommon.createResultXML(1,"","");                    
                }
            
            }
     //-- end IfSerive
        }

    }


    通用处理类ICommon.cs

    接收外部数据

    调用外部接口发送数据
  • 相关阅读:
    some Rails leanrning:Rails Ajax,Validates,Cycle
    快速排序与挑白菜
    九月开学
    搜索引擎代码资源
    start RubyOnRails
    垂直搜索引擎之我见
    demo下载:ASP.NET GDI+生成动态的Gif动画
    NHibernate和ADO.Net的性能对比相差有多大?
    手工调试自定义控件各主要方法执行顺序(分运行时和设计时)
    ASP.Net中的缓存方案(不仅仅是Cache和Session)(我在CSDN上和别人的争论)
  • 原文地址:https://www.cnblogs.com/ding0910/p/815407.html
Copyright © 2020-2023  润新知