| @ -0,0 +1,95 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3Frameworks.Utils; | |||
| using BWP.B3QingDaoWanFu.Utils; | |||
| using BWP.B3Sale.BL; | |||
| using BWP.B3Sale.BO; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Forks.EnterpriseServices.JsonRpc; | |||
| using TSingSoft.WebPluginFramework; | |||
| namespace BWP.B3QingDaoWanFu.Rpc | |||
| { | |||
| [Rpc] | |||
| public static class GatheringRpc | |||
| { | |||
| [Rpc] | |||
| public static long Insert(Gathering dmo) | |||
| { | |||
| using (var context = new TransactionContext()) | |||
| { | |||
| var bl = BIFactory.Create<IGatheringBL>(context); | |||
| bl.InitNewDmo(dmo); | |||
| var dom = new DQueryDom(new JoinAlias(typeof(Customer))); | |||
| dom.Columns.Add(DQSelectColumn.Field("AccountCustomer_ID")); | |||
| dom.Columns.Add(DQSelectColumn.Field("AccountCustomer_Name")); | |||
| dom.Where.Conditions.Add(DQCondition.EQ("OuterCode", dmo.AccountCustomer_OuterCode));// | |||
| //找到该客户对应的结账客户 | |||
| var info = dom.EExecuteScalar<long, string>(context.Session); | |||
| if (info == null) | |||
| throw new ApplicationException(string.Format("没有配置外部编码{0}的对应结账客户", dmo.AccountCustomer_OuterCode)); | |||
| dmo.AccountCustomer_ID = info.Item1; | |||
| dmo.AccountCustomer_Name = info.Item2; | |||
| SetAccountCustomerInfo(dmo, context.Session); | |||
| var conf = new WanFuOnlineConfig(); | |||
| if (conf.AccID.Value == 0) | |||
| { | |||
| throw new ApplicationException("没有配置会计单位"); | |||
| } | |||
| if (conf.GatheringAccountID.Value == 0) | |||
| { | |||
| throw new ApplicationException("没有配置帐户"); | |||
| } | |||
| if (conf.ReceiptTypeID.Value == 0) | |||
| { | |||
| throw new ApplicationException("没有配置收款类型"); | |||
| } | |||
| dmo.AccountingUnit_ID = conf.AccID.Value; | |||
| dmo.ReceiptType_ID = conf.ReceiptTypeID.Value; | |||
| dmo.GatheringAccount_ID = conf.GatheringAccountID.Value; | |||
| // DmoUtil.RefreshDependency(dmo, "AccountingUnit_ID", "ReceiptType_ID", "GatheringAccount_ID"); 这里没有必要执行 | |||
| bl.Insert(dmo); | |||
| bl.Check(dmo); | |||
| context.Commit(); | |||
| } | |||
| return dmo.ID; | |||
| } | |||
| private static void SetAccountCustomerInfo(Gathering dmo, IDmoSessionWithTransaction session) | |||
| { | |||
| var dom = new DQueryDom(new JoinAlias(typeof(Customer))); | |||
| new Customer().Employee_ID = 1; | |||
| dom.Columns.Add(DQSelectColumn.Field("Department_ID")); | |||
| dom.Columns.Add(DQSelectColumn.Field("Employee_ID")); | |||
| dom.Columns.Add(DQSelectColumn.Field("Department_Name")); | |||
| dom.Columns.Add(DQSelectColumn.Field("Employee_Name")); | |||
| dom.Where.Conditions.Add(DQCondition.EQ("ID", dmo.AccountCustomer_ID)); | |||
| var tuple = EExecuteScalar<long?, long?, string, string>(dom, session); | |||
| if (tuple != null) | |||
| { | |||
| dmo.Department_ID = tuple.Item1; | |||
| dmo.Employee_ID = tuple.Item2; | |||
| dmo.Department_Name = tuple.Item3; | |||
| dmo.Employee_Name = tuple.Item4; | |||
| } | |||
| else | |||
| { | |||
| throw new ApplicationException(string.Format("不存在编号为{0}的客户", dmo.AccountCustomer_OuterCode)); | |||
| } | |||
| } | |||
| static Tuple<T1, T2, T3, T4> EExecuteScalar<T1, T2, T3, T4>(DQueryDom query, IDmoSessionWithTransaction session) | |||
| { | |||
| var list = query.EExecuteList<T1, T2, T3, T4>(session); | |||
| return list.Count == 0 ? null : list[0]; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,73 @@ | |||
| | |||
| Microsoft Visual Studio Solution File, Format Version 11.00 | |||
| # Visual Studio 2010 | |||
| Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebFolder", "WebFolder\", "{8506D64E-C6F3-4410-93CF-BF3C9327C95B}" | |||
| ProjectSection(WebsiteProperties) = preProject | |||
| TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" | |||
| ProjectReferences = "{FE9CD25F-773A-4533-98FD-45D7B08254F2}|RpcHelper.dll;" | |||
| Debug.AspNetCompiler.VirtualPath = "/WebFolder" | |||
| Debug.AspNetCompiler.PhysicalPath = "WebFolder\" | |||
| Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\WebFolder\" | |||
| Debug.AspNetCompiler.Updateable = "true" | |||
| Debug.AspNetCompiler.ForceOverwrite = "true" | |||
| Debug.AspNetCompiler.FixedNames = "false" | |||
| Debug.AspNetCompiler.Debug = "True" | |||
| Release.AspNetCompiler.VirtualPath = "/WebFolder" | |||
| Release.AspNetCompiler.PhysicalPath = "WebFolder\" | |||
| Release.AspNetCompiler.TargetPath = "PrecompiledWeb\WebFolder\" | |||
| Release.AspNetCompiler.Updateable = "true" | |||
| Release.AspNetCompiler.ForceOverwrite = "true" | |||
| Release.AspNetCompiler.FixedNames = "false" | |||
| Release.AspNetCompiler.Debug = "False" | |||
| VWDPort = "3491" | |||
| EndProjectSection | |||
| EndProject | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcHelper", "RpcHelper\RpcHelper.csproj", "{FE9CD25F-773A-4533-98FD-45D7B08254F2}" | |||
| EndProject | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{285FA7AE-A051-41A7-8B32-8B77E11E4E17}" | |||
| EndProject | |||
| Global | |||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
| Debug|Any CPU = Debug|Any CPU | |||
| Debug|Mixed Platforms = Debug|Mixed Platforms | |||
| Debug|x86 = Debug|x86 | |||
| Release|Any CPU = Release|Any CPU | |||
| Release|Mixed Platforms = Release|Mixed Platforms | |||
| Release|x86 = Release|x86 | |||
| EndGlobalSection | |||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Release|Any CPU.ActiveCfg = Debug|Any CPU | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Release|Any CPU.Build.0 = Debug|Any CPU | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Release|Mixed Platforms.Build.0 = Debug|Any CPU | |||
| {8506D64E-C6F3-4410-93CF-BF3C9327C95B}.Release|x86.ActiveCfg = Debug|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Release|Any CPU.Build.0 = Release|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Release|Mixed Platforms.Build.0 = Release|Any CPU | |||
| {FE9CD25F-773A-4533-98FD-45D7B08254F2}.Release|x86.ActiveCfg = Release|Any CPU | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Debug|Any CPU.ActiveCfg = Debug|x86 | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Debug|Mixed Platforms.Build.0 = Debug|x86 | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Debug|x86.ActiveCfg = Debug|x86 | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Debug|x86.Build.0 = Debug|x86 | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Release|Any CPU.ActiveCfg = Release|x86 | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Release|Mixed Platforms.ActiveCfg = Release|x86 | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Release|Mixed Platforms.Build.0 = Release|x86 | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Release|x86.ActiveCfg = Release|x86 | |||
| {285FA7AE-A051-41A7-8B32-8B77E11E4E17}.Release|x86.Build.0 = Release|x86 | |||
| EndGlobalSection | |||
| GlobalSection(SolutionProperties) = preSolution | |||
| HideSolutionNode = FALSE | |||
| EndGlobalSection | |||
| EndGlobal | |||
| @ -0,0 +1,61 @@ | |||
| using System.Collections.Generic; | |||
| using System.Xml.Serialization; | |||
| namespace RpcHelper { | |||
| [XmlRoot(ElementName = "bills")] | |||
| public class Gatherings { | |||
| public Gatherings() { | |||
| Bills = new List<Gathering>(); | |||
| } | |||
| [XmlElement(ElementName = "bill")] | |||
| public List<Gathering> Bills { get; set; } | |||
| } | |||
| public class Gathering { | |||
| public Gathering() { | |||
| Head = new GatheringHead(); | |||
| } | |||
| [XmlElement(ElementName = "header")] | |||
| public GatheringHead Head; | |||
| } | |||
| public class GatheringHead { | |||
| private string _requestId = string.Empty; | |||
| [XmlElement(ElementName = "RequestId")] | |||
| public string RequestId { | |||
| get { return _requestId; } | |||
| set { _requestId = value; } | |||
| } | |||
| private string _customerCode = string.Empty; | |||
| [XmlElement(ElementName = "CustomerCode")] | |||
| public string CustomerCode { | |||
| get { return _customerCode; } | |||
| set { _customerCode = value; } | |||
| } | |||
| private string _time = string.Empty; | |||
| [XmlElement(ElementName = "Time")] | |||
| public string Time { | |||
| get { return _time; } | |||
| set { _time = value; } | |||
| } | |||
| private string _money = string.Empty; | |||
| [XmlElement(ElementName = "Money")] | |||
| public string Money { | |||
| get { return _money; } | |||
| set { _money = value; } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,36 @@ | |||
| using System.Reflection; | |||
| using System.Runtime.CompilerServices; | |||
| using System.Runtime.InteropServices; | |||
| // 有关程序集的常规信息通过以下 | |||
| // 特性集控制。更改这些特性值可修改 | |||
| // 与程序集关联的信息。 | |||
| [assembly: AssemblyTitle("RpcHelper")] | |||
| [assembly: AssemblyDescription("")] | |||
| [assembly: AssemblyConfiguration("")] | |||
| [assembly: AssemblyCompany("Microsoft")] | |||
| [assembly: AssemblyProduct("RpcHelper")] | |||
| [assembly: AssemblyCopyright("Copyright © Microsoft 2016")] | |||
| [assembly: AssemblyTrademark("")] | |||
| [assembly: AssemblyCulture("")] | |||
| // 将 ComVisible 设置为 false 使此程序集中的类型 | |||
| // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, | |||
| // 则将该类型上的 ComVisible 特性设置为 true。 | |||
| [assembly: ComVisible(false)] | |||
| // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | |||
| [assembly: Guid("a551ac88-8c1f-437e-ba0f-ead89212f71e")] | |||
| // 程序集的版本信息由下面四个值组成: | |||
| // | |||
| // 主版本 | |||
| // 次版本 | |||
| // 内部版本号 | |||
| // 修订号 | |||
| // | |||
| // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, | |||
| // 方法是按如下所示使用“*”: | |||
| // [assembly: AssemblyVersion("1.0.*")] | |||
| [assembly: AssemblyVersion("1.0.0.0")] | |||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||
| @ -0,0 +1,64 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Xml.Serialization; | |||
| namespace RpcHelper { | |||
| [XmlRoot(ElementName = "results")] | |||
| public class Results { | |||
| public Results() { | |||
| SendResult = new List<Result>(); | |||
| } | |||
| private string _resultcode = string.Empty; | |||
| [XmlElement(ElementName = "resultcode")] | |||
| public string Resultcode { | |||
| get { return _resultcode; } | |||
| set { _resultcode = value; } | |||
| } | |||
| private string _content = string.Empty; | |||
| [XmlElement(ElementName = "content")] | |||
| public string Content { | |||
| get { return _content; } | |||
| set { _content = value; } | |||
| } | |||
| [XmlElement(ElementName = "result")] | |||
| public List<Result> SendResult { get; set; } | |||
| } | |||
| public class Result { | |||
| private string _requestId = string.Empty; | |||
| [XmlElement(ElementName = "RequestId")] | |||
| public string RequestId { | |||
| get { return _requestId; } | |||
| set { _requestId = value; } | |||
| } | |||
| private string _resultcode = string.Empty; | |||
| [XmlElement(ElementName = "resultcode")] | |||
| public string Resultcode { | |||
| get { return _resultcode; } | |||
| set { _resultcode = value; } | |||
| } | |||
| private string _bwpid = string.Empty; | |||
| [XmlElement(ElementName = "BWPID")] | |||
| public string Bwpid { | |||
| get { return _bwpid; } | |||
| set { _bwpid = value; } | |||
| } | |||
| private string _content = string.Empty; | |||
| [XmlElement(ElementName = "content")] | |||
| public string Content { | |||
| get { return _content; } | |||
| set { _content = value; } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,62 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <PropertyGroup> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| <ProductVersion>8.0.30703</ProductVersion> | |||
| <SchemaVersion>2.0</SchemaVersion> | |||
| <ProjectGuid>{FE9CD25F-773A-4533-98FD-45D7B08254F2}</ProjectGuid> | |||
| <OutputType>Library</OutputType> | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>RpcHelper</RootNamespace> | |||
| <AssemblyName>RpcHelper</AssemblyName> | |||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DebugType>full</DebugType> | |||
| <Optimize>false</Optimize> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <DebugType>pdbonly</DebugType> | |||
| <Optimize>true</Optimize> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="Forks.JsonRpc.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||
| <SpecificVersion>False</SpecificVersion> | |||
| <HintPath>..\..\..\Projects\tsref\release\Forks.JsonRpc.Client.dll</HintPath> | |||
| </Reference> | |||
| <Reference Include="System" /> | |||
| <Reference Include="System.configuration" /> | |||
| <Reference Include="System.Core" /> | |||
| <Reference Include="System.Web" /> | |||
| <Reference Include="System.Xml.Linq" /> | |||
| <Reference Include="System.Data.DataSetExtensions" /> | |||
| <Reference Include="System.Data" /> | |||
| <Reference Include="System.Xml" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="Gatherings.cs" /> | |||
| <Compile Include="Results.cs" /> | |||
| <Compile Include="RpcHelperUtil.cs" /> | |||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||
| </ItemGroup> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
| Other similar extension points exist, see Microsoft.Common.targets. | |||
| <Target Name="BeforeBuild"> | |||
| </Target> | |||
| <Target Name="AfterBuild"> | |||
| </Target> | |||
| --> | |||
| </Project> | |||
| @ -0,0 +1,142 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.IO; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Xml; | |||
| using System.Xml.Serialization; | |||
| using Forks.JsonRpc.Client; | |||
| using Forks.JsonRpc.Client.Data; | |||
| namespace RpcHelper { | |||
| public static class RpcHelperUtil { | |||
| private static bool _isInit; | |||
| public static string InsertGathering(string data) { | |||
| var logName = DateTime.Today.Date.ToString("yyyyMMdd") + "Gatheringlog.txt"; | |||
| var results = new Results(); | |||
| var path = System.Web.HttpContext.Current.Request.PhysicalApplicationPath; | |||
| string resultStr; | |||
| using (var textWriter = new StreamWriter(path + "\\log\\" + logName, true, Encoding.UTF8)) { | |||
| textWriter.WriteLine("{0} 收款单接口开始接收数据:------------------------------------", DateTime.Now); | |||
| textWriter.WriteLine(data); | |||
| Console.WriteLine("{0}:开始接受数据:", DateTime.Now); | |||
| Console.WriteLine(data); | |||
| try { | |||
| var dmo = ParseXmlToMsg<Gatherings>(data); | |||
| if (!_isInit) { | |||
| var url = System.Configuration.ConfigurationManager.AppSettings["url"]; | |||
| RpcFacade.Init(url, "QingDaoWanFuRpc"); | |||
| _isInit = true; | |||
| } | |||
| var username = System.Configuration.ConfigurationManager.AppSettings["username"]; | |||
| var strPwd = System.Configuration.ConfigurationManager.AppSettings["pwd"]; | |||
| RpcFacade.Login(username, strPwd); | |||
| foreach (var bill in dmo.Bills) { | |||
| var r = new Result(); | |||
| r.RequestId = bill.Head.RequestId; | |||
| textWriter.WriteLine("开始处理单据:" + r.RequestId); | |||
| Console.WriteLine("开始处理单据:" + r.RequestId); | |||
| results.SendResult.Add(r); | |||
| var gathering = new RpcObject("/MainSystem/B3Sale/BO/Gathering"); | |||
| SetString(gathering, "AccountCustomer_OuterCode", bill.Head.CustomerCode);// 客户的外部编码 | |||
| SetDateTime(gathering, "GatheringTime", bill.Head.Time); | |||
| SetDecimal(gathering, "GatheringMoney", bill.Head.Money); | |||
| try { | |||
| var id = RpcFacade.Call<long>("/MainSystem/B3QingDaoWanFu/Rpc/GatheringRpc/Insert", gathering); | |||
| textWriter.WriteLine("成功创建收款单No." + id); | |||
| r.Content = "成功创建收款单No." + id; | |||
| r.Resultcode = "0"; | |||
| r.Bwpid = id.ToString(); | |||
| } catch (Exception e1) { | |||
| r.Resultcode = "1"; | |||
| r.Content = "调用错误,原因:" + e1.Message; | |||
| textWriter.WriteLine("内部错误:" + e1.Message); | |||
| Console.WriteLine("内部错误:" + e1.Message); | |||
| } | |||
| } | |||
| } catch (Exception e) { | |||
| results.Resultcode = "1"; | |||
| results.Content = "调用错误,原因:" + e.Message; | |||
| textWriter.WriteLine("内部错误:" + e.Message); | |||
| Console.WriteLine("内部错误:" + e.Message); | |||
| } finally { | |||
| RpcFacade.Logout(); | |||
| } | |||
| if (results.SendResult.Count > 0 && results.SendResult.All(x => x.Resultcode == "0")) { | |||
| results.Resultcode = "0"; | |||
| } else { | |||
| results.Resultcode = "1"; | |||
| } | |||
| resultStr = ObjToXml(results, Formatting.Indented, Encoding.GetEncoding("gb2312")); | |||
| textWriter.WriteLine("返回报文:" + resultStr); | |||
| textWriter.WriteLine("{0} 收款单接口处理完毕 ", DateTime.Now); | |||
| } | |||
| return resultStr; | |||
| } | |||
| public static string ObjToXml(object obj, Formatting formatting, Encoding encoding) { | |||
| using (var stream = new MemoryStream()) { | |||
| using (var writer = new XmlTextWriter(stream, encoding)) { | |||
| writer.Formatting = formatting; | |||
| writer.IndentChar = '\t'; | |||
| var ns = new XmlSerializerNamespaces(); | |||
| ns.Add(string.Empty, string.Empty); | |||
| new XmlSerializer(obj.GetType()).Serialize(writer, obj, ns); | |||
| } | |||
| return encoding.GetString(stream.ToArray()); | |||
| } | |||
| } | |||
| public static T ParseXmlToMsg<T>(string xml) { | |||
| using (TextReader reader = new StringReader(xml)) { | |||
| return (T)new XmlSerializer(typeof(T)).Deserialize(reader); | |||
| } | |||
| } | |||
| private static void SetLong(RpcObject rpcObject, string name, string value) { | |||
| if (!string.IsNullOrEmpty(value)) { | |||
| rpcObject.Set(name, long.Parse(value)); | |||
| } | |||
| } | |||
| private static void SetDateTime(RpcObject rpcObject, string name, string value) { | |||
| if (!string.IsNullOrEmpty(value)) { | |||
| rpcObject.Set(name, Convert.ToDateTime(value)); | |||
| } | |||
| } | |||
| private static void SetDecimal(RpcObject rpcObject, string name, string value) { | |||
| if (!string.IsNullOrEmpty(value)) { | |||
| rpcObject.Set(name, decimal.Parse(value)); | |||
| } | |||
| } | |||
| private static void SetInt(RpcObject rpcObject, string name, string value) { | |||
| if (!string.IsNullOrEmpty(value)) { | |||
| rpcObject.Set(name, int.Parse(value)); | |||
| } | |||
| } | |||
| private static void SetShort(RpcObject rpcObject, string name, string value) { | |||
| if (!string.IsNullOrEmpty(value)) { | |||
| rpcObject.Set(name, short.Parse(value)); | |||
| } | |||
| } | |||
| private static void SetString(RpcObject rpcObject, string name, string value) { | |||
| if (!string.IsNullOrEmpty(value)) { | |||
| rpcObject.Set(name, value); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,39 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Xml; | |||
| using RpcHelper; | |||
| using Test.webservice; | |||
| namespace Test { | |||
| class Program { | |||
| static void Main(string[] args) { | |||
| var web = new Service(); | |||
| var r= InsertPlan(web); | |||
| Console.WriteLine(r); | |||
| Console.Read(); | |||
| } | |||
| private static string InsertPlan(Service web) { | |||
| var o = new Gatherings(); | |||
| var bill = new Gathering(); | |||
| bill.Head.CustomerCode = "0036"; | |||
| bill.Head.Time = "2016-04-06 12:00"; | |||
| bill.Head.RequestId = "201604061200001"; | |||
| bill.Head.Money = "100"; | |||
| o.Bills.Add(bill); | |||
| var data = RpcHelperUtil.ObjToXml(o, Formatting.Indented, Encoding.GetEncoding("gb2312")); | |||
| //var xx = RpcHelper.ParseXmlToMsg<FeedPlans>(data); | |||
| Console.WriteLine(data); | |||
| //web.Url = "http://203.86.48.90:81/bwprpc/Service.asmx"; | |||
| // web.Url = "http://192.168.1.2/bwprpc/Service.asmx"; | |||
| web.Url = "http://localhost:2100/WanFuSale/Service.asmx"; | |||
| var xml = web.InsertGathering(data); | |||
| return xml; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,36 @@ | |||
| using System.Reflection; | |||
| using System.Runtime.CompilerServices; | |||
| using System.Runtime.InteropServices; | |||
| // 有关程序集的常规信息通过以下 | |||
| // 特性集控制。更改这些特性值可修改 | |||
| // 与程序集关联的信息。 | |||
| [assembly: AssemblyTitle("Test")] | |||
| [assembly: AssemblyDescription("")] | |||
| [assembly: AssemblyConfiguration("")] | |||
| [assembly: AssemblyCompany("Microsoft")] | |||
| [assembly: AssemblyProduct("Test")] | |||
| [assembly: AssemblyCopyright("Copyright © Microsoft 2016")] | |||
| [assembly: AssemblyTrademark("")] | |||
| [assembly: AssemblyCulture("")] | |||
| // 将 ComVisible 设置为 false 使此程序集中的类型 | |||
| // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, | |||
| // 则将该类型上的 ComVisible 特性设置为 true。 | |||
| [assembly: ComVisible(false)] | |||
| // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | |||
| [assembly: Guid("c3e1d6d9-85bb-4fd7-a67a-2d2a2ff83f3b")] | |||
| // 程序集的版本信息由下面四个值组成: | |||
| // | |||
| // 主版本 | |||
| // 次版本 | |||
| // 内部版本号 | |||
| // 修订号 | |||
| // | |||
| // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, | |||
| // 方法是按如下所示使用“*”: | |||
| // [assembly: AssemblyVersion("1.0.*")] | |||
| [assembly: AssemblyVersion("1.0.0.0")] | |||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||
| @ -0,0 +1,36 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // 此代码由工具生成。 | |||
| // 运行时版本:4.0.30319.18063 | |||
| // | |||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||
| // 重新生成代码,这些更改将会丢失。 | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| namespace Test.Properties { | |||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] | |||
| internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { | |||
| private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); | |||
| public static Settings Default { | |||
| get { | |||
| return defaultInstance; | |||
| } | |||
| } | |||
| [global::System.Configuration.ApplicationScopedSettingAttribute()] | |||
| [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |||
| [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] | |||
| [global::System.Configuration.DefaultSettingValueAttribute("http://localhost:2100/WanfuSale/Service.asmx")] | |||
| public string Test_webservice_Service { | |||
| get { | |||
| return ((string)(this["Test_webservice_Service"])); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,9 @@ | |||
| <?xml version='1.0' encoding='utf-8'?> | |||
| <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Test.Properties" GeneratedClassName="Settings"> | |||
| <Profiles /> | |||
| <Settings> | |||
| <Setting Name="Test_webservice_Service" Type="(Web Service URL)" Scope="Application"> | |||
| <Value Profile="(Default)">http://localhost:2100/WanfuSale/Service.asmx</Value> | |||
| </Setting> | |||
| </Settings> | |||
| </SettingsFile> | |||
| @ -0,0 +1,106 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <PropertyGroup> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">x86</Platform> | |||
| <ProductVersion>8.0.30703</ProductVersion> | |||
| <SchemaVersion>2.0</SchemaVersion> | |||
| <ProjectGuid>{285FA7AE-A051-41A7-8B32-8B77E11E4E17}</ProjectGuid> | |||
| <OutputType>Exe</OutputType> | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>Test</RootNamespace> | |||
| <AssemblyName>Test</AssemblyName> | |||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | |||
| <PlatformTarget>x86</PlatformTarget> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DebugType>full</DebugType> | |||
| <Optimize>false</Optimize> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | |||
| <PlatformTarget>x86</PlatformTarget> | |||
| <DebugType>pdbonly</DebugType> | |||
| <Optimize>true</Optimize> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="System" /> | |||
| <Reference Include="System.Core" /> | |||
| <Reference Include="System.EnterpriseServices" /> | |||
| <Reference Include="System.Web.Services" /> | |||
| <Reference Include="System.Xml.Linq" /> | |||
| <Reference Include="System.Data.DataSetExtensions" /> | |||
| <Reference Include="System.Data" /> | |||
| <Reference Include="System.Xml" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="Program.cs" /> | |||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||
| <Compile Include="Properties\Settings.Designer.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DesignTimeSharedInput>True</DesignTimeSharedInput> | |||
| <DependentUpon>Settings.settings</DependentUpon> | |||
| </Compile> | |||
| <Compile Include="Web References\webservice\Reference.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DesignTime>True</DesignTime> | |||
| <DependentUpon>Reference.map</DependentUpon> | |||
| </Compile> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <WCFMetadata Include="Service References\" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <WebReferences Include="Web References\" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <WebReferenceUrl Include="http://localhost:2100/WanfuSale/Service.asmx"> | |||
| <UrlBehavior>Dynamic</UrlBehavior> | |||
| <RelPath>Web References\webservice\</RelPath> | |||
| <UpdateFromURL>http://localhost:2100/WanfuSale/Service.asmx</UpdateFromURL> | |||
| <ServiceLocationURL> | |||
| </ServiceLocationURL> | |||
| <CachedDynamicPropName> | |||
| </CachedDynamicPropName> | |||
| <CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName> | |||
| <CachedSettingsPropName>Test_webservice_Service</CachedSettingsPropName> | |||
| </WebReferenceUrl> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <None Include="app.config" /> | |||
| <None Include="Properties\Settings.settings"> | |||
| <Generator>SettingsSingleFileGenerator</Generator> | |||
| <LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||
| </None> | |||
| <None Include="Web References\webservice\Reference.map"> | |||
| <Generator>MSDiscoCodeGenerator</Generator> | |||
| <LastGenOutput>Reference.cs</LastGenOutput> | |||
| </None> | |||
| <None Include="Web References\webservice\Service.disco" /> | |||
| <None Include="Web References\webservice\Service.wsdl" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ProjectReference Include="..\RpcHelper\RpcHelper.csproj"> | |||
| <Project>{FE9CD25F-773A-4533-98FD-45D7B08254F2}</Project> | |||
| <Name>RpcHelper</Name> | |||
| </ProjectReference> | |||
| </ItemGroup> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||
| Other similar extension points exist, see Microsoft.Common.targets. | |||
| <Target Name="BeforeBuild"> | |||
| </Target> | |||
| <Target Name="AfterBuild"> | |||
| </Target> | |||
| --> | |||
| </Project> | |||
| @ -0,0 +1,150 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // 此代码由工具生成。 | |||
| // 运行时版本:4.0.30319.18063 | |||
| // | |||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||
| // 重新生成代码,这些更改将会丢失。 | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| // | |||
| // 此源代码是由 Microsoft.VSDesigner 4.0.30319.18063 版自动生成。 | |||
| // | |||
| #pragma warning disable 1591 | |||
| namespace Test.webservice { | |||
| using System; | |||
| using System.Web.Services; | |||
| using System.Diagnostics; | |||
| using System.Web.Services.Protocols; | |||
| using System.Xml.Serialization; | |||
| using System.ComponentModel; | |||
| /// <remarks/> | |||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] | |||
| [System.Diagnostics.DebuggerStepThroughAttribute()] | |||
| [System.ComponentModel.DesignerCategoryAttribute("code")] | |||
| [System.Web.Services.WebServiceBindingAttribute(Name="ServiceSoap", Namespace="http://tempuri.org/")] | |||
| public partial class Service : System.Web.Services.Protocols.SoapHttpClientProtocol { | |||
| private System.Threading.SendOrPostCallback InsertGatheringOperationCompleted; | |||
| private bool useDefaultCredentialsSetExplicitly; | |||
| /// <remarks/> | |||
| public Service() { | |||
| this.Url = global::Test.Properties.Settings.Default.Test_webservice_Service; | |||
| if ((this.IsLocalFileSystemWebService(this.Url) == true)) { | |||
| this.UseDefaultCredentials = true; | |||
| this.useDefaultCredentialsSetExplicitly = false; | |||
| } | |||
| else { | |||
| this.useDefaultCredentialsSetExplicitly = true; | |||
| } | |||
| } | |||
| public new string Url { | |||
| get { | |||
| return base.Url; | |||
| } | |||
| set { | |||
| if ((((this.IsLocalFileSystemWebService(base.Url) == true) | |||
| && (this.useDefaultCredentialsSetExplicitly == false)) | |||
| && (this.IsLocalFileSystemWebService(value) == false))) { | |||
| base.UseDefaultCredentials = false; | |||
| } | |||
| base.Url = value; | |||
| } | |||
| } | |||
| public new bool UseDefaultCredentials { | |||
| get { | |||
| return base.UseDefaultCredentials; | |||
| } | |||
| set { | |||
| base.UseDefaultCredentials = value; | |||
| this.useDefaultCredentialsSetExplicitly = true; | |||
| } | |||
| } | |||
| /// <remarks/> | |||
| public event InsertGatheringCompletedEventHandler InsertGatheringCompleted; | |||
| /// <remarks/> | |||
| [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/InsertGathering", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] | |||
| public string InsertGathering(string data) { | |||
| object[] results = this.Invoke("InsertGathering", new object[] { | |||
| data}); | |||
| return ((string)(results[0])); | |||
| } | |||
| /// <remarks/> | |||
| public void InsertGatheringAsync(string data) { | |||
| this.InsertGatheringAsync(data, null); | |||
| } | |||
| /// <remarks/> | |||
| public void InsertGatheringAsync(string data, object userState) { | |||
| if ((this.InsertGatheringOperationCompleted == null)) { | |||
| this.InsertGatheringOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInsertGatheringOperationCompleted); | |||
| } | |||
| this.InvokeAsync("InsertGathering", new object[] { | |||
| data}, this.InsertGatheringOperationCompleted, userState); | |||
| } | |||
| private void OnInsertGatheringOperationCompleted(object arg) { | |||
| if ((this.InsertGatheringCompleted != null)) { | |||
| System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); | |||
| this.InsertGatheringCompleted(this, new InsertGatheringCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); | |||
| } | |||
| } | |||
| /// <remarks/> | |||
| public new void CancelAsync(object userState) { | |||
| base.CancelAsync(userState); | |||
| } | |||
| private bool IsLocalFileSystemWebService(string url) { | |||
| if (((url == null) | |||
| || (url == string.Empty))) { | |||
| return false; | |||
| } | |||
| System.Uri wsUri = new System.Uri(url); | |||
| if (((wsUri.Port >= 1024) | |||
| && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| /// <remarks/> | |||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] | |||
| public delegate void InsertGatheringCompletedEventHandler(object sender, InsertGatheringCompletedEventArgs e); | |||
| /// <remarks/> | |||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")] | |||
| [System.Diagnostics.DebuggerStepThroughAttribute()] | |||
| [System.ComponentModel.DesignerCategoryAttribute("code")] | |||
| public partial class InsertGatheringCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { | |||
| private object[] results; | |||
| internal InsertGatheringCompletedEventArgs(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])); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| #pragma warning restore 1591 | |||
| @ -0,0 +1,7 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |||
| <Results> | |||
| <DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://localhost:2100/WanfuSale/Service.asmx?disco" filename="Service.disco" /> | |||
| <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://localhost:2100/WanfuSale/Service.asmx?wsdl" filename="Service.wsdl" /> | |||
| </Results> | |||
| </DiscoveryClientResultsFile> | |||
| @ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/"> | |||
| <contractRef ref="http://localhost:2100/WanfuSale/Service.asmx?wsdl" docRef="http://localhost:2100/WanfuSale/Service.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" /> | |||
| <soap address="http://localhost:2100/WanfuSale/Service.asmx" xmlns:q1="http://tempuri.org/" binding="q1:ServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" /> | |||
| <soap address="http://localhost:2100/WanfuSale/Service.asmx" xmlns:q2="http://tempuri.org/" binding="q2:ServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" /> | |||
| </discovery> | |||
| @ -0,0 +1,65 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> | |||
| <wsdl:types> | |||
| <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> | |||
| <s:element name="InsertGathering"> | |||
| <s:complexType> | |||
| <s:sequence> | |||
| <s:element minOccurs="0" maxOccurs="1" name="data" type="s:string" /> | |||
| </s:sequence> | |||
| </s:complexType> | |||
| </s:element> | |||
| <s:element name="InsertGatheringResponse"> | |||
| <s:complexType> | |||
| <s:sequence> | |||
| <s:element minOccurs="0" maxOccurs="1" name="InsertGatheringResult" type="s:string" /> | |||
| </s:sequence> | |||
| </s:complexType> | |||
| </s:element> | |||
| </s:schema> | |||
| </wsdl:types> | |||
| <wsdl:message name="InsertGatheringSoapIn"> | |||
| <wsdl:part name="parameters" element="tns:InsertGathering" /> | |||
| </wsdl:message> | |||
| <wsdl:message name="InsertGatheringSoapOut"> | |||
| <wsdl:part name="parameters" element="tns:InsertGatheringResponse" /> | |||
| </wsdl:message> | |||
| <wsdl:portType name="ServiceSoap"> | |||
| <wsdl:operation name="InsertGathering"> | |||
| <wsdl:input message="tns:InsertGatheringSoapIn" /> | |||
| <wsdl:output message="tns:InsertGatheringSoapOut" /> | |||
| </wsdl:operation> | |||
| </wsdl:portType> | |||
| <wsdl:binding name="ServiceSoap" type="tns:ServiceSoap"> | |||
| <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> | |||
| <wsdl:operation name="InsertGathering"> | |||
| <soap:operation soapAction="http://tempuri.org/InsertGathering" style="document" /> | |||
| <wsdl:input> | |||
| <soap:body use="literal" /> | |||
| </wsdl:input> | |||
| <wsdl:output> | |||
| <soap:body use="literal" /> | |||
| </wsdl:output> | |||
| </wsdl:operation> | |||
| </wsdl:binding> | |||
| <wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap"> | |||
| <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> | |||
| <wsdl:operation name="InsertGathering"> | |||
| <soap12:operation soapAction="http://tempuri.org/InsertGathering" style="document" /> | |||
| <wsdl:input> | |||
| <soap12:body use="literal" /> | |||
| </wsdl:input> | |||
| <wsdl:output> | |||
| <soap12:body use="literal" /> | |||
| </wsdl:output> | |||
| </wsdl:operation> | |||
| </wsdl:binding> | |||
| <wsdl:service name="Service"> | |||
| <wsdl:port name="ServiceSoap" binding="tns:ServiceSoap"> | |||
| <soap:address location="http://localhost:2100/WanfuSale/Service.asmx" /> | |||
| </wsdl:port> | |||
| <wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12"> | |||
| <soap12:address location="http://localhost:2100/WanfuSale/Service.asmx" /> | |||
| </wsdl:port> | |||
| </wsdl:service> | |||
| </wsdl:definitions> | |||
| @ -0,0 +1,15 @@ | |||
| <?xml version="1.0"?> | |||
| <configuration> | |||
| <configSections> | |||
| <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <section name="Test.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> | |||
| </sectionGroup> | |||
| </configSections> | |||
| <applicationSettings> | |||
| <Test.Properties.Settings> | |||
| <setting name="Test_webservice_Service" serializeAs="String"> | |||
| <value>http://localhost:2100/WanfuSale/Service.asmx</value> | |||
| </setting> | |||
| </Test.Properties.Settings> | |||
| </applicationSettings> | |||
| <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> | |||
| @ -0,0 +1,27 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Web; | |||
| using System.Web.Services; | |||
| using RpcHelper; | |||
| [WebService(Namespace = "http://tempuri.org/")] | |||
| [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] | |||
| // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。 | |||
| // [System.Web.Script.Services.ScriptService] | |||
| public class Service : System.Web.Services.WebService | |||
| { | |||
| public Service () { | |||
| //如果使用设计的组件,请取消注释以下行 | |||
| //InitializeComponent(); | |||
| } | |||
| [WebMethod] | |||
| public string InsertGathering(string data) { | |||
| var result = RpcHelperUtil.InsertGathering(data); | |||
| return result; | |||
| } | |||
| } | |||
| @ -0,0 +1 @@ | |||
| <%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" Class="Service" %> | |||
| @ -0,0 +1,49 @@ | |||
| <?xml version="1.0"?> | |||
| <!-- | |||
| 注意: 除了手动编辑此文件外,您还可以使用 | |||
| Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的 | |||
| “网站”->“Asp.Net 配置”选项。 | |||
| 设置和注释的完整列表可以在 | |||
| machine.config.comments 中找到,该文件通常位于 | |||
| \Windows\Microsoft.Net\Framework\vx.x\Config 中 | |||
| --> | |||
| <configuration> | |||
| <appSettings> | |||
| <add key="url" value="http://localhost:2100/MainSystem/"/> | |||
| <add key="username" value="system"/> | |||
| <add key="pwd" value=""/> | |||
| </appSettings> | |||
| <connectionStrings/> | |||
| <system.web> | |||
| <!-- | |||
| 设置 compilation debug="true" 可将调试符号插入到 | |||
| 已编译的页面。由于这会 | |||
| 影响性能,因此请仅在开发过程中将此值 | |||
| 设置为 true。 | |||
| --> | |||
| <compilation debug="true" targetFramework="4.0"/> | |||
| <!-- | |||
| 通过 <authentication> 节可以配置 | |||
| 安全身份验证模式,ASP.NET | |||
| 使用该模式来识别来访用户身份。 | |||
| --> | |||
| <authentication mode="Windows"/> | |||
| <!-- | |||
| 如果在执行请求的过程中出现未处理的错误, | |||
| 则通过 <customErrors> 节 | |||
| 可以配置相应的处理步骤。具体而言, | |||
| 开发人员通过该节可配置要显示的 html 错误页, | |||
| 以代替错误堆栈跟踪。 | |||
| <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> | |||
| <error statusCode="403" redirect="NoAccess.htm" /> | |||
| <error statusCode="404" redirect="FileNotFound.htm" /> | |||
| </customErrors> | |||
| --> | |||
| <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> | |||
| </system.web> | |||
| <!-- | |||
| The system.webServer section is required for running ASP.NET AJAX under Internet | |||
| Information Services 7.0. It is not necessary for previous version of IIS. | |||
| --> | |||
| </configuration> | |||