Hi All,
I have to make 2 soap posts to a webservice.
- first request (in xml) provides the webservice with some parameters like (username, password, system etc..
in return I receive "<connectResult>true</connectResult>" in xml, so I know the connection succeeded.
- In the above packetreceived I then know I can perform the second post.
This works, but the second time I get a "not connected" from the server.
What can I do to keep the session alive?
The first post:
lCountRequest=0
PostString = '<?xml version="1.0" encoding="utf-8"?>'&|
'<soap:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/">'&|
'<soap:Body>'&|
'<Connect xmlns="
http://bct.nl">'&|
'<ApplicationID>AAG</ApplicationID>'&|
'<ConnectionID>'&Glo:DmsDbId&'</ConnectionID>'&|
'<UserName>system</UserName>'&|
'<Password>sys</Password>'&|
'<EncodedPass>false</EncodedPass>'&|
'</Connect>'&|
'</soap:Body>'&|
'</soap:Envelope>'
cSoap.CanUseProxy = 1 ! Can use a proxy
cSoap.HeaderOnly = 0 ! We want the whole page
cSoap.AsyncOpenUse = 1 ! Use AsyncOpen 12 seconds (recommended)
cSoap.AsyncOpenTimeOut = 1200 ! Up to 12 seconds to connect
cSoap.InActiveTimeout = 9000 ! Set IdleTimeout 90 seconds
cSoap.ConnectionKeepAlive = 0
cSoap.ContentType = 'text/xml; charset=utf-8'
cSoap.AcceptEncoding = ''
cSoap.ContentLength = Len(Clip(PostString))
! Set the SOAPAction header to tell the web service which method to execute
cSoap.customheader = 'SOAPAction: "
http://bct.nl/Connect"'
PacketSent = PostString
clear(PacketReceived)
cSoap.Post('
http://localhost/wsCorsa7/Corsa72WS.asmx', Clip(PostString))
If cSoap.Error
Message ('Could not be post the SOAP request to this web service. Error ' & cSoap.Error |
& ': ' & cSoap.InterpretError())
SetCursor()
end
Second post:
PostString = '<?xml version="1.0" encoding="utf-8"?>'&|
'<soap:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/">'&|
'<soap:Body>'&|
'<GetFileVersion xmlns="
http://bct.nl">'&|
'<ObjectType>S</ObjectType>'&|
'<ObjectID>'&Clip(Glo:DmsLastDoc)&'</ObjectID>'&|
'<FileType>ftArchive</FileType>'&|
'<FileVersion>0</FileVersion>'&|
'</GetFileVersion>'&|
'</soap:Body>'&|
'</soap:Envelope>'
cSoap.customheader = 'SOAPAction: "
http://bct.nl/GetFileVersion"'
! The packet is contstructed, so you can post it to the webservice
PacketSent = PostString
clear(PacketReceived)
!PostUrl = '
http://localhost/wsCorsa7/Corsa72WS.asmx'
cSoap.Post('
http://localhost/wsCorsa7/Corsa72WS.asmx', Clip(PostString))
If cSoap.Error
Message ('Could not be post the SOAP request to this web service. Error ' & cSoap.Error |
& ': ' & cSoap.InterpretError())
SetCursor()
end
Regards Joep