50,344
社区成员




<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Client</faultcode>
<faultstring>Couldn't create SOAP message due to exception: unexpected XML tag. expected: {http://schemas.xmlsoap.org/soap/envelope/}Envelope but found: {null}record
</faultstring>
</S:Fault>
</S:Body>
</S:Envelope>
xml字符串是肯定没有问题的,这里就不贴了,然后下面是测试代码:public static JSONObject tesxt(Entity entity) throws Exception{
HttpClient client = HttpClients.createDefault();
HttpPost post = new HttpPost(url);
post.setHeader("Content-Type", "text/xml;charset=utf-8");
StringEntity se = new StringEntity(XmlUtil.getXmlString(entity),"utf-8");
post.setEntity(se);
HttpResponse re = client.execute(post);
HttpEntity httpEntity = re.getEntity();
String str = EntityUtils.toString(httpEntity, "utf-8");
System.out.println(str);
return null;
}
在网上查了很久,也不知道是为什么,就说是服务端的问题....请大神看到指点一下.....非常感谢....