Hello community,
I need some help, please.
I got the following xml as SOAP webservice response, and I need to get the values of each of the fields such as cedulaRuc, codigoASP, nombre1, nombre2, etc.
I`m using PBDOM object to parse the XML data. However when I try to get any of the elements, I got a null exception message.
I dont know what I´m doing wrong.
string ls_xml_response
ls_xml_response = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">' + &
'<s:Body>' + &
'<consultaProveedoresResponse xmlns="http://tempuri.org/"'+&
'<consultaProveedoresResult xmlns:a="http://schemas.datacontract.org/2004/07/WcfServiceSCSP.clasesProyecto"'+&
'xmlns:i="http://www.w3.org/2001/XMLSchema-instance">'+&
'<a:lstProveedor>' +&
'<a:proveedor>'+&
'<a:cedulaRuc>1101499999</a:cedulaRuc>'+&
'<a:codigoSAP>0000060155</a:codigoSAP>'+&
'<a:nombre1>SAMANIEGO PUERTAS BRUNO MIGUEL</a:nombre1>'+&
'<a:nombre2/><a:nombre3/><a:nombre4/><a:tipo/></a:proveedor></a:lstProveedor>'+&
'<a:resp i:nil="true"/>'+&
'</consultaProveedoresResult>'+&
'</consultaProveedoresResponse>'+&
'</s:Body>'+&
'</s:Envelope>'
//Using PBDOM
PBDOM_Builder lpbdom_builder
PBDOM_Document lpbdom_doc
STRING ls_value, ls_error_xml
lpbdom_Builder = CREATE PBDOM_BUILDER
lpbdom_Doc = lpbdom_Builder.BuildFromString( ls_xml_response)
try
ls_value = lpbdom_Doc.GetRootElement().&
GetChildElement("Body", "soap","http://schemas.xmlsoap.org/soap/envelope/").&
GetChildElement("consultaProveedoresResponse","","http://tempurl.org").&
GetChildElement("consultaProveedoresResult","","http://tempurl.org").&
GetChildElement("lstProveedor").&
GetChildElement("proveedor").&
GetChildElement("cedulaRUC").getText()
Catch (PBDOM_Exception lpbdom_Except)
ls_error_xml = "PBDOM_Exception : " + string(lpbdom_Except.GetExceptionCode())
RETURN -1
END TRY
DESTROY(lpbdom_Builder)
Thanks in advance