我做了一个Servlet,它应该在post请求中接收包含XML数据的字符串,字符串就像这样发送
<?xml version="1.0" encoding="UTF-8"?>
<ocsRequest>
<requestType>2015</requestType>
<serviceNode>xx</serviceNode>
<sequenceNo>1463918615065</sequenceNo>
<callingParty>9656500000</callingParty>
<serviceType>P-aRX2zvEwMY2</serviceType>
<serviceId>S-NgY2zvxxxx</serviceId>
<bearerId>SMS</bearerId>
<chargeAmount>60.0</chargeAmount>
<planId>Fit_DuSxxxx</planId>
<asyncFlag>N</asyncFlag>
<renewalFlag>-1</renewalFlag>
<bundleType>N</bundleType>
<serviceUsage>-1</serviceUsage>
<promoId>-1</promoId>
<subscriptionFlag>S</subscriptionFlag>
<optionalParameter1>msgText#Follow this link, or try from PC. http://localhost:8084/Notification/contents/ddd.mp3</optionalParameter1>
<optionalParameter2>reqSource#1319</optionalParameter2>
<optionalParameter3>languageId#en</optionalParameter3>
<optionalParameter4>-1</optionalParameter4>
<optionalParameter5>-1</optionalParameter5>
</ocsRequest>
但是当我尝试像这样接收它时
String xmlContent = request.getParameter("xmlContent");
out.write(xmlContent);
它给了我
<ocsRequest>
<requestType>2015</requestType>
<serviceNode>FITxxx</serviceNode>
<sequenceNo>1463918615065</sequenceNo>
<callingParty>96565682860</callingParty>
<serviceType>P-aRX2zvEwMY2</serviceType>
<serviceId>S-NgY2zvEwMY2Du</serviceId>
<bearerId>SMS</bearerId>
<chargeAmount>60.0</chargeAmount>
<planId>Fit_DuSudai_60</planId>
<asyncFlag>N</asyncFlag>
<renewalFlag>-1</renewalFlag>
<bundleType>N</bundleType>
<serviceUsage>-1</serviceUsage>
<promoId>-1</promoId>
<subscriptionFlag>S</subscriptionFlag>
<optionalParameter1>msgText
字符串未完成,它在msgText
之后缺少某些部分我也尝试在get请求中发送字符串,但遇到同样的问题