解析soap

<?xml   version= '1.0 '   encoding= 'utf-8 '?>
<SOAP-ENV:Envelope   xmlns:xsi= 'http://www.w3.org/2001/XMLSchema-instance '
        xmlns:xsd= 'http://www.w3.org/2001/XMLSchema '
        xmlns:SOAP-ENV= 'http://schemas.xmlsoap.org/soap/envelope/ '
        xmlns:SOAP-ENC= 'http://schemas.xmlsoap.org/soap/encoding/ '>
<SOAP-ENV:Header>
        <TransactionID   xmlns= 'http://10.1.2.122/misc/dsmp.xsd '> 00110100037392 </TransactionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<SyncOrderRelationReq   xmlns= 'http://10.1.2.122/misc/dsmp.xsd '>
<Version> 1.5.0 </Version>
<MsgType> SyncOrderRelationReq </MsgType>
<Send_Address>
<DeviceType> 0 </DeviceType>
<DeviceID> 0011 </DeviceID>
</Send_Address>
<Dest_Address>
<DeviceType> 400 </DeviceType>
<DeviceID> 0 </DeviceID>
</Dest_Address>
<FeeUser_ID>
<UserIDType> 2 </UserIDType>
<MSISDN> </MSISDN>
<PseudoCode> 00116000000286 </PseudoCode>
</FeeUser_ID>
<DestUser_ID>
<UserIDType> 2 </UserIDType>
<MSISDN> </MSISDN>
<PseudoCode> 00116000000286 </PseudoCode>
</DestUser_ID>
<LinkID> SP </LinkID>
<ActionID> 1 </ActionID>
<ActionReasonID> 1 </ActionReasonID>
<SPID> 900562 </SPID>
<SPServiceID> 04101040 </SPServiceID>
<AccessMode> 5 </AccessMode>
<FeatureStr> </FeatureStr>
</SyncOrderRelationReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

解析:

 

 

SAXBuilder   builder   =   new   SAXBuilder();
Document   doc   =   null;
StringReader   sr   =   new   StringReader(soaptext);
doc   =   builder.build(sr);

Namespace   senv   =   Namespace.getNamespace(   "SOAP-ENV ",   "http://schemas.xmlsoap.org/soap/envelope/ ");
Namespace   trns   =   Namespace.getNamespace( "http://10.1.2.122/misc/dsmp.xsd ");

Element   root   =   doc.getRootElement();
Element   head   =   root.getChild( "Header ",   senv);   // <SOAP-ENV:Header>
Element   tid   =   head.getChild( "TransactionID ",   trns);   //TransactionID
tidtext   =   tid.getText();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值