Web 服务包含附加字符串标记 [英] Web service contains additional string tag

查看:38
本文介绍了Web 服务包含附加字符串标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到如下 Web 服务响应.它在响应中有额外的 XML 标记和字符串标记.我无法将此响应加载到 Dot Net 中的 XMLDocument 对象中.我已经要求网络服务提供商在发送响应之前删除这些标签.但他们说这是网络服务标准.网络服务是如何发送响应的?

I am getting a web service response as below. It has additional XML tag and string tag in the response. I was not able to load this response into XMLDocument object in Dot Net. I have asked web service provider to remove those tags before sending response. But they said that this is the web service standard. Is it how web service suppose send the response?

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/"><?xml version="1.0" encoding="UTF-8"?><?ACORD version="1.7.0"?>
<ACORD><InsuranceSvcRs></InsuranceSvcRs></ACORD></string>

这是调用网络服务的代码

Here is the code that calls web service

using (var webClient = new WebClient())
{
    webClient.Credentials = Credentials;
    byte[] responseArray;

    NameValueCollection postValues = GetParameters();
    responseArray = webClient.UploadValues(GetUploadURL(), "POST", postValues);
    responseString = Encoding.ASCII.GetString(responseArray);
}

由于我使用的是 WebClient(不是 Web 服务代理),Web 客户端类是否像这样格式化响应?

Since I am using WebClient (not web service proxy), does web client class format the response like this?

当我用上面的代码尝试使用示例 HelloWorld 网络服务时,我得到了这样的响应

When I tried with sample HelloWorld webservice with the above code, I got the response like this

<?xml version=\"1.0\" encoding=\"utf-8\"?><string xmlns=\"http://tempuri.org/\">Hello World</string>

话虽如此,我正在重申我的问题,当客户端代理 POST 到网络服务时,网络服务如何假设发送响应?

Having said that, I am repharasing my question Is it how webservice suppose send the response, when client proxy POST to the webservice?

推荐答案

他们说这是网络服务标准

they said that this is the web service standard

我只能建议您更换服务提供商:-)

All that I could recommend you is switching service provider :-)

如果您不这样做,除非您的服务提供商没有为您提供能够解析此标准的 API,否则漫长而痛苦的字符串操作正在等待着您.

If you don't, long and painful string manipulation is awaiting you unless your service provider doesn't provide you with an API capable of parsing this standard.

这篇关于Web 服务包含附加字符串标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆