0
json 문자열을 내 wcf 서비스에 게시하려고합니다. 문제는 내 WCF 메서드는 JSON이 아니라 Stream 개체를 기대한다는 것입니다.Apache HTTP 클라이언트로 WCF에 스트림 데이터를 게시합니다.
HttpPost request = new HttpPost(SERVICE_URI + uri);
InputStream is = new ByteArrayInputStream(data.getBytes());
InputStreamEntity ise = new InputStreamEntity(is, data.getBytes().length);
ise.setContentType("application/x-www-form-urlencoded");
ise.setContentEncoding(HTTP.UTF_8);
request.setEntity(ise);
HttpResponse response = null;
try {
response = client.execute(request);
} catch (ClientProtocolException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
나는이 400 잘못된 요청을 얻고 모든 다른 필자 시도 :
여기[WebInvoke(Method = "POST", UriTemplate = "person/delete", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Person DeletePerson(Stream streamdata)
내가 노력 해왔다 것입니다 : 여기
는 WCF의 방법 헤더입니다. 누군가가 나를 도와 줄 수 있을까요? 또한 HttpClient와 함께 작동하는 사용자 정의 인증 코드가 있기 때문에 HttpClient를 사용해야합니다.