Created
May 12, 2017 20:52
-
-
Save viniciusgati/d442310070776e40b8e194dbf6b3a9be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#INCLUDE "TOTVS.CH" | |
#INCLUDE "RESTFUL.CH" | |
WSRESTFUL ProcessPartsPickList DESCRIPTION "Manutenção de Listas de peças" FORMAT "application/xml,text/xml,text/html" | |
WSMETHOD POST DESCRIPTION 'Recebe e grava a pick list do usuário' | |
WSMETHOD GET DESCRIPTION 'Recebe e grava a pick list do usuário' | |
END WSRESTFUL | |
WSMETHOD POST WSREST ProcessPartsPickList | |
conout('post recebido com sucesso') | |
SetRestFault(002, "Teste fault") | |
Return .T. | |
WSMETHOD GET WSREST ProcessPartsPickList | |
conout('ok get request recebida') | |
SetRestFault(002, "Teste fault") | |
oLog := DMS_Logger():New('rest_debug.log') | |
oLog:Log( {'TIMESTAMP', Self:GetContent()} ) | |
oLog:Log( {''} ) | |
oObj := DMS_XMLPMPRO():New( Self:GetContent() ) | |
if oObj:Ok() | |
oResp := oObj:GetObjectResponse() | |
cResp := '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns="http://snaponbusinesssolutions.com/3/ProcessPartsPickList.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>' | |
cResp += oResp:getResponse() | |
cResp += '</soap:Body></soap:Envelope>' | |
Self:SetResponse(cResp) | |
conout(" - resposta ok : " + LEFT(cResp, 50) ) | |
else | |
SetRestFault(002, "Teste fault") | |
end | |
Return .T. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment