PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV Mobile 2024 → Android, Soap, and WinDev Mobile 18
Android, Soap, and WinDev Mobile 18
Started by rob, Oct., 08 2013 7:14 PM - 6 replies
Registered member
105 messages
Posted on October, 08 2013 - 7:14 PM
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?
Posted on October, 08 2013 - 8:42 PM
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?
Registered member
105 messages
Posted on October, 08 2013 - 9:53 PM
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.
Registered member
3,651 messages
Popularité : +175 (223 votes)
Posted on May, 14 2014 - 6:30 PM
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 modified, May, 14 2014 - 7:43 PM
Registered member
3,651 messages
Popularité : +175 (223 votes)
Posted on August, 02 2016 - 6:03 PM
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 modified, August, 02 2016 - 6:08 PM
Posted on February, 01 2020 - 3:00 PM
BOLLER ADRIANO

4 years later, i need to call soap on windev Android.
I would like to use your code.

I don't understand how do you use Xml_Header in your code.
It's initiate but seems not to be used.

I see this in your code
Xml_action is string = [
SOAPAction: "urn:act297_RtPlusSSDM-IRtPlusSSDM#ConsultarPosicaoTaxi"
]

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

How do you use the SoapAction ?

I need on my web service for Sage X3 to set a SoapAction like this
"run(context_xml_string, publicname, xml_string)"

How can i set this ?

Thank you for your help.

Regards
Registered member
16 messages
Posted on February, 01 2020 - 3:03 PM
BOLLER ADRIANO

4 years later, i need to call soap on windev Android.
I would like to use your code.

I don't understand how do you use Xml_Header in your code.
It's initiate but seems not to be used.

I see this in your code
Xml_action is string = [
SOAPAction: "urn:act297_RtPlusSSDM-IRtPlusSSDM#ConsultarPosicaoTaxi"
]

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

How do you use the SoapAction ?

I need on my web service for Sage X3 to set a SoapAction like this
"run(context_xml_string, publicname, xml_string)"

How can i set this ?

Thank you for your help.

Regards