<?xml version="1.0" encoding="ISO-8859-1"?><ResponsePacket revision="1" xmlns="urn:Microsoft.Search.Response"> <Response domain="{2698075D-E2F5-4254-87B2-7FC9E9AB0780}"> <QueryId>{8E823A74-053D-4434-A67B-D1CD050B3349}</QueryId> <Range> <Results> <Content xmlns="urn:Microsoft.Search.Response.Content"> <P>Falha ao acessar o sistema:</P> <HorizontalRule /><P>Mensagem:</P> <P><Char bold="true">O Sistema encontra-se temporariamente indisponível.</Char></P> <HorizontalRule /> <P><Char bold="true">Fornecido por</Char></P> <Image source="http://consultacep.correios.com.br/office2003/imagens/logo.gif" /> <P><Char bold="true">www.CORREIOS.com.br</Char></P> <P>Atendimento ao Cliente</P><P>0800 57 00100</P> </Content> </Results> </Range> <Status>SUCCESS</Status></Response></ResponsePacket>a forma mais fácil de tratar um xml seria em convertê-lo pra cursor, que seria como no exemplo:
* lcretorno = xml recebido * "cRetorno" = nome do cursor XMLTOCURSOR(lcretorno, "cRetorno",4)>
>LOCAL loQueryProcessor AS "XML Web Service" >* LOCAL loQueryProcessor AS "MSSOAP.SoapClient30" >* Do not remove or alter following line. It is used to support IntelliSense for your XML Web service. >*__VFPWSDef__: loQueryProcessor = http://consultacep.correios.com.br/office2003/query.asmx?WSDL , QueryProcessor , QueryProcessorSoap >LOCAL loException, lcErrorMsg, loWSHandler >TRY > loWSHandler = NEWOBJECT("WSHandler",IIF(VERSION(2)=0,"",HOME()+"FFC\")+"_ws3client.vcx") > loQueryProcessor = loWSHandler.SetupClient("http://consultacep.correios.com.br/office2003/query.asmx?WSDL", "QueryProcessor", "QueryProcessorSoap") > * Call your XML Web service here. ex: leResult = loQueryProcessor.SomeMethod() > LOCAL lcCep as String > lcCep = thisform.textbox1.Value > >lcStringBusca = [<?xml version="1.0" encoding="utf-8"?>] + ; > [<QueryPacket xmlns="urn:Microsoft.Search.Query">] + ; > [<Query>] + ; > [<Context>] + ; > [<QueryText>&lcCep</QueryText>] + ; > [</Context>] + ; > [<OfficeContext xmlns="urn:Microsoft.Search.Query.Office.Context">] + ; > [<ApplicationContext>]+ ; > [<Name>Microsoft Office</Name>] + ; > [<Version>(11.0.6568)</Version>] + ; > [</ApplicationContext>] + ; > [</OfficeContext>] + ; > [</Query>] + ; > [</QueryPacket>] > >lcResultado = loQueryProcessor.Query(lcStringBusca) >thisform.editbox1.Value = lcResultado > >CATCH TO loException > lcErrorMsg="Error: "+TRANSFORM(loException.Errorno)+" - "+loException.Message > DO CASE > CASE VARTYPE(loQueryProcessor)#"O" > * Handle SOAP error connecting to web service > CASE !EMPTY(loQueryProcessor.FaultCode) > * Handle SOAP error calling method > lcErrorMsg=lcErrorMsg+CHR(13)+loQueryProcessor.Detail > OTHERWISE > * Handle other error > ENDCASE > * Use for debugging purposes > MESSAGEBOX(lcErrorMsg) >FINALLY >ENDTRY >>