Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Soap Webservice. How to ?
#1
Hi All,

I need to receive data from a webservice after a request.

I will normally include the webservice specs as a wsdl (*.pas file), and communicate with the service using XML.

Is that possible in IntraWeb 15.1.5 and if, do anyone have any examples of how to ?

In a Delphi 2010 Win32 program, I include the WDSL as a unit, and call the procedures it expose, as I would any other procedures. The resulting data are received as an XML file, which I then decipher (with a parser) and pull out the data I need.

In a similar C# program in MS Visual Studio 2010, it's a bit easier as XML is an native part, making the individual data in the XML, available as properties of the XML file.

Is there anything similar awailable in IntraWeb ?

Regards
Soren
Reply
#2
(10-03-2019, 05:31 AM)SorenJensen Wrote: Hi All,

I need to receive data from a webservice after a request.

I will normally include the webservice specs as a wsdl (*.pas file), and communicate with the service using XML.

Is that possible in IntraWeb 15.1.5 and if, do anyone have any examples of how to ?

In a Delphi 2010 Win32 program, I include the WDSL as a unit, and call the procedures it expose, as I would any other procedures. The resulting data are received as an XML file, which I then decipher (with a parser) and pull out the data I need.

In a similar C# program in MS Visual Studio 2010, it's a bit easier as XML is an native part, making the individual data in the XML, available as properties of the XML file.

Is there anything similar awailable in IntraWeb ?

Regards
Soren
Hi Soren,

The process is identical even in an IW app (though I use c++). I generate the unit from the wsdl file (or the wizard) and then, in the usersession, a function calls the webservice and gets the response. All works around the HTTPRIO component as usual.

Ciao
Claudio
Reply
#3
(10-03-2019, 06:15 AM)duffo64 Wrote:
(10-03-2019, 05:31 AM)SorenJensen Wrote: Hi All,

I need to receive data from a webservice after a request.

I will normally include the webservice specs as a wsdl (*.pas file), and communicate with the service using XML.

Is that possible in IntraWeb 15.1.5 and if, do anyone have any examples of how to ?

In a Delphi 2010 Win32 program, I include the WDSL as a unit, and call the procedures it expose, as I would any other procedures. The resulting data are received as an XML file, which I then decipher (with a parser) and pull out the data I need.

In a similar C# program in MS Visual Studio 2010, it's a bit easier as XML is an native part, making the individual data in the XML, available as properties of the XML file.

Is there anything similar awailable in IntraWeb ?

Regards
Soren
Hi Soren,

The process is identical even in an IW app (though I use c++). I generate the unit from the wsdl file (or the wizard) and then, in the usersession, a function calls the webservice and gets the response. All works around the HTTPRIO component as usual.

Ciao
Claudio

Hi Claudio,

Thanks for the quick reply. I'll try it out.

Regards
Soren
Reply
#4
Hi Claudio,

I have managed to get it working. I imported the WSDL using New, Other, Web and Import WSDL. Added a HTTPRIO component to the form, filling in the properties and executed the call. Expecting to handle XML data via a parser, I downloaded XmlParser (free code) and tried it. Parsing worked fine, but the httprio call complained MSXML not istalled. MSXML is not available to windows versions beyond XP sp3. After many hours of searching and reading I finally found a blog by Stephen Ball, explaining how to bypass MSXML and use OmniXml instead. That way the HTTPRIO call executed fine and I got a response. Looking at the WSDL (and the C# code I mentioned earlier) I found out how to access the values in the Webservice response directly, without using the xmlparser to extract the data.

So now my program is receiving the data from the webservice as I wanted it to. Thanks for your help.

NB! If anyone want to see the code and how I have done, let me know, and I'll post it here as examples.

Regards
Soren
Reply
#5
Examples are always helpful even if only to go into the "forum archive" for future reference.
Reply
#6
(10-06-2019, 11:08 AM)SorenJensen Wrote: I have managed to get it working. Parsing worked fine, but the httprio call complained MSXML not istalled.
Good to know ! About MSXML, I had the very same issue until I changed the ServerController.Cominitialization from ciNone to ciNormal.

Ciao
Claudio
Reply
#7
(10-07-2019, 08:42 AM)duffo64 Wrote:
(10-06-2019, 11:08 AM)SorenJensen Wrote: I have managed to get it working. Parsing worked fine, but the httprio call complained MSXML not istalled.
Good to know ! About MSXML, I had the very same issue until I changed the ServerController.Cominitialization from ciNone to ciNormal.

Ciao
Claudio

Hi Claudio,

I just tested on my program. And you are right. I removed all OmniXML references and it works. Also with clmultithreaded.

Thanks.

As I promised I will upload an example, but unfortunately the two public Soap webservices I have tested (Panasoft.com's ibooks and CDybe.com's WeatherWS) both fails with either timeout or Server error 500. So either they are not active anymore (though I do get the WSDL file) or there is a username and password missing.
I'm trying to find another working one, and then upload the program. Why not just the program I already have working ? Because it is a business solution, and data is not public.
Reply
#8
Hi All,

As promised, here is an example of how to retrieve data from a simple SOAP Web Service.

It is using SoapApi from webservicespros.com, who provides a number of free and open web services to use as tests.

The program only use GetProduct. It is possible to add, update and delete products as well. Just add the needed code. You'll easily see how, by studying the code.

The issues I had, was being unable to use MSXML, or at least, the program at runtime complained it could not find MSXML (MSXML not installed!). Reading that I believed I needed to find a MSXML X.something to install, but the last public MSXML version is 6.x for Windows XP Sp3 and it will not install under Win 10 :-(

After searching a lot I found a way to use OmniXml instead and that made it work, as you can see above. Later Claudio, as you also can read above, told me it was just a question of setting ServerController.ComInitialize to ciNormal instead of ciNone to make it work with MSXML. Claudio is right and it works with ciMultiThreaded as well.

I have uploaded the TestSoap program as source code you will need to compile your self. I used Delphi 10.3.2 Rio and IW 15.1.5, but I suppose it is fairly standard and will work on most combinations of Delphi and IW.

If you need it, I'm happy to provide it and hope you will learn from it. And if you already know how to, please feel free to comment and I hope I can learn from your.

Regards
Soren


Attached Files
.zip   TestSoap.zip (Size: 56.11 KB / Downloads: 7)
Reply
#9
Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)