c#调用ws接口问题

YH我就是我 2017-07-09 11:42:19
接口
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ewel="xxx">
<soapenv:Header/>
<soapenv:Body>
<ewel:BS05007>
<ewel:input>?</ewel:input>
</ewel:BS05007>
</soapenv:Body>
</soapenv:Envelope>

soapui 测试
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<NS1:BS05007Response xmlns:NS1="xxx">
<NS1:output>
<response>
<errorCode>1</errorCode>
<errorMsg>请验证传入参数</errorMsg>
</response>
</NS1:output>
</NS1:BS05007Response>
</soapenv:Body>
</soapenv:Envelope>

vs添加web引用
public class Class1
{
WebReference.Ewell_S50HttpService service = new WebReference.Ewell_S50HttpService();
public string aaa(string xml) {
WebReference.BS05007 bs=new WebReference.BS05007();
bs.input=xml;
String ss= service.BS05007(bs).output;//这一步直接报错
return ss;
}
}
//调用
ClassLibrary1.Class1 cl = new ClassLibrary1.Class1();
var a = cl.aaa(c);
报错信息:
public class Class1
{
WebReference.Ewell_S50HttpService service = new WebReference.Ewell_S50HttpService();
public string aaa(string xml) {
WebReference.BS05007 bs=new WebReference.BS05007();
bs.input=xml;
String ss= service.BS05007(bs).output;
return ss;
}
}

第二种调用
public class S50Help
{


S50.Ewell_S50Client client = null;
public string sendbs5007(string xml)
{

client = new S50.Ewell_S50Client(new BasicHttpBinding(), new EndpointAddress("xxxx"));

S50.BS05007 bs5007 = new S50.BS05007();
bs5007.input = xml;
XmlDocument doc=new XmlDocument();
var aa=client.BS05007(bs5007).output;
doc.LoadXml(aa.ToString());
return doc.ToString();
}
}
//调用
Ewell_S50_Services.S50Help h = new Ewell_S50_Services.S50Help();
var s= h.sendbs5007(c);
“System.ServiceModel.CommunicationException”类型的第一次机会异常在 mscorlib.dll 中发生

其他信息: 对操作“BS05007”的回复消息正文进行反序列化时出错。
...全文
982 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_32684401 2020-12-10
  • 打赏
  • 举报
回复
ewel没打全
XBodhi. 2017-07-10
  • 打赏
  • 举报
回复
Web 引用正常代理类是没有任何问题的,是否可以提供debug 信息。
YH我就是我 2017-07-10
  • 打赏
  • 举报
回复
网上看到的都是设置maxStringContentLength 长度,我也设置也还是不行
YH我就是我 2017-07-10
  • 打赏
  • 举报
回复
我是直接通过vs直接调用的
YH我就是我 2017-07-10
  • 打赏
  • 举报
回复
YH我就是我 2017-07-09
  • 打赏
  • 举报
回复
那位大佬帮忙看看那里出的问题,我是直接通过vs引用的web服务,就是不成功 直接执行到方法那里就是把

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧