SOLVED - please help - need to consume WSDL, WST isn't importing it lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Tomas Silva · 2018-01-13 23:28 Hello all, This is my first post here. I come from a Delphi background and recently started working with Lazarus. I really need to get a SOAP web service client up an running. REST is not an option, as the WS is provided by my customer so I don't get a say on the matter. I downloaded and installed Synapse and WST. Everything appears as it should. However, when I try to import the WSDL file from the customer, I get this: Exception : Namespace not found : "http://schemas.xmlsoap.org/wsdl/soap/" This happens both via ws_helper and via WSDL Importer. I can access http://schemas.xmlsoap.org/wsdl/soap/ from my browser, so it's not a networking problem. Can anyone please shine a light on this? Thank you so much! ---------------------------------------------------------------------- Phil · 2018-01-13 23:40 Quote from: Tomas Silva on January 14, 2018, 12:28:35 amCan anyone please shine a light on this? Make sure you're using WST from SVN: svn co https://svn.code.sf.net/p/lazarus-ccr/svn/wst/trunk . I wouldn't use any earlier version. ---------------------------------------------------------------------- Tomas Silva · 2018-01-14 12:52 Hi Phil, thanks for the reply. I am indeed using the WST from the SVN, in fact I just checked it out four days ago. That's the version where I'm having this issue. Any further help? Regards! ---------------------------------------------------------------------- Tomas Silva · 2018-01-14 13:02 Maybe some way to use a local copy of the namespace? I'm not sure if (and how) I could do this. Or conversely - if the right way to do it would be ensuring the converter can read the namespace over the internet, how is it that one does that? ---------------------------------------------------------------------- Tomas Silva · 2018-01-14 13:16 In fact I tried making a local wsdl.xml from "http://schemas.xmlsoap.org/wsdl/soap/", replacing every occurrence of that address with a "file://" statement poiting to that file, and even replacing the namespace on the wsdl.xml with that same "file://". Nothing seems to work. In fact, even after replacing every occurence of "http://schemas.xmlsoap.org/wsdl/soap/" that I could see, the same message still pops up: Exception : Namespace not found : "http://schemas.xmlsoap.org/wsdl/soap/" ---------------------------------------------------------------------- Phil · 2018-01-14 14:17 Quote from: Tomas Silva on January 14, 2018, 02:16:16 pmException : Namespace not found : "http://schemas.xmlsoap.org/wsdl/soap/" If you're unable to post your customer's .wsdl file, maybe take a look at .wsdl files that CAN be parsed and see how your customer's file differs. For example, I've used this .wsdl for years and ws_helper parses it okay. http://www.usgovxml.com/DataService.aspx?ds=NDFD ---------------------------------------------------------------------- Tomas Silva · 2018-01-14 14:26 Thanks, Phil! WST parsed that on my system as well. I'll get to studying and see what I find. I'll report back here with the results, ok? Regards! ---------------------------------------------------------------------- Tomas Silva · 2018-01-15 19:26 In the end I decided to go another way. After a few hours and with a little help from our friend SOAPUI, I managed to implement a fully functional web service client for all the services I needed, authentication and all, using Synapse's THTTPSend. Works like a charm. So the topic is not actually "solved", but I'm going to mark it so since no further help is required. Anyway - thanks to Phil for taking the time to try and help me. ---------------------------------------------------------------------- Phil · 2018-01-15 19:36 Quote from: Tomas Silva on January 15, 2018, 08:26:21 pmusing Synapse's THTTPSend. One disadvantage to that in my view is that your solution is now dependent on Synapse. An advantage to WST is that it's pluggable, meaning you can use Indy, Synapse, FPC's HTTP client, or even Apple's Foundation-based HTTP client on Mac and iOS. This also illustrates why REST has displaced SOAP as quickly and as thoroughly as it has: REST is almost always easier to use than SOAP. Some useful discussion here: http://spf13.com/post/soap-vs-rest/ I believe all of the services I use (over a dozen) now provide REST as an option (including NDFD above), so I've pretty much switched over completely from SOAP. ---------------------------------------------------------------------- Tomas Silva · 2018-01-15 19:43 QuoteOne disadvantage to that in my view is that your solution is now dependent on Synapse.Sure, but the methodology I developed can easily be ported over to any other platform if needs be. That actually makes me more confident on the solution I arrived at. QuoteThis also illustrates why REST has displaced SOAP (...) all of the services I use (over a dozen) now provide REST as an optionAgain, I agree. Though I find the structure of SOAP more appealing, the usability and platform independence of REST is way higher. If the web services in question were mine to develop, I would definitely give that a lot of thought - but, as I mentioned before, in this particular case I'm only consuming services provided by my customer, and I don't really have any say on the matter. Thanks for all your input, you have added lots to my personal knowledge. Best regards to you! ---------------------------------------------------------------------- Phil · 2018-01-15 19:48 Quote from: Tomas Silva on January 15, 2018, 08:43:36 pmThanks for all your input, you have added lots to my personal knowledge. Best regards to you! And let's hope the service is using https. With Windows and Synapse, Indy or FPC's HTTP client, that means including the appropriate 32-bit or 64-bit SSL libraries with your app. On Linux and Mac, these libraries are already installed (although their use is discouraged on Mac). ---------------------------------------------------------------------- Tomas Silva · 2018-01-15 19:54 Hi Phil, No SSL at present. ---------------------------------------------------------------------- Phil · 2018-01-15 19:58 Quote from: Tomas Silva on January 15, 2018, 08:54:37 pmHi Phil, No SSL at present. 2017 was also the year of https: https://netmarketshare.com/report.aspx?options=%7B%22filter%22%3A%7B%2 2%24and%22%3A%5B%7B%22deviceType%22%3A%7B%22%24in%22%3A%5B%22Desktop%2 Flaptop%22%5D%7D%7D%5D%7D%2C%22dateLabel%22%3A%22Trend%22%2C%22attribu tes%22%3A%22share%22%2C%22group%22%3A%22secure%22%2C%22sort%22%3A%7B%2 2share%22%3A- 1%7D%2C%22id%22%3A%22https%22%2C%22dateInterval%22%3A%22Monthly%22%2C% 22dateStart%22%3A%222017-01%22%2C%22dateEnd%22%3A%222017- 12%22%2C%22segments%22%3A%22-1000%22%7D If you need a certificate for your Web site: https://letsencrypt.org/ It's a little clumsy to obtain for a Windows server, but does work. I used this: https://github.com/Lone-Coder/letsencrypt-win-simple/releases ---------------------------------------------------------------------- Tomas Silva · 2018-01-15 20:15 Thank you very much! ---------------------------------------------------------------------- DonaldShimoda · 2018-09-20 15:59 Quote from: Tomas Silva on January 15, 2018, 08:26:21 pmIn the end I decided to go another way. After a few hours and with a little help from our friend SOAPUI, I managed to implement a fully functional web service client for all the services I needed, authentication and all, using Synapse's THTTPSend. Works like a charm. So the topic is not actually "solved", but I'm going to mark it so since no further help is required. Anyway - thanks to Phil for taking the time to try and help me.  Im facing the same problem hwre with wst... Can please share part f the implementation using synapse? Best regards ---------------------------------------------------------------------- inoussa · 2018-10-06 12:56 Quote from: Tomas Silva on January 14, 2018, 12:28:35 am Exception : Namespace not found : "http://schemas.xmlsoap.org/wsdl/soap/" Hello, A fix has been committed. Better late than never :-) Best regards. ---------------------------------------------------------------------- DonaldShimoda · 2018-10-07 13:57 Thanks for the fix, now the wsdl is imported. The bad news is the actual trunk dont build on delphi... I really hope the delphi support is active. I have several projects dont yet migrated to lazarus and need to share code in the meanwhile.   ..\wst\object_serializer.pas(1289,6): error E2072: E2072 Number of elements (18) differs from declaration (22)   ..\wst\object_serializer.pas(1323,6): error E2072: E2072 Number of elements (18) differs from declaration (22) Edited: Is solved now, the wst_global.inc file dont have defintiions for Delphi Tokyo, please add it to trunk (and for the other missing delphi versions)     {$IFDEF VER320} // Delphi Tokyo       {$DEFINE HAS_BUILT_IN_64UINT}       {$DEFINE WST_UNICODESTRING}       {$DEFINE USE_INLINE}       {$DEFINE WST_TKCLASSREF}       {$DEFINE WST_TKPOINTER}       {$DEFINE WST_TKPROCEDURE}     {$ENDIF}