This is (almost?) the final piece of the jigsaw that I'd like to get sorted before I get stuck into my app. Chess endgames with 5 and 6 pieces are fully calculated and stored in large databases. The 5-piece ones are online at Tablebase WebService - Lokasoft - Home of ChessPartner. This page has the following VB code to access the database using the MSSOAP toolkit.
B4X:
Dim Client As SoapClient
Dim Result As String
Set Client = New SoapClient
Client.mssoapinit "http://www.lokasoft.nl/tbweb/tbapi.wsdl"
Result = SoapClient.ProbePosition("6k1/6p1/8/8/8/8/4P2P/6K1 w - -")
What is the B4A equivalent to this code? I've tried looking at httpUtils2 but I'm not getting very far.
<h2>500 - Internal server error.</h2>
<h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
so maybe the XML isn't quite right or I need to set up the HTTP headers (correct jargon?) in some way. I feel I'm close here. I'm feeling a bit guilty wasting Erel's valuable time on my beginner-level hacking, but I'd very much like to get this working.
and I've changed your code in the HttpJob module to
B4X:
Public Sub PostBytes(Link As String, Data() As Byte)
mLink = Link
req.InitializePost2(Link, Data)
req.SetContentType("text/xml; charset=""UTF-8""") 'JH added
CallSubDelayed2(HttpUtils2Service, "SubmitJob", Me)
End Sub
I wasn't sure where to put this SetContentType() call, but this seemed to be the obvious place.
Neither change made any difference - still exactly the same error message.
I will soon have to embark on a similar mission as what you already seemed to have overcome.
Did you take the communication with a SOAP Web Server to completion? In other words were you able to send requests and receive and interpret responses received from the web service in XML packets.
Did you have have to build your your own SAX or other XML interpreter on the A4B side?
Ill give it a bash, I saw lots of messages re SOAP and Web Services.
I think what I might do is to try and create a bit of a tutorial once I have managed to get it right, which I can then contribute back to the community. As a database applications developer, the ability to communicate with SOAP Web Service is most probably one of the most important "features" to me.
I will soon have to embark on a similar mission as what you already seemed to have overcome.
Did you take the communication with a SOAP Web Server to completion? In other words were you able to send requests and receive and interpret responses received from the web service in XML packets.
Did you have have to build your your own SAX or other XML interpreter on the A4B side?
where the only variable is the "4k3/8/8/8/8/8/4P3/4K3 w" which represents a chess position in FEN notation. Then
B4X:
Dim job As HttpJob
Dim XML As String = "<?xml ... :Envelope>"
job.Initialize("Job", Me)
job.PostString("http://www.lokasoft.nl/tbweb/tbapi.asp", XML)
job.GetRequest.SetContentType("text/xml; charset=""UTF-8""")
Then
B4X:
Sub JobDone (Job As HttpJob)
If Job.Success = True Then
strResult = Job.GetString
strResult contains the list of moves from the passed position. I ignore the fact that these are wrapped up as XML and simply parse out the information I want using a regular expression. Not really what you could call "writing my own XML interpreter", so I can't help you with that bit.