I am trying to consume a webservice an set it up as per all the documentation I could find but I am getting errors like:
Unable to read WSDL from URL:
I have rewritten the URL a few different ways
remove the s from https,
remove the ?WSDL
Remove the https//: (different error)
But nothing seems to work. The consensus is that it is a URL error but I can't think of what to do next.
I can hit the URL through my browser no problems and I can get the service to work in SOAP UI and Boomerang. I just can't get it to work through the CF page I created.
Any guidance is appreciated, thank you.
You say the URL you're trying "works" in a browser. Does it return WSDL? If so, then yes you can use that with CFML to invoke the web service.
Here's a working example. There's a .net web service at http://www.dneonline.com/calculator.asmx. If you visit that URL, you are shown its available methods (that's how asmx requests work, if you just ask for the file alone). If you add ?wsdl to the URL, you get back WSDL (xml), as you can see at http://www.dneonline.com/calculator.asmx?wsdl.
And either shows that the web service has an Add method, which takes two args, as intA and intB. You can call that from CFML using cfobject/createobject, cfinvoke, etc, such as this:
<cfobject webservice="http://www.dneonline.com/calculator.asmx?wsdl" name="ws"> <cfoutput>#ws.Add(intA=1,intB=2)#</cfoutput>
which outputs 3.
If that ends up not working, the problem may be that CF can't reach the URL in question, at all, for some reason.
It could be simply that CF can't reach out to that or any URL. If you try a simple CFHTTP of the URL, what do you get back? For my example above, what if you do:
<cfhttp url="http://www.dneonline.com/calculator.asmx?wsdl"> <cfdump var="#cfhttp#">
Again, you should get back XML in the cfhttp.filecontent variable. What if you change that URL to YOUR asmx? What do you get back? Something other than XML? perhaps an error?
Also, is it an https URL that you are using? If so, it may be that there's a problem about the ssl/tls version or protocol that the site is using, being too modern for the Java version that underlies your CF. That will be indicated in the error, when you do the CFHTTP (which removes web services issue from the equation). If that's the issue, I have a post with more on how to resolve that:
Let us know how things go.
It would help if you could share the code with the forum.