通过浏览器调用WCF服务方法 [英] Invoking WCF service method through a browser

查看:39
本文介绍了通过浏览器调用WCF服务方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用基本 http 绑定的 WCF 服务.如何通过浏览器调用其操作/方法?

I've a WCF service which uses basic http binding. How do I invoke its operations/methods through a browser?

推荐答案

我建议为服务设置多个端点.使用 webHttpBinding 添加端点以获取服务的 XML 版本.如果正确执行此操作,您将从服务获得的响应与 basicHttpBinding 端点相同,但没有 SOAP 开销.

I would recommend setting up multiple endpoints for the Service. Add an endpoint using webHttpBinding to get an XML version of the service. If this is done correctly the response you will get from the service is identical to the basicHttpBinding endpoint, but without the SOAP overhead.

除此之外,您不能直接从浏览器调用 SOAP Web 服务,因为它需要表单发布.不过,您可以使用工具来使用 SOAP 对其进行测试,我建议使用 Soap UI.它是用 Java 编写的,但我尽量不反对它.:)

Other than that, you can't call a SOAP web service directly from the browser because it requires a form post. You could use a tool to test it using SOAP though, I recommend Soap UI. Its written in Java but I try not to hold that against it. :)

这篇关于通过浏览器调用WCF服务方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆