Obtenir SoapBody valeur de l'Élément de
Voici la réponse que je reçois depuis le serveur,
Bien que je peux prendre le MM7Version
valeur de l'élément, je ne peux pas obtenir le Status
valeur de l'élément. elle renvoie null.
SoapMeesage Réponse XML:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header>
<mm7:TransactionID SOAP-ENV:mustUnderstand="1" xmlns:mm7="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-2">TID.BIP_TRASNID.20041103.135200.001</mm7:TransactionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<MM7Version>5.6.0</MM7Version>
<Status><StatusCode>2602</StatusCode><StatusText>Invalid status</StatusText></Status>
<MessageID></MessageID>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
De Code Java:
SOAPMessage response = connection.call(message, endpoint);
SOAPEnvelope env= response.getSOAPPart().getEnvelope();
SOAPBody sb = env.getBody();
Name ElName = env.createName("Status");
//Get child elements with the name XElement
Iterator it = sb.getChildElements(ElName);
//Get the first matched child element.
//We know there is only one.
SOAPBodyElement sbe = (SOAPBodyElement) it.next();
//Get the value for XElement
String MyValue = sbe.getValue();
System.out.println("MyValue: "+MyValue);
ce qui est semblable avec dublicate question? Je peux obtenir de l'ensemble de la valeur XML. Pourquoi je ne peux pas retrive champ d'État alors que les autres? réponse.writeTo(Système d'.); est utilisé pour celui-ci.
OriginalL'auteur Ahmet Karakaya | 2015-07-11
Vous devez vous connecter pour publier un commentaire.
Codé une méthode en inspirant http://www.coderanch.com/t/640002/Web-Services/java/Error-parsing-SOAP-response-message
OriginalL'auteur Ahmet Karakaya
Essayer cela avec les Zone De Conversion composant ...
Sortie
OriginalL'auteur Jason DSouza