【发布时间】:2018-05-15 07:31:06
【问题描述】:
我遇到了一个问题,即我获取 XML 标记而不是仅获取值。
所以我的页面发送了 2 个数字,15 和 10 并且网络服务返回这个:
<?xml version="1.0" encoding="utf-8"?>
<int xmlns="http://tempuri.org/">25</int>
我不确定我是否在 Web 服务端或链接中遗漏了某些内容。
我只需要它返回 25 而不是整个
链接按钮调用添加函数:
http://localhost/TestService/Service1.asmx/Add
测试服务
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace TestsSimpleService
{
//[WebService(Namespace = "http://tempuri.org/")]
[WebService()]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public int Add(int a, int b)
{
return (a + b);
}
}
}
【问题讨论】:
标签: asp.net web-services