Try
oOle := CreateObject( 'MSXML2.XMLHTTP' )
Catch
oOle := CreateObject( 'Microsoft.XMLHTTP' )
End
But, we can use WebServices
I use for government and for my city
see a example for send a xml with many invoices
Load xml
cXML := memoread('nfse\11072432000124_I_20117-27_26072011.xml')
cXML := STRTRAN( cXML, '<?xml version="1.0" encoding="ISO-8859-1"?>', '' )
cXML := STRTRAN( cXML, "<", "<" )
cXML := STRTRAN( cXML, ">", ">" )
Load DOMDocument
xmldom = win_oleCREATEOBJECT("MSXML2.DOMDocument.5.0")
xmldom:async = .T.
xmldom:validateOnParse = .T.
xmldom:resolveExternals := .T.
xmldom:preserveWhiteSpace = .T.
Load XMLHTTP
xmldoc = win_oleCREATEOBJECT("MSXML2.XMLHTTP.6.0")
url := "http://189.1.164.238:8080/issonline/servlet/anfse"
Conect to WebService
xmldoc:open("POST", url, .F.)
xmldoc:setrequestheader("Content-Type","application/x-www-form-urlencoded")
xmldoc:setRequestHeader("SOAPAction", "nfseaction/ANFSE.Execute" )
Making XML for WebService
Texto := '<?xml version="1.0" encoding="ISO-8859-1"?>'
Texto += '<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"';
+ ' xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="nfse" xmlns:wsdlns="nfse" xmlns:tns1="ISS">'
Texto += '<SOAP-ENV:Body>'
Texto += '<wsdlns:Nfse.Execute xmlns:wsdlns="nfse">'
Texto += '<wsdlns:Operacao>1</wsdlns:Operacao>'
Texto += '<wsdlns:Usuario>21312</wsdlns:Usuario>' //
Texto += '<wsdlns:Senha>321321321321</wsdlns:Senha>'
Texto += '<wsdlns:Webxml>'+cXML+''
Texto += '</wsdlns:Webxml>'
Texto += '</wsdlns:Nfse.Execute>'
Texto += '</SOAP-ENV:Body>'
Texto += '</SOAP-ENV:Envelope>'
xmldom:LoadXML(Texto)
IF xmldom:parseError:errorCode = 0
//"XML Load"
ELSE
lcErrorMsg = "Não foi possível carregar o documento pois ele não corresponde ao seu Schema"
lcErrorMsg = lcErrorMsg + " Linha: " + STR(xmldom:parseError:line)
lcErrorMsg = lcErrorMsg + " Caractere na linha: " + STR(xmldom:parseError:linepos)
lcErrorMsg = lcErrorMsg + " Causa do erro: " + xmldom:parseError:reason;
+"code: "+STR(xmldom:parseError:errorCode)
msginfo(lcErrorMsg)
ENDIF
Send data to WebService
xmldoc:send(xmldom:xml)
Get Result
cResult := xmldoc:responseXML:xml
Best Regards,
Fernando Athayde
From Brazil
Silvio.Falconi wrote:Application
===========
Path and name: C:\work\errori\google\test.Exe (32 bits)
Size: 1,781,248 bytes
Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 6715)
FiveWin Version: FWHX 12.03
Windows version: 5.1, Build 2600 Service Pack 2
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 01/16/13, 09:22:34
Error description: Error MSXML2.XMLHTTP/3 DISP_E_MEMBERNOTFOUND: SEND
Args:
[ 1] = C Email=silvio.falconi@gmail.com&Passwd=..............&source=project-example-1&service=cl
Stack Calls
===========
Called from: source\rtl\win32ole.prg => TOLEAUTO:SEND( 0 )
Called from: test.prg => SENDPOSTTOURL( 46 )
Called from: test.prg => MAIN( 13 )
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Antonio Linares, Google [Bot] and 47 guests