简体   繁体   English

在C#中使用PHP nuSOAP webservice

[英]Using PHP nuSOAP webservice in C#

I am working on windows phone project in visual studio 2012 for windows phone. 我正在为visual phone 2012 for windows phone工作windows phone项目。 I am trying use PHP NuSOAP webservice by adding Service reference . 我正在尝试通过添加Service reference使用PHP NuSOAP webservice。

Here I followed this sample app. 在这里,我关注了这个示例应用 In general the VS will create Reference.cs file while adding webservice. 通常,VS将在添加webservice时创建Reference.cs文件。 You can see reference.cs file contents of dictionary(Sample) app HERE 你可以看到reference.cs文件字典的内容(样本)应用HERE

The Reference.cs of my webservice of my project HERE . 我的项目的web服务的Reference.cs这里 In my Reference.cs file the interface SomeMobileServicePortType is empty. 在我的Reference.cs文件中, SomeMobileServicePortType接口为空。

In Line 19. 在第19行。

public interface SomeMobileServicePortType {
}

Because of this I not getting any methods of webservice to access in my project. 因此,我没有获得任何webservice方法来访问我的项目。 But while adding reference in Add service Refernce dialogue it is showing the methods contains in PHP NuSOAP webservice. 但是在Add service Refernce dialogueAdd service Refernce dialogue引用时,它显示了PHP NuSOAP webservice中包含的方法。

I created new instance of webservice class.. 我创建了webservice类的新实例..

     ServiceReference1.SomeMobileServicePortTypeClient client = new ServiceReference1.SomeMobileServicePortTypeClient();

What is the wrong with PHP webservice. PHP webservice有什么问题。 I tried some more webservices [in particular asmx, I didn't get any sample PHP NuSOAP webservice to try] which are working fine. 我尝试了一些更多的webservices [特别是asmx,我没有得到任何示例PHP NuSOAP webservice来试试]哪些工作正常。 Can any one tell me How to use PHP NuSOAP service using C#. 任何人都可以告诉我如何使用C#使用PHP NuSOAP服务。

================================================================================== ================================================== ================================

Edit: 编辑:

We are using NuSOAP PHP webservice. 我们正在使用NuSOAP PHP webservice。

I believe that there is no problem with Webservice. 我相信Webservice没有问题。 I can't share the WSDL file right now. 我现在无法共享WSDL文件。

Here I got the sample that explains using PHP NuSOAP in C#. 在这里,我得到了在C#中使用PHP NuSOAP解释的示例。 I tried with this webservice link. 我试过这个 webservice链接。 This reference also not giving any methods. 这个参考也没有给出任何方法。 The interface is empty like this. 这样的界面是空的。

 public interface HirdWebExamplePortType {    }

So my guess is while using NuSOAP service it is not working in IDE Visual Studio. 所以我的猜测是在使用NuSOAP服务时,它无法在IDE Visual Studio中运行。 Here is my sample windows phone project. 是我的示例Windows Phone项目。 Please try this & suggest me what I am doing wrong. 请试试这个并建议我做错了什么。

The project you supplied is not compatible with this kind of SOAP-Service. 您提供的项目与此类SOAP服务不兼容。

If you add the service to eg a Console App it works fine: 如果您将服务添加到例如控制台应用程序,它可以正常工作: 在此输入图像描述

but if you add it to your project (WP Silverlight): 但如果将其添加到项目中(WP Silverlight):
在此输入图像描述

Check if you can disable SOAP encoding on your service. 检查您是否可以在服务上禁用SOAP编码。

It does support RPC/Literal soap style so we need to change the style from RPC/encoded to RPC/literal. 它支持RPC / Literal soap样式,因此我们需要将样式从RPC / encoded更改为RPC / literal。 This is actually really easy: Open the wsdl file and modify the input and output operations from 这实际上非常简单:打开wsdl文件并修改输入和输出操作

<soap:body use="encoded" ..../>

to

<soap:body use="literal" ..../>

Reference: Just go through the below link: 参考:只需浏览以下链接:

http://guruce.com/blogpost/hosting-webservices-on-wec-using-gsoap-windows-phone-75-mango-client-application#comments http://guruce.com/blogpost/hosting-webservices-on-wec-using-gsoap-windows-phone-75-mango-client-application#comments

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

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