PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 24 → Android, Soap, and WinDev Mobile 18
Android, Soap, and WinDev Mobile 18
Débuté par rob, 08 oct. 2013 19:14 - 4 réponses
Membre enregistré
98 messages
Posté le 08 octobre 2013 - 19:14
So, I just found out that WinDev 18 doesn't have either of the SOAPRUN or SOAPRUNXML functions for android.

Any suggestions on how to call a soap procedure from a WebDev web service?
Posté le 08 octobre 2013 - 20:42
Hi Rob

you could jus look at how SOAP works on wikipedia (which I jus did,
following your question) and find out that:

SOAP, originally defined as Simple Object Access Protocol, is a protocol
specification for exchanging structured information in the
implementation of Web Services in computer networks. It relies on XML
Information Set for its message format, and usually relies on other
Application Layer protocols, most notably Hypertext Transfer Protocol
(HTTP) or Simple Mail Transfer Protocol (SMTP), for message negotiation
and transmission.

So, this means that basically httprequest for the transport of data and
XML function for the processing of the message should do the trick

Best regards


--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com



On 10/8/2013 11:14 AM, rob wrote:
So, I just found out that WinDev 18 doesn't have either of the SOAPRUN
or SOAPRUNXML functions for android.

Any suggestions on how to call a soap procedure from a WebDev web service?
Membre enregistré
98 messages
Posté le 08 octobre 2013 - 21:53
Thanks for the response. I'm still pretty new to programming in general, so figuring it out as I go. :)

I was able to figure out how to do it using HTTPRequest. You just have to format the XML manually and put it into the "message to send" parameter.
Membre enregistré
2 958 messages
Popularité : +89 (91 votes)
Posté le 14 mai 2014 - 18:30
PROCEDURE WS_ConsultarPosicaoTaxi(LOCAL NumCorrida, LOCAL TaxiIndice, LOCAL DebugSN)

//DebugSN = "S"

ChangeCharset(charsetOccidental) // SEM ACENTO

CodClienteCelula, nRetornoCodigo is int = 0
XML_Retorno, NumProces, VerificaLatitude is string = ""

IF NumCorrida > 0 THEN

//Variaveis de retorno
GloTaxiLatitude = ""
GloTaxiLongitude = ""

//Busca Cliente
HReadSeekFirst(t090_cliente_celular,t090_cliente_celular.A090_seq_cliente,1)
IF HFound(t090_cliente_celular) = True THEN


//NumProcess
NumProces = WS_ValidaRequisicao(t090_cliente_celular.A090_ddd_telefone,...
t090_cliente_celular.A090_num_telefone,...
0,...
0,...
"N")


//Envio
IF CodClienteCelula = "" OR CodClienteCelula = 0 THEN
CodClienteCelula = t090_cliente_celular.A090_cod_clientecelula
END

//Envelope
Xml_SEND is string = [
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:act297_RtPlusSSDM-IRtPlusSSDM#ConsultarPosicaoTaxi">
<soapenv:Header/>
<soapenv:Body>
<urn:ConsultarPosicaoTaxi soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<cod_client_celula xsi:type="xsd:int">v001</cod_client_celula>
<num_corrid xsi:type="xsd:int">v002</num_corrid>
<dat_hora_proces xsi:type="xsd:string">v003</dat_hora_proces>
<num_proces xsi:type="xsd:int">v004</num_proces>
</urn:ConsultarPosicaoTaxi>
</soapenv:Body>
</soapenv:Envelope>
]


//Replace
Xml_SEND = Replace(Xml_SEND,"v001",CodClienteCelula,IgnoreCase)
Xml_SEND = Replace(Xml_SEND,"v002",NumCorrida,IgnoreCase)
Xml_SEND = Replace(Xml_SEND,"v003",GloDataHora,IgnoreCase)
Xml_SEND = Replace(Xml_SEND,"v004",NumProces,IgnoreCase)

//info(NumProces)
//info(Xml_SEND)

Xml_Header is string = [
SOAPAction: "urn:act297_RtPlusSSDM-IRtPlusSSDM#ConsultarPosicaoTaxi"
]

Tamanho is int = Length(Xml_SEND)

Xml_Header = Replace(Xml_Header,"TamanhoString",Tamanho)

IF DebugSN = "S" THEN
IF InSimulatorMode() = False
fSaveBuffer("/mnt/sdcard/EnvioFV.TXT", Xml_SEND)
ELSE
fSaveBuffer("c:\EnvioFV.TXT", Xml_SEND)
END
Info(Xml_SEND)
END

HTTPTimeOut(GloTimeOut)

//BASE REAL
ok = HTTPRequest("http://199.124.60.220:8085/soap/IRtPlusSSDM","", "", Xml_SEND, "text/xml","","")

//BASE REAL
//ok = HTTPRequest("http://199.124.60.220:8086/soap/IRtPlusSSDM","", "", Xml_SEND, "text/xml","","")

IF ok = True

XML_Retorno = HTTPGetResult(httpResult)

XML_Retorno = WS_RemoveAcentos(XML_Retorno)

IF DebugSN = "S" THEN
IF InSimulatorMode() = False
fSaveBuffer("/mnt/sdcard/RetornoFV.TXT", XML_Retorno)
ELSE
fSaveBuffer("c:\RetornoFV.TXT", XML_Retorno)
END
END


//<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
//xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
//xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
//<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
//xmlns:NS1="urn:act297_RtPlusSSDM-IRtPlusSSDM">
//<NS1:ConsultarPosicaoTaxiResponse xmlns:NS2="urn:act297_RtPlusSSDM">
//<NS2:TPosicaoTaxi id="1" xsi:type="NS2:TPosicaoTaxi">
//<numCorrid xsi:type="xsd:long">2013</numCorrid>
//<ValLatitu xsi:type="xsd:double">-25.449987</ValLatitu>
//<ValLongit xsi:type="xsd:double">-49.1870234</ValLongit>
//<DesMensag xsi:type="xsd:string">Posição em 16/08/2013 18:03:10</DesMensag>
//</NS2:TPosicaoTaxi>
//<return href="#1"/>
//</NS1:Consult
Message modifié, 14 mai 2014 - 19:43
Membre enregistré
2 958 messages
Popularité : +89 (91 votes)
Posté le 02 août 2016 - 18:03
O segredo é colocar o HEADER completo.

Note esse código:

//Envelope
Xml_SEND is string = [
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:act297_RtPlusSSDM-IRtPlusSSDM">
<soapenv:Header/>
<soapenv:Body>
<urn:ConsultarPosicaoTaxi soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<cod_client_celula xsi:type="xsd:int">v001</cod_client_celula>
<num_corrid xsi:type="xsd:int">v002</num_corrid>
<dat_hora_proces xsi:type="xsd:string">v003</dat_hora_proces>
<num_proces xsi:type="xsd:int">v004</num_proces>
</urn:ConsultarPosicaoTaxi>
</soapenv:Body>
</soapenv:Envelope>
]


Está incompleto pois nao sei o nome do método no Header, devo então informar:

//Envelope
Xml_SEND is string = [
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:act297_RtPlusSSDM-IRtPlusSSDM#ConsultarPosicaoTaxi">
<soapenv:Header/>
<soapenv:Body>
<urn:ConsultarPosicaoTaxi soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<cod_client_celula xsi:type="xsd:int">v001</cod_client_celula>
<num_corrid xsi:type="xsd:int">v002</num_corrid>
<dat_hora_proces xsi:type="xsd:string">v003</dat_hora_proces>
<num_proces xsi:type="xsd:int">v004</num_proces>
</urn:ConsultarPosicaoTaxi>
</soapenv:Body>
</soapenv:Envelope>
]


Esse código acima esta ok com o HEADER informando o método que será usado

Linha alterada:
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:act297_RtPlusSSDM-IRtPlusSSDM#ConsultarPosicaoTaxi">


Use ferramentas como SOAP Ui ou similares para fazer a montagem do envelope de forma completa.

Dai é só usar o httprequest e httpgetresult

Programas similares ao SOAP UI:

Fonte: http://techonestop.com/soapui-alternative-for-webservice-testing

+ Apache JMeter

+ Postman

+ Wizdler

+ WebInject

+ HTTP Master

+ Spyport

+ Fiddler


Bons estudos

:merci:

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Message modifié, 02 août 2016 - 18:08