我有一个方法作为帖子
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "UpdateCheckListParagraphs", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Boolean UpdateCheckListParagraphs( Stream Result);//
我通过 c# 得到请求,但通过 android 我得到 "Type="System.ServiceModel.Channels.NullMessage" "
web.config
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="default" />
</webHttpBinding>
</bindings>
<services>
<service name="spcWcfService.Testit" behaviorConfiguration="TestitBehaviors">
<endpoint binding="webHttpBinding" indingNamespace="http://mnet.co.il/spcWcfService.svc" contract="spcWcfService.ITestit" behaviorConfiguration="GetEndpointBehavior">
</endpoint>
<endpoint name="mexHttpBinding" address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="GetEndpointBehavior">
<webHttp helpEnabled="true" automaticFormatSelectionEnabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="TestitBehaviors">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
安卓调用
public String postGetJson2(String dataToSend, String serviceUri) {
// Log.d("dataToSend", dataToSend);
StringEntity entity = null;
HttpPost httpPost = new HttpPost(serviceUri);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
httpPost.setHeader("Accept-Charset", "UTF-8");
String result = null;
try {
if (dataToSend != null) {
entity = new StringEntity(dataToSend, "UTF-8");
httpPost.setEntity(entity);
}
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpResponse response = null;
try {
response = httpClient.execute(httpPost);
result = EntityUtils.toString(response.getEntity());
} finally {
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
return result;
谁能帮我?请...