I have looked at a number of examples on the forum and thought I had a handle on how to post a SOAP request and process a response. So I decided to try and create a new simple SOAP request myself.
After I found a valid WSDL, ( https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl ) I used the tool SOAPUI as a helper to form the XML request needed to request the LatLonListZipCode.
But no matter what I attempt, I get an internal server error response. So I feel that I must be just missing something basic here.
I am using the library jOKHttpUtils2(Version 2.40)
Code follows:
The log window displays:
Waiting for debugger to connect...
Program started.
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
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:Fault><faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode><faultactor xsi:type="xsd:string"></faultactor><faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service</faultstring><detail xsi:type="xsd:string"></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
JobName = j, Success = false
Error: Internal Server Error
After I found a valid WSDL, ( https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl ) I used the tool SOAPUI as a helper to form the XML request needed to request the LatLonListZipCode.
But no matter what I attempt, I get an internal server error response. So I feel that I must be just missing something basic here.
I am using the library jOKHttpUtils2(Version 2.40)
Code follows:
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
Dim j As HttpJob
j.Initialize("j", Me)
Dim msg As 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:ndf="https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl">
<soapenv:Header/>
<soapenv:Body>
<ndf:LatLonListZipCode soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<zipCodeList xsi:type="xsd:string">44145</zipCodeList>
</ndf:LatLonListZipCode>
</soapenv:Body>
</soapenv:Envelope>
"$
j.PostString("https://graphical.weather.gov:443/xml/SOAP_server/ndfdXMLserver.php", msg)
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "j"
Log(Job.GetString)
End Select
Else
Log("Error: " & Job.ErrorMessage)
End If
Job.Release
End Sub
The log window displays:
Waiting for debugger to connect...
Program started.
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
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:Fault><faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode><faultactor xsi:type="xsd:string"></faultactor><faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service</faultstring><detail xsi:type="xsd:string"></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
JobName = j, Success = false
Error: Internal Server Error