【发布时间】:2014-04-08 15:50:35
【问题描述】:
我从一个 WSDL 文件开始,并使用“添加服务引用”功能来生成代理类。服务器是 Java/Axis。
我正在使用以下代码:
MyServiceClient c = new MyServiceClient();
c.getVersionStringCompleted += new EventHandler<getVersionStringCompletedEventArgs>(MyCallBack);
var r = new getVersionStringRequest { };
c.getVersionStringAsync(r);
我的Callback其实很简单,一开始就是验证设置是否OK。
static void MyCallBack(object sender, getVersionStringCompletedEventArgs e) {
Console.WriteLine("result {0}", e.ToString());
}
端点取自 WSDL。
服务器响应请求中没有正文。
我的代码有什么问题?我正在运行 Visual Studio 2013。
访问服务的正确方法是什么?
我不确定是否需要,但是我在这里添加我的 conf 文件:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyServiceSoapBinding" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://135.99.14.73:8081/axis/services/MyService"
binding="basicHttpBinding" bindingConfiguration="MyServiceSoapBinding"
contract="LoginReference.MyService" name="MyService" />
</client>
</system.serviceModel>
</configuration>
【问题讨论】:
-
当您说服务器响应请求中没有正文时,您究竟是什么意思?它是否返回带有 500 错误代码的故障?
-
另外,仅供参考,WSDL 中的端点仅作为提示。它可能不是实时服务的端点。
-
@JohnSaunders 它返回 500 并且端点 URI 是正确的
-
同步尝试webservice调用是否有效?
-
Reference.cs 文件中没有同步方法
标签: c# .net wcf windows-phone-8