JSON 데이터 구조를 제공하는 WCF Rest Service 프로젝트를 설정했습니다. WCF REST 서비스에서 비 JSON, 비 XML 데이터 반환
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "location/{id}")]
Location GetLocation(string id);
지금 WebService에 표준 웹 서버가하는 것처럼 멀티미디어 (이미지, PDF 문서) 문서를 반환해야 : I는 인터페이스 파일과 같은에서 계약을 정의했습니다.
ResponseFormat
의 WCF
WebMessageFormat
은 JSON 또는 XML 만 지원합니다. 어떻게 파일을 반환하는 인터페이스의 메서드를 정의합니까?
뭔가 같은 : 그래서
[OperationContract]
[WebInvoke(Method="GET",
ResponseFormat = ?????
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "multimedia/{id}")]
???? GetMultimedia(string id);
그 아래 그림과 같이 당신은 당신의 RESTful 서비스에서 파일을 얻을 수있는 ID (10)
이것 좀보세요 : http://stackoverflow.com/questions/2992095/attaching-files-to-wcf-rest-service-responses – pdiddy
감사합니다. 문제가 해결되어 흥미로운 추가 정보가 포함되어 있습니다. – Pierre