× Linguagem de Programação ADVPL

Perguntas Consumir WebSevice Protheus

Mais
10 anos 4 meses atrás #24431 por giilardabreu
Boa Tarde

Alguem poderia me ajudar preciso consumir um webservice genrérico do protheus é uma rotina de simulação de frete:

NameSpace webservices.totvs.com.br/fwwsmodel.apw
URL Location http://192.168.0.3:8080/ws/
Nome do Serviço FWWSMODEL
Método do Serviço XMLSIMULATION


Requisição SOAP
<?xml version="1.0" encoding="utf-8"?"
<soap:Envelope xmlns:xsi=" www.w3.org/2001/XMLSchema-instance "
xmlns:xsd=" www.w3.org/2001/XMLSchema "
xmlns:soap=" schemas.xmlsoap.org/soap/envelope/ ">
<soap:Body>
<USERTOKEN>BASE64BINARY</USERTOKEN>
<MODELID>STRING</MODELID>
<MODELXML>BASE64BINARY</MODELXML>
</soap:Body>
</soap:Envelope>


Resposta da Requisição SOAP
<?xml version="1.0" encoding="utf-8"?"
<soap:Envelope xmlns:xsi=" www.w3.org/2001/XMLSchema-instance "
xmlns:xsd=" www.w3.org/2001/XMLSchema "
xmlns:soap=" schemas.xmlsoap.org/soap/envelope/ ">
<soap:Body>
<MODELXMLVALID>BASE64BINARY</MODELXMLVALID>
</soap:Body>
</soap:Envelope>


Meu XML que tenho que passar:
<GFEX010 Operation="3" version="1.01"><GFEX010_01 modeltype="FIELDS"><CONSNEG order="1"><value>1</value></CONSNEG><DETAIL_01 modeltype="GRID"><struct><GWN_NRROM order="1"></GWN_NRROM><GWN_CDTPOP order="2"></GWN_CDTPOP><GWN_CDCLFR order="3"></GWN_CDCLFR><GWN_CDTRP order="5"></GWN_CDTRP><GWN_CDTPVC order="7"></GWN_CDTPVC><GWN_DISTAN order="8"></GWN_DISTAN><GWN_NRCIDD order="9"></GWN_NRCIDD><GWN_CEPD order="11"></GWN_CEPD><GWN_DOC order="12"></GWN_DOC></struct><items><item id="1" deleted="0"><GWN_NRROM>1</GWN_NRROM> <GWN_CDTPOP>3</GWN_CDTPOP><GWN_CDTRP></GWN_CDTRP> <GWN_DOC>SIMULACAO</GWN_DOC> </item></items></DETAIL_01><DETAIL_02 modeltype="GRID"><struct><GW1_CDTPDC order="1"></GW1_CDTPDC><GW1_EMISDC order="2"></GW1_EMISDC><GW1_SERDC order="4"></GW1_SERDC><GW1_NRDC order="5"></GW1_NRDC><GW1_CDREM order="6"></GW1_CDREM><GW1_CDDEST order="8"></GW1_CDDEST><GW1_TPFRET order="10"></GW1_TPFRET><GW1_NRREG order="11"></GW1_NRREG><GW1_USO order="12"></GW1_USO><GW1_CARREG order="13"></GW1_CARREG><GW1_ENTEND order="14"></GW1_ENTEND><GW1_ENTBAI order="15"></GW1_ENTBAI><GW1_ENTCEP order="16"></GW1_ENTCEP><GW1_ENTNRC order="17"></GW1_ENTNRC><GW1_NRROM order="19"></GW1_NRROM><GW1_ICMSDC order="20"></GW1_ICMSDC><GW1_QTUNI order="21"></GW1_QTUNI></struct><items><item deleted="0" id="1"><GW1_CDTPDC>NFS</GW1_CDTPDC><GW1_EMISDC>1</GW1_EMISDC><GW1_SERDC></GW1_SERDC><GW1_NRDC>-6939</GW1_NRDC><GW1_CDREM>1</GW1_CDREM><GW1_CDDEST>4</GW1_CDDEST><GW1_TPFRET>1</GW1_TPFRET><GW1_NRREG>0</GW1_NRREG><GW1_USO>1</GW1_USO><GW1_CARREG>0</GW1_CARREG><GW1_ENTEND></GW1_ENTEND><GW1_ENTBAI></GW1_ENTBAI><GW1_ENTCEP></GW1_ENTCEP><GW1_ENTNRC></GW1_ENTNRC><GW1_NRROM>1</GW1_NRROM><GW1_ICMSDC>2</GW1_ICMSDC><GW1_QTUNI>1</GW1_QTUNI></item></items></DETAIL_02><DETAIL_03 modeltype="GRID"><struct><GW8_CDTPDC order="1"></GW8_CDTPDC><GW8_EMISDC order="2"></GW8_EMISDC><GW8_SERDC order="3"></GW8_SERDC><GW8_NRDC order="4"></GW8_NRDC><GW8_ITEM order="5"></GW8_ITEM><GW8_DSITEM order="6"></GW8_DSITEM><GW8_CDCLFR order="7"></GW8_CDCLFR><GW8_QTDE order="9"></GW8_QTDE><GW8_VALOR order="10"></GW8_VALOR><GW8_VOLUME order="11"></GW8_VOLUME><GW8_PESOR order="12"></GW8_PESOR><GW8_PESOC order="13"></GW8_PESOC><GW8_TPITEM order="14"></GW8_TPITEM><GW8_TRIBP order="16"></GW8_TRIBP><GW8_TRIBC order="17"></GW8_TRIBC></struct><items><item deleted="0" id="1"><GW8_CDTPDC>NFS</GW8_CDTPDC><GW8_EMISDC>1</GW8_EMISDC><GW8_SERDC></GW8_SERDC><GW8_NRDC>-6939</GW8_NRDC><GW8_ITEM>2</GW8_ITEM><GW8_DSITEM>ITEM GENERICO</GW8_DSITEM><GW8_CDCLFR>2</GW8_CDCLFR><GW8_QTDE>15.00000</GW8_QTDE><GW8_VALOR>1500.00</GW8_VALOR><GW8_VOLUME>0.00020</GW8_VOLUME><GW8_PESOR>15.00000</GW8_PESOR><GW8_PESOC>0.00000</GW8_PESOC><GW8_TPITEM></GW8_TPITEM><GW8_TRIBP>1</GW8_TRIBP><GW8_TRIBC>1</GW8_TRIBC></item></items></DETAIL_03><DETAIL_04 modeltype="GRID"><struct><GWU_CDTPDC order="1"></GWU_CDTPDC><GWU_EMISDC order="2"></GWU_EMISDC><GWU_SEQ order="3"></GWU_SEQ><GWU_SERDC order="4"></GWU_SERDC><GWU_NRDC order="5"></GWU_NRDC><GWU_CDTRP order="6"></GWU_CDTRP><GWU_NRCIDD order="8"></GWU_NRCIDD><GWU_CDTPVC order="10"></GWU_CDTPVC><GWU_DTPENT order="11"></GWU_DTPENT></struct><items><item deleted="0" id="1"><GWU_CDTPDC>NFS</GWU_CDTPDC><GWU_EMISDC>1</GWU_EMISDC><GWU_SEQ>1</GWU_SEQ><GWU_SERDC></GWU_SERDC><GWU_NRDC>-6939</GWU_NRDC><GWU_CDTRP>250</GWU_CDTRP><GWU_NRCIDD>100002</GWU_NRCIDD></item><item deleted="0" id="2"><GWU_CDTPDC>NFS</GWU_CDTPDC><GWU_EMISDC>1</GWU_EMISDC><GWU_SEQ>2</GWU_SEQ><GWU_SERDC></GWU_SERDC><GWU_NRDC>-6939</GWU_NRDC><GWU_CDTRP>250</GWU_CDTRP><GWU_NRCIDD>100003</GWU_NRCIDD></item></items></DETAIL_04><SIMULA modeltype="FIELDS"><INTEGRA order="1"><value>A</value></INTEGRA></SIMULA></GFEX010_01></GFEX010>


desde já orbrigado

Por favor Acessar ou Registrar para participar da conversa.

Mais
10 anos 4 meses atrás #24433 por kanaamlrr
Respondido por kanaamlrr no tópico Consumir WebSevice Protheus
Dentro do dev studio crie um arquivo em branco e clique em "Ferramentas->Gerar Client WebService"
Em seguida coloque o endereço do seu WSDL.
Dessa forma ele irá cria um client que consumirá o WS.
Depois isso basta criar um objeto com esse cliet gerado e trabalhar as informações.

Se tiver dúvidas de como criar esse objeto, poste o código do client aqui que vou te ajudando.
Abraço!

Por favor Acessar ou Registrar para participar da conversa.

Mais
10 anos 3 meses atrás #24676 por giilardabreu
Respondido por giilardabreu no tópico Consumir WebSevice Protheus
Boa Tarde.
Obrigado pela ajuda, segue o fonte a minha dúvida é como passar a string xml, está dando o seguinte erro: FWWSMODEL: XMLSIMULATION: Schema: Unable to parse Xml Content

#INCLUDE "PROTHEUS.CH"
#INCLUDE "APWEBSRV.CH"

/* ===============================================================================
WSDL Location http://192.168.0.3:8080/ws/FWWSMODEL.apw?WSDL
Gerado em 08/15/14 13:31:22
Observações Código-Fonte gerado por ADVPL WSDL Client 1.120703
Alterações neste arquivo podem causar funcionamento incorreto
e serão perdidas caso o código-fonte seja gerado novamente.
=============================================================================== */

User Function _JNYENQX ; Return // "dummy" function - Internal Use

/*
WSDL Service WSFWWSMODEL
*/

WSCLIENT WSFWWSMODEL2

WSMETHOD NEW
WSMETHOD INIT
WSMETHOD RESET
WSMETHOD CLONE
WSMETHOD GETDESCRIPTION
WSMETHOD GETJSONDATA
WSMETHOD GETJSONDATADETAIL
WSMETHOD GETSCHEMA
WSMETHOD GETSCHEMATABLE
WSMETHOD GETXMLDATA
WSMETHOD GETXMLDATADETAIL
WSMETHOD GETXMLDATAEX
WSMETHOD GETXMLDATATABLE
WSMETHOD GETXMLDATAUPDATE
WSMETHOD LOGIN
WSMETHOD PUTXMLDATA
WSMETHOD PUTXMLDATAEX
WSMETHOD PUTXMLDATATABLE
WSMETHOD VLDXMLDATA
WSMETHOD VLDXMLDATATABLE
WSMETHOD XMLSIMULATION

WSDATA _URL AS String
WSDATA _HEADOUT AS Array of String
WSDATA _COOKIES AS Array of String
WSDATA cUSERLOGIN AS string
WSDATA cMODELID AS string
WSDATA cGETDESCRIPTIONRESULT AS string
WSDATA cUSERTOKEN AS base64Binary
WSDATA cTABLE AS string
WSDATA cGETJSONDATARESULT AS base64Binary
WSDATA cGETJSONDATADETAILRESULT AS base64Binary
WSDATA cGETSCHEMARESULT AS base64Binary
WSDATA cGETSCHEMATABLERESULT AS base64Binary
WSDATA cGETXMLDATARESULT AS base64Binary
WSDATA cGETXMLDATADETAILRESULT AS base64Binary
WSDATA lVIRTUAL AS boolean
WSDATA cGETXMLDATAEXRESULT AS base64Binary
WSDATA cGETXMLDATATABLERESULT AS base64Binary
WSDATA cMODELPK AS string
WSDATA cGETXMLDATAUPDATERESULT AS base64Binary
WSDATA cPASSWORD AS base64Binary
WSDATA cLOGINRESULT AS base64Binary
WSDATA cMODELXML AS base64Binary
WSDATA lPUTXMLDATARESULT AS boolean
WSDATA cPUTXMLDATAEXRESULT AS base64Binary
WSDATA lPUTXMLDATATABLERESULT AS boolean
WSDATA cVLDXMLDATARESULT AS base64Binary
WSDATA cVLDXMLDATATABLERESULT AS base64Binary
WSDATA cXMLSIMULATIONRESULT AS base64Binary

ENDWSCLIENT

WSMETHOD NEW WSCLIENT WSFWWSMODEL2
::Init()
If !FindFunction("XMLCHILDEX")
UserException("O Código-Fonte Client atual requer os executáveis do Protheus Build [7.00.121227P-20131106] ou superior. Atualize o Protheus ou gere o Código-Fonte novamente utilizando o Build atual.")
EndIf
Return Self

WSMETHOD INIT WSCLIENT WSFWWSMODEL2
Return

WSMETHOD RESET WSCLIENT WSFWWSMODEL2
::cUSERLOGIN := NIL
::cMODELID := NIL
::cGETDESCRIPTIONRESULT := NIL
::cUSERTOKEN := NIL
::cTABLE := NIL
::cGETJSONDATARESULT := NIL
::cGETJSONDATADETAILRESULT := NIL
::cGETSCHEMARESULT := NIL
::cGETSCHEMATABLERESULT := NIL
::cGETXMLDATARESULT := NIL
::cGETXMLDATADETAILRESULT := NIL
::lVIRTUAL := NIL
::cGETXMLDATAEXRESULT := NIL
::cGETXMLDATATABLERESULT := NIL
::cMODELPK := NIL
::cGETXMLDATAUPDATERESULT := NIL
::cPASSWORD := NIL
::cLOGINRESULT := NIL
::cMODELXML := NIL
::lPUTXMLDATARESULT := NIL
::cPUTXMLDATAEXRESULT := NIL
::lPUTXMLDATATABLERESULT := NIL
::cVLDXMLDATARESULT := NIL
::cVLDXMLDATATABLERESULT := NIL
::cXMLSIMULATIONRESULT := NIL
::Init()
Return

WSMETHOD CLONE WSCLIENT WSFWWSMODEL2
Local oClone := WSFWWSMODEL2():New()
oClone:_URL := ::_URL
oClone:cUSERLOGIN := ::cUSERLOGIN
oClone:cMODELID := ::cMODELID
oClone:cGETDESCRIPTIONRESULT := ::cGETDESCRIPTIONRESULT
oClone:cUSERTOKEN := ::cUSERTOKEN
oClone:cTABLE := ::cTABLE
oClone:cGETJSONDATARESULT := ::cGETJSONDATARESULT
oClone:cGETJSONDATADETAILRESULT := ::cGETJSONDATADETAILRESULT
oClone:cGETSCHEMARESULT := ::cGETSCHEMARESULT
oClone:cGETSCHEMATABLERESULT := ::cGETSCHEMATABLERESULT
oClone:cGETXMLDATARESULT := ::cGETXMLDATARESULT
oClone:cGETXMLDATADETAILRESULT := ::cGETXMLDATADETAILRESULT
oClone:lVIRTUAL := ::lVIRTUAL
oClone:cGETXMLDATAEXRESULT := ::cGETXMLDATAEXRESULT
oClone:cGETXMLDATATABLERESULT := ::cGETXMLDATATABLERESULT
oClone:cMODELPK := ::cMODELPK
oClone:cGETXMLDATAUPDATERESULT := ::cGETXMLDATAUPDATERESULT
oClone:cPASSWORD := ::cPASSWORD
oClone:cLOGINRESULT := ::cLOGINRESULT
oClone:cMODELXML := ::cMODELXML
oClone:lPUTXMLDATARESULT := ::lPUTXMLDATARESULT
oClone:cPUTXMLDATAEXRESULT := ::cPUTXMLDATAEXRESULT
oClone:lPUTXMLDATATABLERESULT := ::lPUTXMLDATATABLERESULT
oClone:cVLDXMLDATARESULT := ::cVLDXMLDATARESULT
oClone:cVLDXMLDATATABLERESULT := ::cVLDXMLDATATABLERESULT
oClone:cXMLSIMULATIONRESULT := ::cXMLSIMULATIONRESULT
Return oClone

// WSDL Method GETDESCRIPTION of Service WSFWWSMODEL2

WSMETHOD GETDESCRIPTION WSSEND cUSERLOGIN,cMODELID WSRECEIVE cGETDESCRIPTIONRESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETDESCRIPTION xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERLOGIN", ::cUSERLOGIN, cUSERLOGIN , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETDESCRIPTION>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETDESCRIPTION ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETDESCRIPTIONRESULT := WSAdvValue( oXmlRet,"_GETDESCRIPTIONRESPONSE:_GETDESCRIPTIONRESULT:TEXT","string",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method GETJSONDATA of Service WSFWWSMODEL2

WSMETHOD GETJSONDATA WSSEND cUSERTOKEN,cMODELID,cTABLE WSRECEIVE cGETJSONDATARESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETJSONDATA xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("TABLE", ::cTABLE, cTABLE , "string", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETJSONDATA>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETJSONDATA ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETJSONDATARESULT := WSAdvValue( oXmlRet,"_GETJSONDATARESPONSE:_GETJSONDATARESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method GETJSONDATADETAIL of Service WSFWWSMODEL2

WSMETHOD GETJSONDATADETAIL WSSEND cUSERTOKEN,cMODELID,cTABLE WSRECEIVE cGETJSONDATADETAILRESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETJSONDATADETAIL xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("TABLE", ::cTABLE, cTABLE , "string", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETJSONDATADETAIL>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETJSONDATADETAIL ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETJSONDATADETAILRESULT := WSAdvValue( oXmlRet,"_GETJSONDATADETAILRESPONSE:_GETJSONDATADETAILRESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method GETSCHEMA of Service WSFWWSMODEL2

WSMETHOD GETSCHEMA WSSEND cUSERTOKEN,cMODELID WSRECEIVE cGETSCHEMARESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETSCHEMA xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETSCHEMA>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETSCHEMA ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETSCHEMARESULT := WSAdvValue( oXmlRet,"_GETSCHEMARESPONSE:_GETSCHEMARESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method GETSCHEMATABLE of Service WSFWWSMODEL2

WSMETHOD GETSCHEMATABLE WSSEND cUSERTOKEN,cTABLE,cMODELID WSRECEIVE cGETSCHEMATABLERESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETSCHEMATABLE xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("TABLE", ::cTABLE, cTABLE , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETSCHEMATABLE>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETSCHEMATABLE ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETSCHEMATABLERESULT := WSAdvValue( oXmlRet,"_GETSCHEMATABLERESPONSE:_GETSCHEMATABLERESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method GETXMLDATA of Service WSFWWSMODEL2

WSMETHOD GETXMLDATA WSSEND cUSERTOKEN,cMODELID WSRECEIVE cGETXMLDATARESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETXMLDATA xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETXMLDATA>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETXMLDATA ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETXMLDATARESULT := WSAdvValue( oXmlRet,"_GETXMLDATARESPONSE:_GETXMLDATARESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method GETXMLDATADETAIL of Service WSFWWSMODEL2

WSMETHOD GETXMLDATADETAIL WSSEND cUSERTOKEN,cMODELID WSRECEIVE cGETXMLDATADETAILRESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETXMLDATADETAIL xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETXMLDATADETAIL>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETXMLDATADETAIL ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETXMLDATADETAILRESULT := WSAdvValue( oXmlRet,"_GETXMLDATADETAILRESPONSE:_GETXMLDATADETAILRESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method GETXMLDATAEX of Service WSFWWSMODEL2

WSMETHOD GETXMLDATAEX WSSEND cUSERTOKEN,cMODELID,lVIRTUAL WSRECEIVE cGETXMLDATAEXRESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETXMLDATAEX xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("VIRTUAL", ::lVIRTUAL, lVIRTUAL , "boolean", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETXMLDATAEX>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETXMLDATAEX ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETXMLDATAEXRESULT := WSAdvValue( oXmlRet,"_GETXMLDATAEXRESPONSE:_GETXMLDATAEXRESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method GETXMLDATATABLE of Service WSFWWSMODEL2

WSMETHOD GETXMLDATATABLE WSSEND cUSERTOKEN,cTABLE,cMODELID WSRECEIVE cGETXMLDATATABLERESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETXMLDATATABLE xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("TABLE", ::cTABLE, cTABLE , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETXMLDATATABLE>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETXMLDATATABLE ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETXMLDATATABLERESULT := WSAdvValue( oXmlRet,"_GETXMLDATATABLERESPONSE:_GETXMLDATATABLERESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method GETXMLDATAUPDATE of Service WSFWWSMODEL2

WSMETHOD GETXMLDATAUPDATE WSSEND cUSERTOKEN,cMODELID,cMODELPK WSRECEIVE cGETXMLDATAUPDATERESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<GETXMLDATAUPDATE xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELPK", ::cMODELPK, cMODELPK , "string", .T. , .F., 0 , NIL, .F.)
cSoap += "</GETXMLDATAUPDATE>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/GETXMLDATAUPDATE ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cGETXMLDATAUPDATERESULT := WSAdvValue( oXmlRet,"_GETXMLDATAUPDATERESPONSE:_GETXMLDATAUPDATERESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method LOGIN of Service WSFWWSMODEL2

WSMETHOD LOGIN WSSEND cUSERLOGIN,cPASSWORD WSRECEIVE cLOGINRESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<LOGIN xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERLOGIN", ::cUSERLOGIN, cUSERLOGIN , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("PASSWORD", ::cPASSWORD, cPASSWORD , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += "</LOGIN>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/LOGIN ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cLOGINRESULT := WSAdvValue( oXmlRet,"_LOGINRESPONSE:_LOGINRESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method PUTXMLDATA of Service WSFWWSMODEL2

WSMETHOD PUTXMLDATA WSSEND cUSERTOKEN,cMODELID,cMODELXML WSRECEIVE lPUTXMLDATARESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<PUTXMLDATA xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELXML", ::cMODELXML, cMODELXML , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += "</PUTXMLDATA>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/PUTXMLDATA ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::lPUTXMLDATARESULT := WSAdvValue( oXmlRet,"_PUTXMLDATARESPONSE:_PUTXMLDATARESULT:TEXT","boolean",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method PUTXMLDATAEX of Service WSFWWSMODEL2

WSMETHOD PUTXMLDATAEX WSSEND cUSERTOKEN,cMODELID,cMODELXML,lVIRTUAL WSRECEIVE cPUTXMLDATAEXRESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<PUTXMLDATAEX xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELXML", ::cMODELXML, cMODELXML , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("VIRTUAL", ::lVIRTUAL, lVIRTUAL , "boolean", .T. , .F., 0 , NIL, .F.)
cSoap += "</PUTXMLDATAEX>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/PUTXMLDATAEX ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cPUTXMLDATAEXRESULT := WSAdvValue( oXmlRet,"_PUTXMLDATAEXRESPONSE:_PUTXMLDATAEXRESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method PUTXMLDATATABLE of Service WSFWWSMODEL2

WSMETHOD PUTXMLDATATABLE WSSEND cUSERTOKEN,cTABLE,cMODELID,cMODELXML WSRECEIVE lPUTXMLDATATABLERESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<PUTXMLDATATABLE xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("TABLE", ::cTABLE, cTABLE , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELXML", ::cMODELXML, cMODELXML , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += "</PUTXMLDATATABLE>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/PUTXMLDATATABLE ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::lPUTXMLDATATABLERESULT := WSAdvValue( oXmlRet,"_PUTXMLDATATABLERESPONSE:_PUTXMLDATATABLERESULT:TEXT","boolean",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method VLDXMLDATA of Service WSFWWSMODEL2

WSMETHOD VLDXMLDATA WSSEND cUSERTOKEN,cMODELID,cMODELXML WSRECEIVE cVLDXMLDATARESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<VLDXMLDATA xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELXML", ::cMODELXML, cMODELXML , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += "</VLDXMLDATA>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/VLDXMLDATA ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cVLDXMLDATARESULT := WSAdvValue( oXmlRet,"_VLDXMLDATARESPONSE:_VLDXMLDATARESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method VLDXMLDATATABLE of Service WSFWWSMODEL2

WSMETHOD VLDXMLDATATABLE WSSEND cUSERTOKEN,cTABLE,cMODELID,cMODELXML WSRECEIVE cVLDXMLDATATABLERESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<VLDXMLDATATABLE xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("TABLE", ::cTABLE, cTABLE , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELXML", ::cMODELXML, cMODELXML , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += "</VLDXMLDATATABLE>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/VLDXMLDATATABLE ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cVLDXMLDATATABLERESULT := WSAdvValue( oXmlRet,"_VLDXMLDATATABLERESPONSE:_VLDXMLDATATABLERESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

// WSDL Method XMLSIMULATION of Service WSFWWSMODEL2

WSMETHOD XMLSIMULATION WSSEND cUSERTOKEN,cMODELID,cMODELXML WSRECEIVE cXMLSIMULATIONRESULT WSCLIENT WSFWWSMODEL2
Local cSoap := "" , oXmlRet

BEGIN WSMETHOD

cSoap += '<XMLSIMULATION xmlns=" webservices.totvs.com.br/fwwsmodel.apw ">'
cSoap += WSSoapValue("USERTOKEN", ::cUSERTOKEN, cUSERTOKEN , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELID", ::cMODELID, cMODELID , "string", .T. , .F., 0 , NIL, .F.)
cSoap += WSSoapValue("MODELXML", ::cMODELXML, cMODELXML , "base64Binary", .T. , .F., 0 , NIL, .F.)
cSoap += "</XMLSIMULATION>"

oXmlRet := SvcSoapCall( Self,cSoap,;
" webservices.totvs.com.br/fwwsmodel.apw/XMLSIMULATION ",;
"DOCUMENT"," webservices.totvs.com.br/fwwsmodel.apw",,"1.031217 ",;
"http://192.168.0.3:8080/ws/FWWSMODEL.apw")

::Init()
::cXMLSIMULATIONRESULT := WSAdvValue( oXmlRet,"_XMLSIMULATIONRESPONSE:_XMLSIMULATIONRESULT:TEXT","base64Binary",NIL,NIL,NIL,NIL,NIL,NIL)

END WSMETHOD

oXmlRet := NIL
Return .T.

**********************************************
user function fSimula()
**********************************************
Local oMVCWS
Local cXML := ""

// Instancia o WebService Genérico para Rotinas em MVC
oMVCWS := WSFWWSMODEL2():New()

cXML := '<?xml version="1.0"?>'
cXML += '<GFEX010 Operation="3" version="1.01">'
cXML += '<GFEX010_01 modeltype="FIELDS">'
cXML += '<CONSNEG order="1"><value>1</value></CONSNEG>'

//nao obrigatorio
cXML += '<DETAIL_01 modeltype="GRID">'
cXML += '<struct>'
cXML += '<GWN_NRROM order="1"></GWN_NRROM>'
cXML += '<GWN_CDTPOP order="2"></GWN_CDTPOP>'
cXML += '<GWN_CDCLFR order="3"></GWN_CDCLFR>'
cXML += '<GWN_CDTRP order="5"></GWN_CDTRP>'
cXML += '<GWN_CDTPVC order="7"></GWN_CDTPVC>'
cXML += '<GWN_DISTAN order="8"></GWN_DISTAN>'
cXML += '<GWN_NRCIDD order="9"></GWN_NRCIDD>'
cXML += '<GWN_CEPD order="11"></GWN_CEPD>'
cXML += '<GWN_DOC order="12"></GWN_DOC>'
cXML += '</struct>'
cXML += '<items>'
cXML += '<item id="1" deleted="0">'
cXML += '<GWN_NRROM>00000000</GWN_NRROM>'
cXML += '<GWN_CDTPOP></GWN_CDTPOP>'
cXML += '<GWN_CDTRP></GWN_CDTRP>'
cXML += '<GWN_DOC>SIMULACAO</GWN_DOC>'
cXML += '</item>'
cXML += '</items>'
cXML += '</DETAIL_01>'


//Doc Carga, Remetente e Destinatario
cXML += '<DETAIL_02 modeltype="GRID">'
cXML += '<struct>'
cXML += '<GW1_CDTPDC order="1"></GW1_CDTPDC>'
cXML += '<GW1_EMISDC order="2"></GW1_EMISDC>'
cXML += '<GW1_SERDC order="4"></GW1_SERDC>'
cXML += '<GW1_NRDC order="5"></GW1_NRDC>'
cXML += '<GW1_CDREM order="6"></GW1_CDREM>'
cXML += '<GW1_CDDEST order="8"></GW1_CDDEST>'
cXML += '<GW1_TPFRET order="10"></GW1_TPFRET>'
cXML += '<GW1_NRREG order="11"></GW1_NRREG>'
cXML += '<GW1_USO order="12"></GW1_USO>'
cXML += '<GW1_CARREG order="13"></GW1_CARREG>'
cXML += '<GW1_ENTEND order="14"></GW1_ENTEND>'
cXML += '<GW1_ENTBAI order="15"></GW1_ENTBAI>'
cXML += '<GW1_ENTCEP order="16"></GW1_ENTCEP>'
cXML += '<GW1_ENTNRC order="17"></GW1_ENTNRC>'
cXML += '<GW1_NRROM order="19"></GW1_NRROM>'
cXML += '<GW1_ICMSDC order="20"></GW1_ICMSDC>'
cXML += '<GW1_QTUNI order="21"></GW1_QTUNI>'
cXML += '</struct>'
cXML += '<items>'
cXML += '<item deleted="0" id="1">'
cXML += '<GW1_CDTPDC>NFS</GW1_CDTPDC>'
cXML += '<GW1_EMISDC>30560205000192</GW1_EMISDC>'
cXML += '<GW1_SERDC></GW1_SERDC>'
cXML += '<GW1_NRDC>-6939</GW1_NRDC>'
cXML += '<GW1_CDREM>30560205000192</GW1_CDREM>' //CODIGO REMETENTE
cXML += '<GW1_CDDEST>80148356000106</GW1_CDDEST>' //CÓDIGO DESTINATARIO
cXML += '<GW1_TPFRET>1</GW1_TPFRET>'
cXML += '<GW1_NRREG></GW1_NRREG>'
cXML += '<GW1_USO>1</GW1_USO>'
cXML += '<GW1_CARREG></GW1_CARREG>'
cXML += '<GW1_ENTEND></GW1_ENTEND>'
cXML += '<GW1_ENTBAI></GW1_ENTBAI>'
cXML += '<GW1_ENTCEP></GW1_ENTCEP>'
cXML += '<GW1_ENTNRC></GW1_ENTNRC>'
cXML += '<GW1_NRROM>00000000</GW1_NRROM>'
cXML += '<GW1_ICMSDC>2</GW1_ICMSDC>'
cXML += '<GW1_QTUNI>1</GW1_QTUNI>'
cXML += '</item>'
cXML += '</items>'
cXML += '</DETAIL_02>'

//Item da Carga (PRODUTOS)
cXML += '<DETAIL_03 modeltype="GRID">'
cXML += '<struct>'
cXML += '<GW8_CDTPDC order="1"></GW8_CDTPDC>'
cXML += '<GW8_EMISDC order="2"></GW8_EMISDC>'
cXML += '<GW8_SERDC order="3"></GW8_SERDC>'
cXML += '<GW8_NRDC order="4"></GW8_NRDC>'
cXML += '<GW8_ITEM order="5"></GW8_ITEM>'
cXML += '<GW8_DSITEM order="6"></GW8_DSITEM>'
cXML += '<GW8_CDCLFR order="7"></GW8_CDCLFR>'
cXML += '<GW8_QTDE order="9"></GW8_QTDE>'
cXML += '<GW8_VALOR order="10"></GW8_VALOR>'
cXML += '<GW8_VOLUME order="11"></GW8_VOLUME>'
cXML += '<GW8_PESOR order="12"></GW8_PESOR>'
cXML += '<GW8_PESOC order="13"></GW8_PESOC>'
cXML += '<GW8_TPITEM order="14"></GW8_TPITEM>'
cXML += '<GW8_TRIBP order="16"></GW8_TRIBP>'
cXML += '<GW8_TRIBC order="17"></GW8_TRIBC>'
cXML += '</struct>'
cXML += '<items>'
cXML += '<item deleted="0" id="1">'
cXML += '<GW8_CDTPDC>NFS</GW8_CDTPDC>' //TIPO DOCUMENTO
cXML += '<GW8_EMISDC>30560205000192</GW8_EMISDC>' //EMISSOR DOCUMENTO
cXML += '<GW8_SERDC></GW8_SERDC>' //SERIE DOCUMENTO
cXML += '<GW8_NRDC>6939</GW8_NRDC>' //NUMERO DOCUMENTO
cXML += '<GW8_ITEM>2</GW8_ITEM>' //ITEM
cXML += '<GW8_DSITEM>ITEM GENERICO</GW8_DSITEM>' //DESCRICAO DO ITEM
cXML += '<GW8_CDCLFR>0001</GW8_CDCLFR>' //CLASSIFICAÇÃO DE FRETE
cXML += '<GW8_QTDE>40.00000</GW8_QTDE>' //QUANTIDADE
cXML += '<GW8_VALOR>184.00</GW8_VALOR>' //VALOR
cXML += '<GW8_VOLUME>0.00000</GW8_VOLUME>' //VOLUME M3
cXML += '<GW8_PESOR>3.52000</GW8_PESOR>' //PESO REAL
cXML += '<GW8_PESOC>0.00000</GW8_PESOC>' //PESO CUBADO
cXML += '<GW8_TPITEM></GW8_TPITEM>' //TIPO ITEM TRIBUTAÇÃO
cXML += '<GW8_TRIBP>1</GW8_TRIBP>' //FRETE TRIBUTADO PIS
cXML += '<GW8_TRIBC>1</GW8_TRIBC>' //FRETE TRIBUTADO COFINS
cXML += '</item>'
cXML += '</items>'
cXML += '</DETAIL_03>'
cXML += '<DETAIL_04 modeltype="GRID">'
cXML += '<struct>'
cXML += '<GWU_CDTPDC order="1"></GWU_CDTPDC>'
cXML += '<GWU_EMISDC order="2"></GWU_EMISDC>'
cXML += '<GWU_SEQ order="3"></GWU_SEQ>'
cXML += '<GWU_SERDC order="4"></GWU_SERDC>'
cXML += '<GWU_NRDC order="5"></GWU_NRDC>'
cXML += '<GWU_CDTRP order="6"></GWU_CDTRP>'
cXML += '<GWU_NRCIDD order="8"></GWU_NRCIDD>'
cXML += '<GWU_CDTPVC order="10"></GWU_CDTPVC>'
cXML += '<GWU_DTPENT order="11"></GWU_DTPENT>'
cXML += '</struct>'
cXML += '<items>'
cXML += '<item deleted="0" id="1">'
cXML += '<GWU_CDTPDC>NFS</GWU_CDTPDC>'
cXML += '<GWU_EMISDC>30560205000192</GWU_EMISDC>'
cXML += '<GWU_SEQ>1</GWU_SEQ>'
cXML += '<GWU_SERDC></GWU_SERDC>'
cXML += '<GWU_NRDC>-6939</GWU_NRDC>'
cXML += '<GWU_CDTRP>95591723011404</GWU_CDTRP>' //CODIGO TRANSPORTADORA
cXML += '<GWU_NRCIDD>09102</GWU_NRCIDD>' //CIDADE DESTINATARIO
cXML += '</item>'
cXML += '</DETAIL_04>'
cXML += '<SIMULA modeltype="FIELDS">'
cXML += '<INTEGRA order="1"><value>A</value></INTEGRA>'
cXML += '</SIMULA>'
cXML += '</GFEX010_01>'
cXML += '</GFEX010>'

oMVCWS:CUSERTOKEN := ""
oMVCWS:CMODELID := "GFEX010"
oMVCWS:CMODELXML := cXML

// OCORRE O ERRO JÁ AQUI
If oMVCWS:XMLSIMULATION()

// Retorno da GetXMLData
/*cXMLEstrut := oMVCWS:cGetXMLDataResult

// Obtém o esquema de dados XML (XSD)
If oMVCWS:GetSchema()
cXMLEsquema := oMVCWS:cGetSchemaResult
EndIf
*/
Else
MsgStop( AllTrim( oMVCWS:cVldXMLDataResult ) + CRLF + WSError() )
return
EndIf

return(.T.)

Static Function WSError()
Return IIf( Empty( GetWscError(3) ), GetWscError(1), GetWscError(3) )

Por favor Acessar ou Registrar para participar da conversa.

Mais
10 anos 3 meses atrás #24680 por kanaamlrr
Respondido por kanaamlrr no tópico Consumir WebSevice Protheus
Esse erro normalmente é gerado por conta do XML estar com uma estrutura incorreta.
Verifique se todas as tags estão sendo fechadas corretamente e os dados que estão contidos nelas...

Por favor Acessar ou Registrar para participar da conversa.

Mais
10 anos 3 meses atrás #24775 por giilardabreu
Respondido por giilardabreu no tópico Consumir WebSevice Protheus
Ok, obrigado, realmente estava errado.
Agora estou com problema no retorno, mais ai é com a TOTVS. Pois não está retornando os valores de frete.
Muito obrigado pela Ajuda.

Por favor Acessar ou Registrar para participar da conversa.

Tempo para a criação da página:0.149 segundos
Joomla templates by a4joomla