From 1f48ec21cd29a4745e191f5ddadaf7a701f7d223 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Fri, 12 Jun 2020 10:50:45 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=B0=86xml=E8=A7=A3=E6=9E=90=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E8=AE=BE=E5=AE=9A=E4=B8=BAGB2312=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E6=BB=A1=E8=B6=B3GB28181=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/transmit/request/impl/MessageRequestProcessor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java index fd5ca377..cc2e5526 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java @@ -100,6 +100,7 @@ public class MessageRequestProcessor implements ISIPRequestProcessor { Request request = evt.getRequest(); SAXReader reader = new SAXReader(); + reader.setEncoding("gbk"); Document xml; try { xml = reader.read(new ByteArrayInputStream(request.getRawContent())); From e9e4e8d44a885b98e23c159015772c8d82a4878f Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 25 Jun 2020 15:16:13 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9invite=E5=85=B6?= =?UTF-8?q?=E5=AE=83=E5=93=8D=E5=BA=94=E7=9A=84=E5=BA=94=E5=AF=B9=EF=BC=8C?= =?UTF-8?q?=E5=A6=82101=20Dialog=20Establishement=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/gb28181/SipLayer.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java index b70c5eb6..64525d7a 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.gb28181; +import java.text.ParseException; import java.util.Properties; import javax.annotation.PostConstruct; @@ -128,11 +129,18 @@ public class SipLayer implements SipListener, Runnable { int status = response.getStatusCode(); if ((status >= 200) && (status < 300)) { // Success! ISIPResponseProcessor processor = processorFactory.createResponseProcessor(evt); - processor.process(evt, this, sipConfig); - } else if (status == Response.TRYING) { + try { + processor.process(evt, this, sipConfig); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // } else if (status == Response.TRYING) { // trying不会回复 + } else if ((status >= 100) && (status < 200)) { + // 增加其它无需回复的响应,如101、180等 } else { - logger.warn("接收到失败的response响应!status:" + status + ",message:" + response.getContent().toString()); + logger.warn("接收到失败的response响应!status:" + status + ",message:" + response.getReasonPhrase()/* .getContent().toString()*/); } // trying不会回复 // if (status == Response.TRYING) { From 1a746f28822fe7ca382eda6ede2e32d6cf8e6d01 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 25 Jun 2020 15:22:05 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=B0=86=E8=AE=BE=E5=A4=87IP=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E5=A1=AB=E5=85=A5via=20Header=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E9=83=A8=E5=88=86=E8=AE=BE=E5=A4=87=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D200=20OK=E6=97=B6contact=E4=BF=A1=E6=81=AF=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?ack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/transmit/cmd/SIPRequestHeaderProvider.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java index c15b9b68..7a95268c 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java @@ -79,7 +79,8 @@ public class SIPRequestHeaderProvider { SipURI requestLine = layer.getAddressFactory().createSipURI(channelId, host.getAddress()); //via ArrayList viaHeaders = new ArrayList(); - ViaHeader viaHeader = layer.getHeaderFactory().createViaHeader(sipConfig.getSipIp(), sipConfig.getSipPort(), device.getTransport(), viaTag); + // ViaHeader viaHeader = layer.getHeaderFactory().createViaHeader(sipConfig.getSipIp(), sipConfig.getSipPort(), device.getTransport(), viaTag); + ViaHeader viaHeader = layer.getHeaderFactory().createViaHeader(device.getHost().getIp(), device.getHost().getPort(), device.getTransport(), viaTag); viaHeader.setRPort(); viaHeaders.add(viaHeader); //from @@ -108,6 +109,7 @@ public class SIPRequestHeaderProvider { request = layer.getMessageFactory().createRequest(requestLine, Request.INVITE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards); Address concatAddress = layer.getAddressFactory().createAddress(layer.getAddressFactory().createSipURI(sipConfig.getSipId(), sipConfig.getSipIp()+":"+sipConfig.getSipPort())); + // Address concatAddress = layer.getAddressFactory().createAddress(layer.getAddressFactory().createSipURI(sipConfig.getSipId(), device.getHost().getIp()+":"+device.getHost().getPort())); request.addHeader(layer.getHeaderFactory().createContactHeader(concatAddress)); ContentTypeHeader contentTypeHeader = layer.getHeaderFactory().createContentTypeHeader("Application", "SDP"); @@ -122,7 +124,8 @@ public class SIPRequestHeaderProvider { SipURI requestLine = layer.getAddressFactory().createSipURI(device.getDeviceId(), host.getAddress()); //via ArrayList viaHeaders = new ArrayList(); - ViaHeader viaHeader = layer.getHeaderFactory().createViaHeader(sipConfig.getSipIp(), sipConfig.getSipPort(), device.getTransport(), viaTag); + // ViaHeader viaHeader = layer.getHeaderFactory().createViaHeader(sipConfig.getSipIp(), sipConfig.getSipPort(), device.getTransport(), viaTag); + ViaHeader viaHeader = layer.getHeaderFactory().createViaHeader(device.getHost().getIp(), device.getHost().getPort(), device.getTransport(), viaTag); viaHeader.setRPort(); viaHeaders.add(viaHeader); //from @@ -151,6 +154,7 @@ public class SIPRequestHeaderProvider { request = layer.getMessageFactory().createRequest(requestLine, Request.INVITE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards); Address concatAddress = layer.getAddressFactory().createAddress(layer.getAddressFactory().createSipURI(sipConfig.getSipId(), sipConfig.getSipIp()+":"+sipConfig.getSipPort())); + // Address concatAddress = layer.getAddressFactory().createAddress(layer.getAddressFactory().createSipURI(sipConfig.getSipId(), device.getHost().getIp()+":"+device.getHost().getPort())); request.addHeader(layer.getHeaderFactory().createContactHeader(concatAddress)); ContentTypeHeader contentTypeHeader = layer.getHeaderFactory().createContentTypeHeader("Application", "SDP"); From 340a23a9613dae68361e5e4352556fa929911e68 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 25 Jun 2020 15:27:29 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=AE=BE=E5=A4=87invite=E5=90=8Ebye=E6=97=A0=E6=B3=95=E6=89=BE?= =?UTF-8?q?=E5=88=B0=E8=AE=BE=E5=A4=87=E5=9C=B0=E5=9D=80=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/transmit/cmd/impl/SIPCommander.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index b70f353e..96618d05 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -7,10 +7,13 @@ import javax.sip.Dialog; import javax.sip.InvalidArgumentException; import javax.sip.SipException; import javax.sip.TransactionDoesNotExistException; +import javax.sip.address.Address; +import javax.sip.address.SipURI; import javax.sip.header.ViaHeader; import javax.sip.message.Request; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.security.SecurityProperties.Headers; import org.springframework.stereotype.Component; import com.genersoft.iot.vmp.conf.SipConfig; @@ -21,6 +24,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderProvider; import com.genersoft.iot.vmp.gb28181.utils.DateUtil; +import java.util.regex.Pattern; +import java.util.regex.Matcher; + /** * @Description:设备能力接口,用于定义设备的控制、查询能力 * @author: songww @@ -288,6 +294,13 @@ public class SIPCommander implements ISIPCommander { return; } Request byeRequest = dialog.createRequest(Request.BYE); + SipURI byeURI = (SipURI) byeRequest.getRequestURI(); + String vh = transaction.getRequest().getHeader(ViaHeader.NAME).toString(); + Pattern p = Pattern.compile("(\\d+\\.\\d+\\.\\d+\\.\\d+)\\:(\\d+)"); + Matcher matcher = p.matcher(vh); + if (matcher.find()) { + byeURI.setHost(matcher.group(1)); + } ViaHeader viaHeader = (ViaHeader) byeRequest.getHeader(ViaHeader.NAME); String protocol = viaHeader.getTransport().toUpperCase(); ClientTransaction clientTransaction = null; @@ -301,6 +314,8 @@ public class SIPCommander implements ISIPCommander { e.printStackTrace(); } catch (SipException e) { e.printStackTrace(); + } catch (ParseException e) { + e.printStackTrace(); } } From 85e6beaf445fbea23739382df96bc3942f0de236 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 25 Jun 2020 15:30:26 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8D=95=E6=8D=89=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/gb28181/transmit/response/ISIPResponseProcessor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/ISIPResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/ISIPResponseProcessor.java index 9ff99597..458158b4 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/ISIPResponseProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/ISIPResponseProcessor.java @@ -1,5 +1,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.response; +import java.text.ParseException; + import javax.sip.ResponseEvent; import com.genersoft.iot.vmp.conf.SipConfig; @@ -12,6 +14,6 @@ import com.genersoft.iot.vmp.gb28181.SipLayer; */ public interface ISIPResponseProcessor { - public void process(ResponseEvent evt, SipLayer layer, SipConfig config); + public void process(ResponseEvent evt, SipLayer layer, SipConfig config) throws ParseException; } From 4ca7307eea4364567f5fa51b099dbb98b4c49e9f Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 25 Jun 2020 15:33:15 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3invite=E5=90=8E=E6=94=B6?= =?UTF-8?q?=E5=88=B0=E9=83=A8=E5=88=86=E8=AE=BE=E5=A4=87200=20OK=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=9B=9E=E5=A4=8Dack=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/InviteResponseProcessor.java | 94 ++++++++++++------- 1 file changed, 59 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/InviteResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/InviteResponseProcessor.java index 9b1783f8..9c862fad 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/InviteResponseProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/InviteResponseProcessor.java @@ -7,8 +7,11 @@ import javax.sip.Dialog; import javax.sip.InvalidArgumentException; import javax.sip.ResponseEvent; import javax.sip.SipException; +import javax.sip.address.Address; import javax.sip.address.SipURI; import javax.sip.header.CSeqHeader; +import javax.sip.header.ContactHeader; +import javax.sip.header.FromHeader; import javax.sip.header.ViaHeader; import javax.sip.message.Request; import javax.sip.message.Response; @@ -22,57 +25,78 @@ import com.genersoft.iot.vmp.gb28181.SipLayer; import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorFactory; import com.genersoft.iot.vmp.gb28181.transmit.response.ISIPResponseProcessor; -/** +// import java.util.regex.Pattern; +// import java.util.regex.Matcher; + +/** * @Description:处理INVITE响应 * @author: songww - * @date: 2020年5月3日 下午4:43:52 + * @date: 2020年5月3日 下午4:43:52 */ @Component public class InviteResponseProcessor implements ISIPResponseProcessor { private final static Logger logger = LoggerFactory.getLogger(SIPProcessorFactory.class); - + /** * 处理invite响应 * - * @param evt - * 响应消息 - */ + * @param evt 响应消息 + * @throws ParseException + */ @Override - public void process(ResponseEvent evt, SipLayer layer, SipConfig config) { + public void process(ResponseEvent evt, SipLayer layer, SipConfig config) throws ParseException { try { Response response = evt.getResponse(); int statusCode = response.getStatusCode(); - //trying不会回复 - if(statusCode == Response.TRYING){ - + // trying不会回复 + if (statusCode == Response.TRYING) { } - //成功响应 - //下发ack - if(statusCode == Response.OK){ -// ClientTransaction clientTransaction = evt.getClientTransaction(); -// if(clientTransaction == null){ -// logger.error("回复ACK时,clientTransaction为null >>> {}",response); -// return; -// } -// Dialog clientDialog = clientTransaction.getDialog(); -// -// CSeqHeader clientCSeqHeader = (CSeqHeader) response.getHeader(CSeqHeader.NAME); -// long cseqId = clientCSeqHeader.getSeqNumber(); -// /* -// createAck函数,创建的ackRequest,会采用Invite响应的200OK,中的contact字段中的地址,作为目标地址。 -// 有的终端传上来的可能还是内网地址,会造成ack发送不出去。接受不到音视频流 -// 所以在此处统一替换地址。和响应消息的Via头中的地址保持一致。 -// */ -// Request ackRequest = clientDialog.createAck(cseqId); -// SipURI requestURI = (SipURI) ackRequest.getRequestURI(); -// ViaHeader viaHeader = (ViaHeader) response.getHeader(ViaHeader.NAME); -// requestURI.setHost(viaHeader.getHost()); -// requestURI.setPort(viaHeader.getPort()); -// clientDialog.sendAck(ackRequest); - + // 成功响应 + // 下发ack + if (statusCode == Response.OK) { + // ClientTransaction clientTransaction = evt.getClientTransaction(); + // if(clientTransaction == null){ + // logger.error("回复ACK时,clientTransaction为null >>> {}",response); + // return; + // } + // Dialog clientDialog = clientTransaction.getDialog(); + + // CSeqHeader clientCSeqHeader = (CSeqHeader) + // response.getHeader(CSeqHeader.NAME); + // long cseqId = clientCSeqHeader.getSeqNumber(); + // /* + // createAck函数,创建的ackRequest,会采用Invite响应的200OK,中的contact字段中的地址,作为目标地址。 + // 有的终端传上来的可能还是内网地址,会造成ack发送不出去。接受不到音视频流 + // 所以在此处统一替换地址。和响应消息的Via头中的地址保持一致。 + // */ + // Request ackRequest = clientDialog.createAck(cseqId); + // SipURI requestURI = (SipURI) ackRequest.getRequestURI(); + // ViaHeader viaHeader = (ViaHeader) response.getHeader(ViaHeader.NAME); + // try { + // requestURI.setHost(viaHeader.getHost()); + // } catch (Exception e) { + // e.printStackTrace(); + // } + // requestURI.setPort(viaHeader.getPort()); + // clientDialog.sendAck(ackRequest); + Dialog dialog = evt.getDialog(); - Request reqAck =dialog.createAck(1L); + CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME); + Request reqAck = dialog.createAck(cseq.getSeqNumber()); + + SipURI requestURI = (SipURI) reqAck.getRequestURI(); + ViaHeader viaHeader = (ViaHeader) response.getHeader(ViaHeader.NAME); + // String viaHost =viaHeader.getHost(); + //getHost()函数取回的IP地址是“[xxx.xxx.xxx.xxx:yyyy]”的格式,需用正则表达式截取为“xxx.xxx.xxx.xxx"格式 + // Pattern p = Pattern.compile("(?<=//|)((\\w)+\\.)+\\w+"); + // Matcher matcher = p.matcher(viaHeader.getHost()); + // if (matcher.find()) { + // requestURI.setHost(matcher.group()); + // } + requestURI.setHost(viaHeader.getHost()); + requestURI.setPort(viaHeader.getPort()); + reqAck.setRequestURI(requestURI); dialog.sendAck(reqAck); } } catch (InvalidArgumentException | SipException e) { From c296e431db47f91211182c4c65afe0ff83851950 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 25 Jun 2020 15:35:24 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9ZLMediaKit=20Hook?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=B8=8E=E5=85=B6=E7=BC=BA=E7=9C=81=E5=80=BC?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index e4be40b0..25f000b5 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -22,7 +22,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; * @date: 2020年5月8日 上午10:46:48 */ @RestController -@RequestMapping("/hook/zlm") +@RequestMapping("/index/hook") public class ZLMHttpHookListener { private final static Logger logger = LoggerFactory.getLogger(ZLMHttpHookListener.class); From d2285b6913820bc795b7b1d8e71acd12003140b9 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 25 Jun 2020 15:46:02 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E9=80=9A=E9=81=93=E5=90=8D=E7=A7=B0=E4=B8=BA=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=88=97=E5=87=BA=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/transmit/request/impl/MessageRequestProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java index cc2e5526..f5c3c8bc 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java @@ -376,7 +376,7 @@ public class MessageRequestProcessor implements ISIPRequestProcessor { private Element getRootElement(RequestEvent evt) throws DocumentException { Request request = evt.getRequest(); SAXReader reader = new SAXReader(); - reader.setEncoding("GB2312"); + reader.setEncoding("gbk"); Document xml = reader.read(new ByteArrayInputStream(request.getRawContent())); return xml.getRootElement(); }