Se puede implementar cliente soap con xailer
Publicado: Sab Jul 22, 2006 1:42 pm
Amigos
Necesito implementar cliente SOAP con xailer
Alguien pueda darme una AYUDA
En este link esta lo que necesito hacer
http://www.aduanet.gob.pe/aduanas/opera ... Services.h tm
En VFP ya lo tienen listo
Web Services desde Visual Fox Pro
Este ejemplo lo pueden encontrar también en la siguiente ruta
http://www.aduanet.gob.pe/js/app/WebSer ... teWSVisual FoxPro.zip
junto con la librería FoxCrypto.fll.
La libreria FoxCrypto.fll contiene la función que codifica y decodifica en
base 64.,
el cual permite el trabajo tipo de datos bytes.
Prueba.prg
SET LIBRARY TO FoxCrypto.FLL
PROCEDURE psEnviArchivo
***********************
*envia archivo
PARAMETER pArc
tcInFile = IIF(EMPTY(pArc),"C:desaprgpruebaCDDEmbargoM4.htm", pArc)
lcInFile = FILETOSTR(tcInFile)
lcInFile64 = codifica(lcInFile)
***
doc = CreateObject("MSXML2.DOMDocument")
http = CreateObject("MSXML2.XMLHTTP")
http.Open("POST", "http://desweb1:8001/portafolio/portafolio", .F.)
http.SetRequestHeader("SOAPAction", "enviaArchivoWebService")
http.SetRequestHeader("Content-Type", "text/xml")
**carga el archivo
xml = fnArmaCadXml("A", "0091", "XXXX", "142", lcInFile64,
"CDDEmbargoM5.htm")
doc.LoadXML(xml)
http.Send(doc.xml)
res = CreateObject("MSXML2.DOMDocument")
response = http.responseText
*?response
res.LoadXML(http.responseText)
txt = res.selectSingleNode("//NroEnvioGenerado") &&Return
IF nvl(txt.text,' ') = " " THEN
TXT="ERROR EN WS "
ENDIF
wait window txt.text NOWAIT
*? txt.text
release doc
release http
release res
release response
RETURN
FUNCTION decodifica
PARAMETER pCadena
LOCAL lcBinary, lnHandle, lnSize
lnHandle = Base64DecoderCreate()
IF lnHandle > 0
Base64DecoderPut(lnHandle, pCadena)
Base64DecoderClose(lnHandle)
lnSize = Base64DecoderMaxRetrievable(lnHandle)
lcBinary = Base64DecoderGet(lnHandle, lnSize)
Base64DecoderDestroy(lnHandle)
ELSE
WAIT WIND "ERROR al instanciar"
RETURN .F.
ENDIF
RETURN lcBinary
FUNCTION codifica
PARAMETER pCadena
LOCAL lcBase64, lcInFile, lnHandle, lnSize
lnHandle = Base64EncoderCreate( .T. )
IF lnHandle > 0
Base64EncoderPut(lnHandle, pCadena)
Base64EncoderClose(lnHandle)
lnSize = Base64EncoderMaxRetrievable(lnHandle)
lcBase64 = Base64EncoderGet(lnHandle, lnSize)
Base64EncoderDestroy(lnHandle)
ELSE
WAIT WIND "ERROR al instanciar"
RETURN .F.
ENDIF
RETURN lcBase64
FUNCTION fnArmaCadXml
*********************
PARAMETER pTOpe, pOpe, pClave, pAdu, pArch, pNomArch
strxml = +
CHR(13)
strxml = strxml + [
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"] + CHR(13)
strxml = strxml + [ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"] +
CHR(13)
strxml = strxml + [ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">]
+ CHR(13)
strxml = strxml + [ <env:Header>] + CHR(13)
strxml = strxml + [ </env:Header>] + CHR(13)
strxml = strxml + [ <env:Body>] + CHR(13)
strxml = strxml + [ <m:enviaArchivoWebService
xmlns:m=" http://www.bea.com/education/webservice ... basic/java class"]
+ CHR(13)
strxml = strxml + [
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">] + CHR(13)
strxml = strxml + [ <toperador xsi:type="xsd:string">] + pTOpe +
+ CHR(13)
strxml = strxml + [ <operador xsi:type="xsd:string">] + pOpe +
+ CHR(13)
strxml = strxml + [ <clave xsi:type="xsd:string">] + pClave + +
CHR(13)
strxml = strxml + [ <aduana xsi:type="xsd:string">] + pAdu + +
CHR(13)
strxml = strxml + [ <archivoEnvioByte xsi:type="xsd:base64Binary">] + pArch
+ + CHR(13)
strxml = strxml + [ <nombreArchivo xsi:type="xsd:string">] + pNomArch+
[</nombreArchivo>] + CHR(13)
strxml = strxml + [ </m:enviaArchivoWebService>] + CHR(13)
strxml = strxml + [ </env:Body>] + CHR(13)
strxml = strxml + [</
Gracias por la Ayuda y felicitaciones por el gran trabajo realizado
Vladimir Zorrilla
cps_net@hotmail.com
Necesito implementar cliente SOAP con xailer
Alguien pueda darme una AYUDA
En este link esta lo que necesito hacer
http://www.aduanet.gob.pe/aduanas/opera ... Services.h tm
En VFP ya lo tienen listo
Web Services desde Visual Fox Pro
Este ejemplo lo pueden encontrar también en la siguiente ruta
http://www.aduanet.gob.pe/js/app/WebSer ... teWSVisual FoxPro.zip
junto con la librería FoxCrypto.fll.
La libreria FoxCrypto.fll contiene la función que codifica y decodifica en
base 64.,
el cual permite el trabajo tipo de datos bytes.
Prueba.prg
SET LIBRARY TO FoxCrypto.FLL
PROCEDURE psEnviArchivo
***********************
*envia archivo
PARAMETER pArc
tcInFile = IIF(EMPTY(pArc),"C:desaprgpruebaCDDEmbargoM4.htm", pArc)
lcInFile = FILETOSTR(tcInFile)
lcInFile64 = codifica(lcInFile)
***
doc = CreateObject("MSXML2.DOMDocument")
http = CreateObject("MSXML2.XMLHTTP")
http.Open("POST", "http://desweb1:8001/portafolio/portafolio", .F.)
http.SetRequestHeader("SOAPAction", "enviaArchivoWebService")
http.SetRequestHeader("Content-Type", "text/xml")
**carga el archivo
xml = fnArmaCadXml("A", "0091", "XXXX", "142", lcInFile64,
"CDDEmbargoM5.htm")
doc.LoadXML(xml)
http.Send(doc.xml)
res = CreateObject("MSXML2.DOMDocument")
response = http.responseText
*?response
res.LoadXML(http.responseText)
txt = res.selectSingleNode("//NroEnvioGenerado") &&Return
IF nvl(txt.text,' ') = " " THEN
TXT="ERROR EN WS "
ENDIF
wait window txt.text NOWAIT
*? txt.text
release doc
release http
release res
release response
RETURN
FUNCTION decodifica
PARAMETER pCadena
LOCAL lcBinary, lnHandle, lnSize
lnHandle = Base64DecoderCreate()
IF lnHandle > 0
Base64DecoderPut(lnHandle, pCadena)
Base64DecoderClose(lnHandle)
lnSize = Base64DecoderMaxRetrievable(lnHandle)
lcBinary = Base64DecoderGet(lnHandle, lnSize)
Base64DecoderDestroy(lnHandle)
ELSE
WAIT WIND "ERROR al instanciar"
RETURN .F.
ENDIF
RETURN lcBinary
FUNCTION codifica
PARAMETER pCadena
LOCAL lcBase64, lcInFile, lnHandle, lnSize
lnHandle = Base64EncoderCreate( .T. )
IF lnHandle > 0
Base64EncoderPut(lnHandle, pCadena)
Base64EncoderClose(lnHandle)
lnSize = Base64EncoderMaxRetrievable(lnHandle)
lcBase64 = Base64EncoderGet(lnHandle, lnSize)
Base64EncoderDestroy(lnHandle)
ELSE
WAIT WIND "ERROR al instanciar"
RETURN .F.
ENDIF
RETURN lcBase64
FUNCTION fnArmaCadXml
*********************
PARAMETER pTOpe, pOpe, pClave, pAdu, pArch, pNomArch
strxml = +
CHR(13)
strxml = strxml + [
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"] + CHR(13)
strxml = strxml + [ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"] +
CHR(13)
strxml = strxml + [ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">]
+ CHR(13)
strxml = strxml + [ <env:Header>] + CHR(13)
strxml = strxml + [ </env:Header>] + CHR(13)
strxml = strxml + [ <env:Body>] + CHR(13)
strxml = strxml + [ <m:enviaArchivoWebService
xmlns:m=" http://www.bea.com/education/webservice ... basic/java class"]
+ CHR(13)
strxml = strxml + [
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">] + CHR(13)
strxml = strxml + [ <toperador xsi:type="xsd:string">] + pTOpe +
+ CHR(13)
strxml = strxml + [ <operador xsi:type="xsd:string">] + pOpe +
+ CHR(13)
strxml = strxml + [ <clave xsi:type="xsd:string">] + pClave + +
CHR(13)
strxml = strxml + [ <aduana xsi:type="xsd:string">] + pAdu + +
CHR(13)
strxml = strxml + [ <archivoEnvioByte xsi:type="xsd:base64Binary">] + pArch
+ + CHR(13)
strxml = strxml + [ <nombreArchivo xsi:type="xsd:string">] + pNomArch+
[</nombreArchivo>] + CHR(13)
strxml = strxml + [ </m:enviaArchivoWebService>] + CHR(13)
strxml = strxml + [ </env:Body>] + CHR(13)
strxml = strxml + [</
Gracias por la Ayuda y felicitaciones por el gran trabajo realizado
Vladimir Zorrilla
cps_net@hotmail.com