简体   繁体   中英

How to Parse SOAP Response from a third party server using Java

I am a newbie to SOAP services, I want to extract XML from the following SOAP response which belongs to corresponding SOAP request, so my XML is contained in a String tag. I want to extract the xml from the String Tag. Please give me the solution with an example

<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://www.webserviceX.NET/">
   <StockQuotes>
      <Stock>
         <Symbol>STRING</Symbol>
         <Last>0.00</Last>
         <Date>N/A</Date>
         <Time>N/A</Time>
         <Change>N/A</Change>
         <Open>N/A</Open>
         <High>N/A</High>
         <Low>N/A</Low>
         <Volume>N/A</Volume>
         <MktCap>N/A</MktCap>
         <PercentageChange>N/A</PercentageChange>
         <AnnRange>N/A - N/A</AnnRange>
         <Earns>N/A</Earns>
         <P-E>N/A</P-E>
         <Name>STRING</Name>
      </Stock>
   </StockQuotes>
</string>

Take a look here: How to read XML using XPath in Java

You do not need any specific tool for SOAP. You just need to get info from your XML.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM