Pcct000 2013-07-25 05:25
浏览 1678

.NET发布的webservice方法,怎样在返回 soap 格式的数据中中,去掉方法名节点


方法发布格式:
[WebService(Namespace = "http://service.ws.ordertracer.lefeng.com")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ITracerService : System.Web.Services.WebService
{
[WebMethod]
public void itrance(ref lefeng lefeng)
{...}
}

结果格式如下:

《?xml version="1.0" encoding="utf-8"?》
《soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"》
《soap:Body》
《itrance xmlns="http://service.ws.ordertracer.lefeng.com"》
《lefeng》
《agent id="string" xmlns="http://vo.ws.ordertracer.lefeng.com"》
《name》string《/name》
《phone》string《/phone》
《website》string《/website》
《/agent》
《orders size="int" xmlns="http://vo.ws.ordertracer.lefeng.com"》
《order》
《sponsorId》string《/sponsorId》
《orderNum》string《/orderNum》
《routes xsi:nil="true" /》
《/order》
《order》
《sponsorId》string《/sponsorId》
《orderNum》string《/orderNum》
《routes xsi:nil="true" /》
《/order》
《/orders》
《/lefeng》
《/itrance》
《/soap:Body》
《/soap:Envelope》

因为soap 的 body 里多了一个调用方法名节点
《itrance xmlns="http://service.ws.ordertracer.lefeng.com"》
对方要求格式,去掉 《itrance》《/itrance》 节点
下面是要求的格式:

《?xml version="1.0" encoding="utf-8"?》
《soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"》
《soap:Body》
《lefeng》
《agent id="string" xmlns="http://vo.ws.ordertracer.lefeng.com"》
《name》string《/name》
《phone》string《/phone》
《website》string《/website》
《/agent》
《orders size="int" xmlns="http://vo.ws.ordertracer.lefeng.com"》
《order》
《sponsorId》string《/sponsorId》
《orderNum》string《/orderNum》
《routes xsi:nil="true" /》
《/order》
《order》
《sponsorId》string《/sponsorId》
《orderNum》string《/orderNum》
《routes xsi:nil="true" /》
《/order》
《/orders》
《/lefeng》
《/soap:Body》
《/soap:Envelope》

《Body》《Envelope》节点返回都是自生成的,我的方法写入是从《lefeng》《/lefeng》开始写的

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥15 stable diffusion
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘