我正在尝试使用HttpUrlConnection从Android应用程序发出WebService请求.但有时它会起作用,有时则不起作用.
当我尝试发送此值时:
JSON值
{"Calle":"Calle Pérez 105","DetalleDireccion":"","HoraPartida":"May 18, 2014 9:17:10 AM","Numero":0,"PuntoPartidaLat":18.477295994621315,"PuntoPartidaLon":-69.93638522922993,"Sector":"Main Sector"}
Run Code Online (Sandbox Code Playgroud)
我在DataOutputStream关闭函数中遇到了"意外的流结束"异常.
这是我的代码:
DataOutputStream printout;
// String json;
byte[] bytes;
DataInputStream input;
URL serverUrl = null;
try {
serverUrl = new URL(Config.APP_SERVER_URL + URL);
} catch (MalformedURLException e) {
...
}
bytes = json.getBytes();
try {
httpCon = (HttpURLConnection) serverUrl.openConnection();
httpCon.setDoOutput(true);
httpCon.setUseCaches(false);
httpCon.setFixedLengthStreamingMode(bytes.length);
httpCon.setRequestProperty("Authorization", tokenType + " "+ accessToken);
httpCon.setRequestMethod("POST");
httpCon.setRequestProperty("Content-Type", "application/json");
printout = new DataOutputStream(httpCon.getOutputStream());
printout.writeBytes(json);
printout.flush();
printout.close();
...
}
Run Code Online (Sandbox Code Playgroud) 在实体框架中实现空间类型(System.Data.Spatial.DBGeometry)之前,我们可以使用"Microsoft.SqlServer.Types.SqlGeometry"来处理缺少空间支持.该库具有类SqlGeometryBuilder,用于根据不同的几何点创建SqlGeometry.
我决定从SqlGeometry继续到DBGeometry,但我找不到任何与SqlGeometryBuilder过去相同的函数.你知道这有什么功能吗?或者你知道它是否会包含在下一个版本中吗?
提前致谢.
我有一个表单,当它进行不引人注意的验证时,我希望它显示:
此消息:"请输入值. "
而不是这条消息:"此字段是必需的."
我尝试在我的jquery.validate.unobtrusive.js文件的末尾添加它
(function ($) {
$.extend($.validator.messages, {
required: "Please enter a value."
});
}(jQuery));
Run Code Online (Sandbox Code Playgroud)
但它只是不起作用.
我也尝试直接修改jquery.validate.js文件中的"messages"变量,但它也无法正常工作.
你能告诉我怎样才能完成这件事?
我正在尝试应用此问题中提出的解决方案:在nunit测试中使用connectionstring,但似乎无法在新Framework 4.5中找到ConnectionStringSettings和ConfigurationManager对象。
我添加了命名空间:System.Configuration。凡acording 微软文档应该是。但是Visual Studio仍然找不到它。
这里有人可以帮我吗?
c# ×2
android ×1
asp.net-mvc ×1
java ×1
jquery ×1
nunit ×1
spatial ×1
sqlgeography ×1
validation ×1