Link to home
Start Free TrialLog in
Avatar of RNMisrahi
RNMisrahiFlag for United States of America

asked on

Unable to load WSDL File/Location: https://sandbox.... Error [Empty document]

We have a very strange problem. Let me explain.
We use bds2006.
We use the WSDL Import Wizard to create the pas file related to the web service.

A couple months ago I imported a wsdl into a project that creates an ocx, compiled, ran and everyone was happy.

The strange things… (the plot thickens)
A few days ago, after compiling I tried to run and got this exception:
Unable to load WSDL File/Location: https://sandbox.... Error [Empty document]

I suspected the web server I’m hitting, but:
-      When I call the same ocx in another machine using VB .Net, it works.
-      When I call the ocx in my machine using VB .net it doesn’t work. I get the same exception.
Unable to load WSDL File/Location: https://sandbox.... Error [Empty document]

-      When I use C# (2008) or VB .Net (2008) to import the same wsdl, it does work.
-      When I try to import a simple wsdl from Delphi I get the exception. Even simple wsdl’s like: http://www.webservicex.net/ValidateEmail.asmx?WSDL won’t work

I don’t know what else to add.

Any ideas what the problem could be?
Avatar of ebob42
ebob42
Flag of Netherlands image

Have you tried the WSDLIMP command-line edition?

BTW, I would consider upgrading to Delphi 2007 (or 2010) for better SOAP support. SOAP Exceptions for example, are working much better in 2007 or later.

See also http://www.drbob42.com/examines/examinA2.htm for an article that also tells you where to get the latest command-line version of WSDLIMP
Avatar of RNMisrahi

ASKER

Thanks ebob42, but my problem is not so much the generation of the pas file when importing a wsdl. That I already did at some point, when bds2006 was working.
The problem now is that, even though it compiles, when I run it I get the exception mentioned above.
Of course, the other symptom that something is wrong is that if I try to import another wsdl (even a simple one as the one I mentioned above), I get the error at the time when I try to import using the wsdl Importer wizard.
It looks like some default values are saved in the dialog.

What is the error when you try to import http://www.bobswart.nl/cgi-bin/WebServiceCGI.exe/wsdl/IEcho for example?
exactly the same (image attached)
Unable to Load WSDL File/Location: http:www.bobswart...
x.jpg
This is not good. Not good at all. I suggest you try the Delphi 2006 CD and try to do a repair of the installation. But first a few more questions that might help...

What do you see when you view my WSDL URL in a browser? Do you see the WSDL corectly?

What happens if you run the WSDLIMP.exe from the command-line? If that one also gives an error, then perhaps a firewall or proxy is failing to retrieve the WSDL file for you.
Good question. I should have done this myself.
I had to chop the last word (Echo) to see a table as the one attached.
I used http://www.bobswart.nl/cgi-bin/WebServiceCGI.exe/wsdl in Delphi as well, because when I use
http://www.bobswart.nl/cgi-bin/WebServiceCGI.exe/wsdl/Echo I get nothing, which I think is normal.

As for running WSDLIMP.exe, I have never used the command line for it. I don't know the syntax, so I ran wsdlimp.exe http://www.bobswart.nl/cgi-bin/WebServiceCGI.exe/wsdl and I get... you guessed:
Unable to load WSDL File/Location: http://www.bobswart.com.....

I really hope there is a solution for this. I'd give 1,500 point if I could.


x.pdf
Could you turn of your firewall just to try? I Have a feeling something is preventing the WSDL to get through somehow... (since the command-line WSDLIMP also doesn't work).

Did you install some kind of packet interceptor of some kind perhaps?
I'm 99% sure it's your firewall that blocks Delphi from receiving the WSDL file correctly. What you can do is view the WSDL URL in a browser, and if it shows the corect WSDL, then save that to a file like IEcho.wsdl in my case, and then use the WSLDIMport wizard to load that IEcho.wsdl file (use the button with the elipsis to load the file) which will then generate the import unit for you.

That's a workaround.

The solution consists of telling your firewall to trust Delphi, and allow Delphi to make outgoing and incoming connetions (so it hopefully can accept the WSDL).
Sorry, it seems that the Firewall is not the problem.
I disabled it and tried both with Delphi and then with the cmd line.
To make sure I ran cmd anew and tried.
Same result.

When I open the wsdl with IE I get the xml text. How do I bring it into the Delphi Wizard? When I select as wsdl the local file I copy-pasted from the browser I get an error. I tried using extension wsdl and xml. None of them work. I get an error. It doesn't seem to expect the xml text:
  <?xml version="1.0" encoding="UTF-8" ?>
- <!--  USAePay Soap Interface - v1.2 (RPC)
  -->
- <!--  WSDL file generated painstakingly by hand
  -->
- <definitions name="usaepay" targetNamespace="urn:usaepay" xmlns:typens="urn:usaepay" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:usaepay">
- <xsd:complexType name="ueSecurityToken">
- <xsd:all>
  <xsd:element name="ClientIP" type="xsd:string" />
  <xsd:element name="PinHash" type="typens:ueHash" />
  <xsd:element name="SourceKey" type="xsd:string" />
  </xsd:all>
  </xsd:complexType>
- <xsd:complexType name="CustomerObject">
- <xsd:all>
  <xsd:element name="Amount" type="xsd:double" />
  <xsd:element name="BillingAddress" type="typens:Address" />
...
For the moment I would not mind going this way, but I'm not sure that would solve my problem because as it is: The pas file generated when bsd2006 was working still compiles and I can bring that ocx to another machine, call it from VB and it does work. But from my machine it doesn't. This is very strange. It'd point to your suspicion on the firewall, but then again in my machine I can import from C# and VB Net.

The firewall is probably blocking Delphi, and not VS, which is why you can still import from C# and VB.NET.

From the point where you see the WSDL in the browser, just *save* the contents to a file. Do not copy and paste it, but do File | Save As and save it as a filename with either the .xml or .wsdl extension (doesn't matter).

THen, in the WSDL Importer, click on the button with the elipsis to import the WSDL file. If it still doesn't recognise it, then use the WSDL command-line compiler to process the file you saved to disk.

Which operating system do you run? Windows Vista? Did you try to run Delphi with the "Run as Administrator" option?
The error you get when you saved the copy-and-pasted text is from the - characters in the XML (which is a result of Internet Explorer trying to make the tree look nice). If you just do a File | Save of the contents, without copying and pasting, but the actual contents to a file, then the WSDL Importer (both the wizard and the command-line version) will be able to use it.
Hey ebob42, you were right!
We may be close the solution then!
The question is, why when I disable my firewall I still have the same problem?
I don't know much about firewalls, I just went to my windows settings, firewall and turned it off.
Is there anything else I should do?
Is it possible that my PC is infected? I ran a full avg and as we speak I'm running SpyBot.

I'll report on the findings of SpyBot, but if you could lead me in the right direction regarding how to prevent the firewall from blocking access from Delphi to every http I'd appreciate it. You've won at least 80% of the points!

ASKER CERTIFIED SOLUTION
Avatar of ebob42
ebob42
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This was an extremely difficult problem.
I asked a big array of experts, including Embarcadero. Nada.

Thanks much for ebob42. He was patient and focused.