如何在同一WCF Web服务中创建SOAP,REST? [英] How to create SOAP , REST in same WCF webservice ?

查看:139
本文介绍了如何在同一WCF Web服务中创建SOAP,REST?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

根据客户要求,我们必须在同一个Web服务中同时生成SOAP,REST(JSON,XML)输出,以便将来在Android,iPhone应用程序等中进行扩展.

1)那么是否有可能在WCF中创建提供给我们SOAP&的Web服务? REST服务?

2)也可以在不使用WebGet属性的情况下创建REST服务吗?

3)另外,如果我想使用Property&同一个类中的方法然后如何使用它.
我只想为接口而不是属性保留单独的类.
另外,我们在get,set之前尝试了[OperationContract].它解决了我们的问题,但是在构建.svc文件时抛出了错误.

4)是否还可以在REST服务的URL中传递对象?如果是,那怎么办?否则我们如何传递整个entityclass?

我们相信还有更多问题,但请给我答复.

问候,
WCF Beginner

Hello ,

According to client requirement , we have to generate both SOAP, REST (JSON , XML )output in same webservice for future expansion in Android , iPhone Applications etc.

1) So Is it possible to create webservice in WCF which give us both SOAP & REST Services ?

2) Also is it possbile to create REST Service without use of WebGet Attribute ??

3) Also if i want to use Property & Method in same class then how to use it.
I want to keep separate class only for interface , not for property.
Also we have tried with [OperationContract] before get ,set . it solved our issue but throws error while build a .svc file .

4) Also is it possible to pass object in URL for REST Services ? If yes then how ? otherwise How we pass whole entityclass ?

We believe there are more questions but plz give answer.

Regards,
WCF Beginner

推荐答案

1) WebGetAttribute类 [ WebInvokeAttribute类 [
1) Massive amount of informatio available[^]
- the answer is yes.

2) WebGetAttribute Class[^] - answer is given in the first few lines. You can also use the WebInvokeAttribute Class[^]

3) Methods only

4) serialize and base64 encode - probably not a good idea though

Regards
Espen Harlinn


这篇关于如何在同一WCF Web服务中创建SOAP,REST?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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