Skip to content

Instantly share code, notes, and snippets.

@rcarloslima
Created November 16, 2018 21:59
Show Gist options
  • Save rcarloslima/a1f1f91f2bd3a083608ebb9d1168b2ee to your computer and use it in GitHub Desktop.
Save rcarloslima/a1f1f91f2bd3a083608ebb9d1168b2ee to your computer and use it in GitHub Desktop.
#Include "Totvs.ch"
/*/{Protheus.doc} TesteWs
( Exemplo pratico da classe TWsdlManager )
@type Class
@author Ruann Carlos
@since 03/05/2018
@version 1.0
@return ${return}, ${return_description}
@country Brasil
@database 11 - 12
@language PT-BR
/*/
User Function TesteWs()
Local oWsdl := TWsdlManager():New()
If !oWsdl:ParseUrl("http://10.4.0.80:8099/INTEGRATION.apw?WSDL")
Alert("Erro na conexao")
Else
If oWsdl:SetOperation( "CLIENTDATA" )
_cSoap := '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://10.4.0.80:8099/">'
_cSoap += ' <soapenv:Header/>'
_cSoap += ' <soapenv:Body>'
_cSoap += ' <ns:CLIENTDATA>'
_cSoap += ' <ns:LOGINCLIENTDATA>'
_cSoap += ' <ns:CPF>'+DecodeUTF8("00000000000")+'</ns:CPF>'
_cSoap += ' <ns:PASSWORD>'+DecodeUTF8("XPTO")+'</ns:PASSWORD>'
_cSoap += ' <ns:TOKEN>'+DecodeUTF8("XXXXXXXXXXX")+'</ns:TOKEN>'
_cSoap += ' </ns:LOGINCLIENTDATA>'
_cSoap += ' </ns:CLIENTDATA>'
_cSoap += ' </soapenv:Body>'
_cSoap += '</soapenv:Envelope>'
If oWsdl:SendSoapMsg( _cSoap )
MsgInfo( oWsdl:GetSoapResponse() )
Else
Alert( oWsdl:cError )
Endif
EndIf
EndIf
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment