DELETEFILE( "C:\NFEXML\CCE" + ALLTRIM( STR( WNUMERO ) + ".XML" ) )
//----------------------------------------------------------------------------//
Static Function LlamoAlWSAA( c_CMS_Base64 )
Local cXml := ''
Local oWSAA := ''
Local cWSAA_URL := 'https://wsaa.afip.gov.ar/ws/services/LoginCms?wsdl'
Local cRespuesta := ''
Memvar oVar
If( oVar : lProduccion )
cWSAA_URL := 'https://wsaa.afip.gov.ar/ws/services/LoginCms?wsdl'
Else
cWSAA_URL := 'https://wsaahomo.afip.gov.ar/ws/services/LoginCms'
End
oWSAA := CreateObject( 'MSXML2.XMLHTTP' )
If( Empty( oWSAA ) )
MsgStop( 'NO se Pudo Crear el Objeto oWSAA; se Cancela el Programa' )
Return( .f. )
End
* Armo el XML con el TRA
cXml += '<?xml version="1.0" encoding="UTF-8"?>' + CRLF
cXml += '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' + CRLF
cXml += '<soap:Body>' + CRLF
cXml += ' <loginCms xmlns="http://wsaa.view.sua.dvadac.desein.afip.gov">' + CRLF
cXml += ' <in0>' + c_CMS_Base64 + '</in0>' + CRLF
cXml += ' </loginCms>' + CRLF
cXml += '</soap:Body>' + CRLF
cXml += '</soap:Envelope>' + CRLF
* Llamo al Webservice y defino Opciones
oWSAA : Open( 'POST', cWSAA_URL, .f. )
oWSAA : SetRequestHeader( "SOAPAction:", "None" )
oWSAA : SetRequestHeader( "Content-Type", "text/xml;charset=UTF-8" )
* Envio el Archivo y Recibo la Respuesta del WS
oWSAA : Send( cXml )
//oWSAA : Status
* Si el status es diferente a 200, ocurri¢ alg£n error de conectividad con el WS ---
cRespuesta := oWSAA : ResponseText
if( Empty( cRespuesta ) )
MsgStop( "Error; cRespuesta esta VACIO" )
End
oWSAA := Nil
Release oWSAA
Return( cRespuesta )
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="https://wsaa.afip.gov.ar/ws/services/LoginCms" xmlns:intf="https://wsaa.afip.gov.ar/ws/services/LoginCms" xmlns:tns1="http://wsaa.view.sua.dvadac.desein.afip.gov" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="https://wsaa.afip.gov.ar/ws/services/LoginCms">
<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://wsaa.view.sua.dvadac.desein.afip.gov">
<import namespace="https://wsaa.afip.gov.ar/ws/services/LoginCms"/>
<element name="loginCms">
<complexType>
<sequence>
<element name="in0" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="loginCmsResponse">
<complexType>
<sequence>
<element name="loginCmsReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="https://wsaa.afip.gov.ar/ws/services/LoginCms">
<complexType name="LoginFault">
<sequence/>
</complexType>
<element name="fault" type="impl:LoginFault"/>
</schema>
</wsdl:types>
<wsdl:message name="LoginFault">
<wsdl:part element="impl:fault" name="fault"/>
</wsdl:message>
<wsdl:message name="loginCmsResponse">
<wsdl:part element="tns1:loginCmsResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="loginCmsRequest">
<wsdl:part element="tns1:loginCms" name="parameters"/>
</wsdl:message>
<wsdl:portType name="LoginCMS">
<wsdl:operation name="loginCms">
<wsdl:input message="impl:loginCmsRequest" name="loginCmsRequest"/>
<wsdl:output message="impl:loginCmsResponse" name="loginCmsResponse"/>
<wsdl:fault message="impl:LoginFault" name="LoginFault"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="LoginCmsSoapBinding" type="impl:LoginCMS">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="loginCms">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="loginCmsRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="loginCmsResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="LoginFault">
<wsdlsoap:fault name="LoginFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="LoginCMSService">
<wsdl:port binding="impl:LoginCmsSoapBinding" name="LoginCms">
<wsdlsoap:address location="https://wsaa.afip.gov.ar/ws/services/LoginCms"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Try
IF "10" $ cWinVersion()
oServer:= CreateObject( "MSXML2.ServerXMLHTTP.6.0" )
ELSE
oServer:= CreateObject( "MSXML2.ServerXMLHTTP.5.0" )
ENDIF
Catch
MsgInfo('Erro na Criação do Serviço')
Return .f.
End
Try
oServer:Open( "GET", cUrl, .f. )
oServer:SetRequestHeader( "Content-Type", "application/x-www-form-urlencoded" )
oServer:SetRequestHeader( "Connection", "keep-alive" )
oServer:Send()
oServer:WaitForResponse( 10000 )
Catch
MsgInfo('Erro na Conexão com o Site...')
Return .f.
End
cRespuesta := oWSAA : ResponseText
cRespuesta := oWSAA : ResponseBody
<?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>
<loginCmsResponse xmlns="http://wsaa.view.sua.dvadac.desein.afip.gov">
<loginCmsReturn>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<loginTicketResponse version="1">
<header>
<source>CN=wsaahomo, O=AFIP, C=AR, SERIALNUMBER=CUIT 33693450239</source>
<destination>C=ar, O=pyafipws-sistemas agiles, SERIALNUMBER=CUIT 20267565393, CN=mariano reingart</destination>
<uniqueId>3526445017</uniqueId>
<generationTime>2016-09-28T11:17:53.170-03:00</generationTime>
<expirationTime>2016-09-28T23:17:53.170-03:00</expirationTime>
</header>
<credentials>
<token>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pgo8c3NvIHZlcnNpb249IjIuMCI+CiAgICA8aWQgdW5pcXVlX2lkPSIzOTc2NzI3NDYiIHNyYz0iQ049d3NhYWhvbW8sIE89QUZJUCwgQz1BUiwgU0VSSUFMTlVNQkVSPUNVSVQgMzM2OTM0NTAyMzkiIGdlbl90aW1lPSIxNDc1MDcyMjEzIiBleHBfdGltZT0iMTQ3NTExNTQ3MyIgZHN0PSJDTj13c2ZlLCBPPUFGSVAsIEM9QVIiLz4KICAgIDxvcGVyYXRpb24gdmFsdWU9ImdyYW50ZWQiIHR5cGU9ImxvZ2luIj4KICAgICAgICA8bG9naW4gdWlkPSJDPWFyLCBPPXB5YWZpcHdzLXNpc3RlbWFzIGFnaWxlcywgU0VSSUFMTlVNQkVSPUNVSVQgMjAyNjc1NjUzOTMsIENOPW1hcmlhbm8gcmVpbmdhcnQiIHNlcnZpY2U9IndzZmUiIHJlZ21ldGhvZD0iMjIiIGVudGl0eT0iMzM2OTM0NTAyMzkiIGF1dGhtZXRob2Q9ImNtcyI+CiAgICAgICAgICAgIDxyZWxhdGlvbnM+CiAgICAgICAgICAgICAgICA8cmVsYXRpb24gcmVsdHlwZT0iNCIga2V5PSIyMDI2NzU2NTM5MyIvPgogICAgICAgICAgICA8L3JlbGF0aW9ucz4KICAgICAgICA8L2xvZ2luPgogICAgPC9vcGVyYXRpb24+Cjwvc3NvPgoK</token>
<sign>ZH6abCAlYdpuAd7983OLZFtNL6g4oYWc7UJtnaRKlq0BSY5Y59eoIdUv5+poJnOINIDgL7bvzHb2XdaWnSy03bU3AtBKEl2Gvs6ZVzshUkaukCHIVXOUIVF3UA7/PdIwYvq1TmnmDvGArdwLoX2wPSnHRjIXFNa2uWVTMtDlplA=</sign>
</credentials>
</loginTicketResponse>
</loginCmsReturn>
</loginCmsResponse>
</soapenv:Body>
</soapenv:Envelope>
* Armo el XML con el TRA
cXml := '<?xml version="1.0" encoding="UTF-8"?>' + CRLF
cXml += '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' + CRLF
cXml += '<soap:Body>' + CRLF
cXml += ' <loginCms xmlns="http://wsaa.view.sua.dvadac.desein.afip.gov">' + CRLF
cXml += ' <in0>' + c_CMS_Base64 + '</in0>' + CRLF
cXml += ' </loginCms>' + CRLF
cXml += '</soap:Body>' + CRLF
cXml += '</soap:Envelope>' + CRLF
cFile:= hb_base64Decode(cFile, cCodigo)
FWrite(txt_file, cFile)
FClose(txt_file) // close el archivo.xml
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 86 guests