| 发表于:2007-05-12 18:58:21 楼主 |
请问我要给服务器发送一个xml 我希望服务器可以解析出我之中带的参数 例如id 然后通过sql语句查询数据库 最后返回 给客户端 一个xml 这个xml我要怎么传过去 我这么写的 不知道行不行 httpconnection httpconnection = (httpconnection) connector .open( "http://127.0.0.1:8080/jinboservlet "); httpconnection.setrequestmethod(httpconnection.post); dataoutputstream dos = null; string textxml = null; textxml = " <?xml version = '1.0 ' encoding = 'utf-8 '?> "; textxml = textxml+ " <courses> "; textxml = textxml + " <id> aaa </id> " + " <name> bbb </name> " + " <author> ccc </author> " + " <price> ddd </price> "+ " <weight> sasa </weight> "+ " <date> fdfds </date> "; textxml = textxml + " </courses> "; byte[] ss = textxml.getbytes(); dos.write(ss); dos.flush(); |
|
|
|
|