PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [Windev 18]Sending data to a Soap server
[Windev 18]Sending data to a Soap server
Iniciado por guest, 10,feb. 2015 17:15 - 4 respuestas
Publicado el 10,febrero 2015 - 17:15
Hi

This feature in Webdev is far to advanced for my abilities but unfortunately I have to include it in my application.

I must send an order to a webservice. I have included the service in my application:

http://wsg.za.adaptris.com/wsg/resource/handler/soapmanager/MessageService…

The documentations says I must send:

???????


From the above I deduce that I must send 2 headers:

SOAPAddHeader("web:password","password","PushMessage")
SOAPAddHeader("web:username","ericus","PushMessage")

I then created a structure and added this:

ThisOrder is CSOrder
ThisOrder.src = "QA0000005918"
ThisOrder.dst = "QA0000001822"
ThisOrder.type = "execution"
ThisOrder.autoRelease = "True"
ThisOrder.payload = bufMyBuffer

The bufMyBuffer is where I loaded my complete order XML using LoadBuffer

The I attempt to send the whole lot together. That is the headers with the username and password as well as the 'body' with the src, dst, type, payload and most importantly my order in the xml file.

i is boolean = SOAPRunXML("<a class="ExternalLink" rel="nofollow" target="_blank" href="http://wsg.za.adaptris.com/wsg/resource/handler/soapmanager/MessageService?wsdl","PushMessage",MysendBuffer">http://wsg.za.adaptris.com/wsg/resource/handler/soapmanager/MessageService&hellip;</a>)

If somebody will be kind enough to have a look at this it will be much appreciated.


Ericus Steyn
Publicado el 10,febrero 2015 - 20:03
Hi,

Perhaps you think a bit to advanced?

1. Inject the webservice into your project and use it like a function.


//Perhaps you need 2 lines below, but not sure MessageService.user = "Ericus" MessageService.Password = "password" //Execute as a function, WinDev do the rest. Could be a jSon envelope in retur you have to parse. s is string = PushMessage(Src,Dst,Type,Autorelease,Payload,Username,password) //Do something with the result. ps is object cjSonParse ps.parse(s)
You will se the parameter as any WinDev command.

Cheers
Tor-Bjarne
Publicado el 11,febrero 2015 - 18:13
Thank you Tor-Bjarne for helping.

I did this:

s is string = MessageService.PushMessage("QA0000005918","QA0000001822","Execution",True,"","QA0000005918","password")

and it seems to go through but the problem is that "" in the middle. It is supposed to carry the payload which consists of the order in XML format.

I prepared the order in XML and saved it as text.xml

Then I tried:

Stream is xmlDocument
Stream = XMLOpen("C:\My projects\NobleResources\ est.xml", fromFile)

and inserted Stream where the "" (payload) currently is. But then it fails.

If I tried your suggestion of

ps is object cjSonParse

Windev says 'Type unknows'

Regards


Ericus Steyn
Publicado el 11,febrero 2015 - 22:13
Hi,

"ps is object cJsonParse" was just an example of a class written by you, that perhaps parsed a Json result..

I think you probably have to open your XML files as a string (other can correct me if I`m wrong)

So I would try:
Sfile is string = floadtext("C:\My projects\NobleResources\ est.xml) s is string = ... MessageService.PushMessage("QA0000005918","QA0000001822","Execution",True,Sfile,"QA0000005918","password")
But I could be wrong <img src="/NG2013_WEB/ui/smiley/6.gif" align=absmiddle border=0 alt=";)">

Cheers
Tor-Bjarne
Publicado el 11,febrero 2015 - 22:43
Ericus,

compared to a similar project I used before your line
SOAPRunXML("http://wsg.za.adaptris.com/wsg/resource/handler/soapmanager/MessageService…)
is somewhat wrong and should be
SOAPRunXML("<a class="ExternalLink" rel="nofollow" target="_blank" href="http://wsg.za.adaptris.com/wsg/resource/handler/soapmanager/MessageService",MysendBuffer,"PushMessage">http://wsg.za.adaptris.com/wsg/resource/handler/soapmanager/MessageService",MysendBuffer,"PushMessage</a>")