简体   繁体   English

空肥皂:从Windows Phone 8调用Web服务时出现body

[英]Empty soap:body when calling a web service from windows phone 8

I started from a WSDL file and I used the "Add Service Reference" capability to generate proxy classes. 我从WSDL文件开始,并使用“添加服务引用”功能来生成代理类。 The server is Java/Axis. 服务器是Java / Axis。

I am using the following code: 我正在使用以下代码:

MyServiceClient c = new MyServiceClient();
c.getVersionStringCompleted += new EventHandler<getVersionStringCompletedEventArgs>(MyCallBack);
var r = new getVersionStringRequest { };
c.getVersionStringAsync(r);

My Callback is really simple, just to verify at the beginning that the setup is OK. 我的回叫非常简单,只需在开始时确认设置即可。

static void MyCallBack(object sender, getVersionStringCompletedEventArgs e) {
            Console.WriteLine("result {0}", e.ToString());
}

The endpoint is taken from the WSDL. 端点取自WSDL。

The server responds that there is no Body in the request. 服务器响应,请求中没有正文。

What is wrong with my code? 我的代码有什么问题? I am running Visual Studio 2013. 我正在运行Visual Studio 2013。

What is the correct way to access the service? 访问服务的正确方法是什么?

I am not sure if it needed however I am adding my conf file here: 我不确定是否需要,但是我在这里添加了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>

Try to use synchronous methods: 尝试使用同步方法:

ChannelFactory<LoginReference.MyService> myChannelFactory = new ChannelFactory<LoginReference.MyService>("MyService");

// Create a channel.
LoginReference.MyService wcfClient1 = myChannelFactory.CreateChannel();
string s = wcfClient1.getVersionString();
Console.WriteLine(s);
((IClientChannel)wcfClient1).Close();

Do you have access to the service log? 您可以访问服务日志吗? What does it say? 它说什么?

What does WCF test client tool say? WCF测试客户端工具怎么说? Did you try to reach the service via Fiddler? 您是否尝试通过Fiddler获得服务?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM