Necesito ayuda con este tema
hay varias explicaciones y ejemplos en el foro pero
no logro entenderlos bien.
o me da errores o no hace nada.
Tengo que crear un CLIENTE y usarlo para acceder al servicio.
cualquier ayuda es muy bien recibida
gracias
function amigo_eduardo()
Local cXml := strtran( memoread("EnvioCFE.xml"), hb_osnewline(), "" )
Local cLocation := "http://190.64.89.202/SICFEServicesDINAPOLI/sicfe.svc"
Local oHttp
oHttp := CreateObject( "MSXML2.XMLHTTP" )
oHttp:Open( "POST", cLocation, .F. )
ohttp:SetRequestHeader("Content-Type" ,"text/xml;charset=UTF-8" )
ohttp:SetRequestHeader( "SOAPAction" , "http://tempuri.org/ISICFEEmisor/EnvioCFE" )
oHttp:SetRequestHeader( "Connection:", "Keep-Alive" )
oHttp:SetRequestHeader( "Content-length: ", Str( len( cXml ) ) )
oHttp:Send( cXml )
Alert( oHttp:responseText )
return nil
#include "hbcurl.ch"
#include "common.ch"
#include "fileio.ch"
function amigo_eduardo_curl( )
local endpointUrl,curlHandle,curlErr
local aHeader,chpmserv,cc1
Local strXml := strtran( memoread("EnvioCFE.xml"), hb_osnewline(), "" )
Local cLocation := "http://190.64.89.202/SICFEServicesDINAPOLI/sicfe.svc"
cc1 := ""
caction := "EnvioCFE"
endpointUrl := cLocation
aHeader := {}
AADD(aHeader,"Content-Type: text/xml;charset=UTF-8")
AADD(aHeader,"SOAPAction: "+ cAction )
AADD(aHeader,"Connection: Keep-Alive" )
AADD(aHeader,"Content-length: "+ Str( len( strXml )) )
curlHandle := curl_easy_init()
if !empty(curlHandle)
/* Specify the Header data */
curl_easy_setopt(curlHandle,HB_CURLOPT_HTTPHEADER,aHeader)
/* Set the endpoint to send the POST to */
curl_easy_setopt(curlHandle, HB_CURLOPT_URL, endpointUrl)
/* Setup response data */
curl_easy_setopt( curlHandle, HB_CURLOPT_DOWNLOAD )
curl_easy_setopt( curlHandle, HB_CURLOPT_DL_BUFF_SETUP )
/* Specify the POST data */
curl_easy_setopt(curlHandle, HB_CURLOPT_POST, 1)
curl_easy_setopt(curlHandle, HB_CURLOPT_POSTFIELDS, strxml)
/* Do everything */
curlErr := curl_easy_perform( curlHandle )
/* Report any errors */
if empty(curlErr)
/* store response in variable */
cc1 := curl_easy_dl_buff_get( curlHandle )
Alert( "ATENCION:" + strtran( htmltoansi( cc1 ), """, '"' ) )
else
Alert( "Error:" + curl_easy_strerror(curlErr) )
endif
else
Alert( "No handle" )
endif
if !empty(curlHandle)
/* Clean-up libcurl */
curl_global_cleanup( curlHandle )
else
Alert( "Error" )
endif
if empty(cc1)
Alert( "Error" )
endif
return cc1
function amigo_eduardo_soap()
Local cValue := ""
Local oSoapClient
Local lOk, orespuesta, i
Local cDominio_WebServices := "http://190.64.89.202/SICFEServicesDINAPOLI/sicfe.svc?singleWsdl"
Local item, objSub
lOk := .T.
oSoapClient := NIL
oSoapClient := CreateObject( "MSSOAP.SoapClient30" ) // Conecta a SOAP 3.0
oSoapClient:msSoapInit( cDominio_WebServices )
try
orespuesta := oSoapClient:EnvioCFE("erp", "erp", "dinapo", "", "cfe", "123", "", .t., 32, 0, "", "", .t., .t., "1.33")
item := oRespuesta:context
For Each objSub In item:childNodes
Alert( "Nombre nodo:" + objSub:nodeName + ( if( !emptY( objSub:text ), " Valor:" + objSub:text,"" ) ) )
If objSub:Attributes:length > 0
For i = 0 To objSub:Attributes:length - 1
Alert( "Atributo:" +objSub:Attributes(i):nodeName + " - " + objSub:Attributes(i):nodeValue )
Next
End If
next
catch
cValue := oSOAPClient:faultString + Hb_OsNewLine() + oSOAPClient:detail
alert( "error:"+cValue )
end
oSoapClient := NIL
return nil
Set oSoapClient = CreateObject( "MSSOAP.SoapClient30" )
oSoapClient.msSoapInit( "http://190.64.89.202/SICFEServicesDINAPOLI/sicfe.svc?singleWsdl" )
Set o = oSoapClient.EnvioCFE( "erp", "erp", "dinapo", "", "cfe", "123", "", True, 32, 0, "", "", True, True, "1.33" )
Set item = o.context
WScript.Echo TypeName( o )
For Each objSub In item.childNodes
WScript.Echo "Nombre nodo:" & objSub.nodeName & " Valor:" & objSub.text
If objSub.Attributes.length > 0 Then
For i = 0 To objSub.Attributes.length - 1
WScript.Echo objSub.Attributes(i).nodeName & " - " & objSub.Attributes(i).nodeValue
Next
End If
Next
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 36 guests