我想通过Android调用web服务.我需要通过HTTP将一些XML发布到URL.我发现这是剪辑发送POST,但我不知道如何包含/添加XML数据本身.
public void postData() {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://10.10.4.35:53011/");
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("Content-Type", "application/soap+xml"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Where/how to add the XML data?
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
}
Run Code Online (Sandbox Code Playgroud)
这是我需要模仿的完整POST消息:
POST /a8103e90-f1e3-11dd-bfdb-8b1fcff1a110 …Run Code Online (Sandbox Code Playgroud) 我有一个奇怪的,恼人的Python 2.6问题.我正在尝试在我的嵌入式Linux ARM板上运行此文件(和另一个). http://svn.tuxisalive.com/software_suite_v3/smart-core/smart-server/trunk/TDSService.py
我收到此错误:
文件"tuxhttpserver.py",第1行语法错误:编码问题:带BOM
我知道错误是关于BOM字节等等.但是,没有BOM字节,它是简单的Ascii.我用Hexeditor检查,linux File命令说它的Ascii.
我在这里吓坏了...代码在我的Sheevaplug(也是一个基于ARM的系统)上运行良好.
当我尝试传递这样的公共变量的地址时:
ML.Register("Radius", &lBeacons[i].Radius, 0.0f, 200.0f, 10.0f);
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
Run Code Online (Sandbox Code Playgroud)
Register函数如下所示:
public unsafe void Register(string desc, float* val, float minimum, float maximum, float stepsize)
Run Code Online (Sandbox Code Playgroud)
信标是一个列表.它拥有一个具有公共半径的类.