我正在尝试使用 C# 中的 PHP SOAP 服务并在 VS 2010 中创建类包装器
我的任务是为 SOAP 服务创建一个类包装器,其想法是您将能够将其视为常规类。造成这种情况的主要原因是 SOAP 服务的 WDSL 仅包含一个方法,并且有 5 个参数,而且它只是一种 OO,因此您必须非常了解所有方法调用,并且将它们全部记住有点困难。
好的,所以我尝试添加 Web 引用,现在 Web 引用现在可以在 VS 2010 中添加为服务引用。您单击添加服务引用高级等,它会放入服务引用。伟大的。不幸的是,如果我尝试从课堂上访问它,我就做不到。
我可以构建一个控制台应用程序并将代码放入主过程中并可以很好地访问 SOAP 服务的方法,但是当我添加对类库的引用时,智能感知将不允许我选择任何内容。我会像这样实例化一个实例:
SOAPService.webServiceService ws = new SOAPService.webserviceService();
ws.
然后智能感知拒绝启动。如果我在网络项目或控制台应用程序中执行相同的操作,那么我可以正常访问它。我已经添加了命名空间,我已经做了各种各样的事情。此外,每当我创建 Web 项目时,我都可以添加 Web 引用并获取 DISCO 文件。
好的,当我讨论这个主题时,我还需要将凭据传递给 PHP 中的 Web 服务。
问题是,在过去,我会创建一些 .net 系统凭据并添加这些凭据,如果我连接到另一个 .net 服务,它通常会通过。
我应该如何将它们发送到 PHP Web 服务?我总是收到无效的用户名/密码组合错误或信封格式错误的错误类型
谢谢 B先生
I've been tasked with creating a class wrapper for a SOAP service, the idea is that you'll be able to treat it as a regular class. The main reason for this is that the WDSL for the SOAP service contains only one method and it's got 5 parameters and it's only kind of OO so you'd have to know all the method calls really well and it's a bit hard to remember them all.
OK, so I've tried adding a web reference, now web references can now be added as service references in VS 2010. You click add service reference advanced etc and it puts in a service reference. Great. Unfortunately if I try and access this from a class I can't.
I can build a console app and put code in the main procedure and access the method of the SOAP service fine but when I add a reference to a class library the intellisense won't allow me to select anything. I'd instantiate an instance like so:
SOAPService.webServiceService ws = new SOAPService.webserviceService();
ws.
and then the intellisense refuses to kick in. If I do the same in a web project or a console app then I can access it fine. I've added the namespace I've done all kinds of things. Also, I can add a web reference and get a DISCO file whenever I create a web project.
OK, also while I'm on the subject I also need to pass credentials to the web service in PHP.
The problem is that in the past I'd create some .net system credentials and add these and it would usually pass through if I was connecting to another .net service.
How should I be sending them to a PHP web service? I always get either invalid username/password combo errors or envelope malformatted error types
Thanks
Mr. B
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以智能感知不起作用,但是如果您添加该方法并尝试使用它,它会起作用还是会产生错误?
关于诊断身份验证问题,请尝试使用 fiddler 查看正在发送的 SOAP 消息并查看回复。您是否有其他软件可以连接并验证该服务?使用 fiddler 查看 SOAP 消息并比较它们以查看标头是否不同等。
我通常会这样做,
另外关于服务是否正常工作,如果您有任何问题,可以使用 fiddler查看 SOAP 消息,它通常会为您提供更清晰的消息。
我知道在 IIS 中,您可以打开失败的请求处理,这也可以让您了解服务器端发生的情况,也许您的 php 服务也有某种形式的日志记录?
So the intellisense is not working, but if you add the method in and try to use it does it work, or produce an error?
With regard to diagnosing authentication issues try using fiddler to view the SOAP messages that are being sent, and to view the reply. Do you have some other software that connects and authenticates to that service? Use fiddler to look at the SOAP messages and compare them to see if the header is different etc.
I'd normally do it like this,
Also with regard to the service working or not in general use fiddler if you have any problems, you can see the SOAP messages and it often gives you a clearer message.
I know in IIS you can turn on failed request handling that also gives you an insight from what is going on at the server end, perhaps you have some form of logging too for your php service?