Skip to main content
1-Visitor
January 22, 2018
Question

How do I read XML tag value when it contains namespace like ns0:

  • January 22, 2018
  • 3 replies
  • 2581 views

I have a soap response from a PostXML call.

Need help in reading the value of a tag: Ticket_number

I am not able to read the value TKT0001, more so because of the namespace

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <soapenv:Body>

  <ns0:Test_soap_service xmlns:ns0="urn:Create_Ticket" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <ns0:Ticket_Number>TKT0001</ns0:Ticket_Number>

  </ns0:Test_soap_service>

  </soapenv:Body>

  </soapenv:Envelope>

3 replies

5-Regular Member
January 30, 2018

Hello, Ranjan.

Are you getting an error thrown when you try to read TKT0001, or getting an empty value? If there is an error, what is that?

Thanks,

-- Craig A.

5-Regular Member
January 30, 2018

try the below ! where 'response' is the soap response you got from the web service

var result= response.*::Body.*::Test_soap_service.*::Ticket_Number

rpriya1-VisitorAuthor
1-Visitor
February 7, 2018

Thanks Raghu

It worked..