public static void MakeThumbnail(byte[] ImageCount, String thumbnailPath, int width, int height, String mode, String rename, String format) throws Exception {
URL wsUrl = new URL(URL);
HttpURLConnection conn = (HttpURLConnection) wsUrl.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/xml;charset=UTF-8");
OutputStream os = conn.getOutputStream();
// 请求体
String soap = "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ "<soap:Body>"
+ "<MakeThumbnail xmlns=\"http://www.520shq.com/\">"
+ "<ImageCount>"
+ ImageCount
+ "</ImageCount>"
+ "<thumbnailPath>"
+ thumbnailPath
+ "</thumbnailPath>"
+ "<width>"
+ width
+ "</width>"
+ "<height>"
+ height
+ "</height>"
+ "<mode>"
+ mode
+ "</mode>"
+ "<rename>"
+ rename
+ "</rename>"
+ "<format>"
+ format
+ "</format>"
+ "</MakeThumbnail>"
+ "</soap:Body></soap:Envelope>";
os.write(soap.getBytes());
InputStream is = conn.getInputStream();
byte[] b = new byte[1024];
int len = 0;
String xml = "";
while ((len = is.read(b)) != -1) {
xml += new String(b, 0, len, "UTF-8");
}
is.close();
os.close();
conn.disconnect();
我只要传递byte[] 就会报400 求大神帮帮忙!