Copy link to clipboard
Copied
I am trying to invoke a web service and I'm getting an error.
Error 401 Unauthorized. Unable to read WSDL from URL: http://servername/generation/bj/TestCalculation.wsdl. An exception occurred while invoking an event handler method from Application.cfc. The method name is: onRequest.
I can put the URL in the browser and it will pull up the WSDL. I can call this from a flex program and it will work fine. I don't know much about Flex and I'm just learning it so I wanted to see if I could get it to work with ColdFusion.
Here is the CFC I created:
<cffunction name="myCalcFunction" access="remote" returntype="any">
<cfinvoke
webservice="http://servername/generation/bj/TestCalculation.wsdl"
method="TestCalculation"
returnvariable="response">
<cfinvokeargument name="number1" value="#arguments.number1#"/>
<cfinvokeargument name="number2" value="#arguments.number2#"/>
</cfinvoke>
<cfreturn response>
</cffunction>
Can anyone point me in the right direction of what I can do?
thanks for the support.
BJ
1 Correct answer
Yes, I finally found out it is a coldfusion 9.1 problem. I uninstalled CF9.1 and installed CF8 and CF9.0 on my local machine. I ran the web service code in both and it worked in both. I then updated my CF9.0 to CF9.1. I ran it again and it will give me the error. This is running the same code with the same application.cfc. Now I need to get Adobe to fix the problem.
BKBK, Adam, Dan and Owain,
Thanks for the help on this.
BJ
Copy link to clipboard
Copied
BKBK,
THe WSDL is the XML file that has all the information needed to call the service. The WSDL is called TestCalculation.wsdl that was generated from some middleware software to run the service. The method in the WSDL file is TestCalculation.
The WSDL file is in the same directory as the programs. So on the dev machine the WSDL is with the CFM and CFC file and on my local machine I have the WSDL file there. So it just depends on which one I call. The actual service is on a totally different machine that my local machine and the dev machine should get to and the WSDL has that path. Again, that path works since I can get it to work on my local machine.
I hope this clears up some.
thanks,
BJ
Copy link to clipboard
Copied
BJ - CF wrote:
THe WSDL is the XML file that has all the information needed to call the service. The WSDL is called TestCalculation.wsdl that was generated from some middleware software to run the service. The method in the WSDL file is TestCalculation.
The WSDL file is in the same directory as the programs. So on the dev machine the WSDL is with the CFM and CFC file and on my local machine I have the WSDL file there. So it just depends on which one I call. The actual service is on a totally different machine that my local machine and the dev machine should get to and the WSDL has that path. Again, that path works since I can get it to work on my local machine.
I hope this clears up some.
This only raises the confusion to the n-th degree. In web service terminology, WSDL is reserved as a synonym of the web service itself. In other words, the WSDL is the web service.
However, you seem to use the WSDL as some (XML) means to call the web service. The WSDL should not have "all the information needed to call the service"; the WSDL should be the web service. Unless, of course, you are making a call to a web service to call another web service. Is that so?
So on the dev machine the WSDL is with the CFM and CFC file...
This seems to say the WSDL(hence the web service) is on the dev machine.
... on my local machine I have the WSDL file there.
This seems to say the WSDL(hence the web service) is on your local machine.
...The actual service is on a totally different machine
This seems to say the web service is on a third machine.
Copy link to clipboard
Copied
BKBK -
I'm new to SOA/web services so maybe I'm not saying it right but I don't think we are on the same page. In the defintion, the WSDL is just an XML based file used to describe the functionality offered by a web service. I don't need to know anything about the service except the inputs and outputs and the URL to call the WSDL.
I created a service to calculate two numbers and return the result using a software called NextAxiom that my company has. This service is not sitting on our web server but on one of our machines on our network. See below for the WSDL file I have listed. I was just trying to use some of the standards that I read about and was using a CFC to invoke the web service so any CFM program would be able to call the CFC and not put it in the CFM program. But for now I can just put in the invoke tag in my CFM code:
<cfinvoke
webservice="http://localhost/TestCalculation.wsdl?wsdl"
method="TestCalculation" refreshwsdl="true"
returnvariable="response">
<cfinvokeargument name="number1" value="5"/>
<cfinvokeargument name="number2" value="6"/>
</cfinvoke>
<cfdump var="#response#">
Doing this, I can run the CFM program and it will come back with 11. This works great on my local CF server. When I try and run it on my dev machine I get the 401 unauthorized error. (yes I change the path of the wsdl to the path that the WSDL is on my dev web server.)
So it looks like some type of permission problem. My question is where do I look?
thanks for all replys,
BJ
Here is my WSDL file. If you notice the bold line at the bottom, that is the server where my service is.
Automatically generated 09/23/2011 by Hyperservice Business Platform, NextAxiom Technology, Inc.
-->
<element name="number2" type="long"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>
</types>
</message>
</message>
<output message="tns:TestCalculationResponse"/>
</operation>
</portType>
</input>
</output>
</operation>
</binding>
</port>
</service>
</definitions>
Copy link to clipboard
Copied
OK, I understand. One aspect that could differ between your local and dev machines, and that could require authorization, is a proxy. So, does a proxy (or other IP filter) allow your local machine but forbid your dev server?
Copy link to clipboard
Copied
BKBK,
This one I'm not sure what you are asking. Can you give me more details.
thanks,
BJ
Copy link to clipboard
Copied
Ask your System Administrator whether your network is behind a proxy server.
Copy link to clipboard
Copied
I think I found the problem but again I don't know how to solve it. The program is working on my localhost but not on our dev server. I checked and we aren't behind a proxy server. The only difference between my localhost and my dev server is the dev server was on CF9.1 and my local was just at CF9.0. I updated my local to 9.1 and now it is not working on my localhost and I'm getting the same error I was getting on my dev machine. Something changed in 9.1.
I want to try and go back to 9.0 on my dev and see if my program runs. Is there anyway to back out the change or do I uninstall and reinstall 9?
Anyone else have problems on CF 9.1 like this.
Copy link to clipboard
Copied
Yes, I finally found out it is a coldfusion 9.1 problem. I uninstalled CF9.1 and installed CF8 and CF9.0 on my local machine. I ran the web service code in both and it worked in both. I then updated my CF9.0 to CF9.1. I ran it again and it will give me the error. This is running the same code with the same application.cfc. Now I need to get Adobe to fix the problem.
BKBK, Adam, Dan and Owain,
Thanks for the help on this.
BJ
Copy link to clipboard
Copied
BJ - CF wrote:
Yes, I finally found out it is a coldfusion 9.1 problem. I uninstalled CF9.1 and installed CF8 and CF9.0 on my local machine. I ran the web service code in both and it worked in both. I then updated my CF9.0 to CF9.1. I ran it again and it will give me the error. This is running the same code with the same application.cfc. Now I need to get Adobe to fix the problem.
BKBK, Adam, Dan and Owain,
Thanks for the help on this.
BJ
BJ - CF,
Thank you, too, for sharing 2 things with us. Your debugging skills and, more importantly, virtue of patience.
Copy link to clipboard
Copied
On the dev server I put the CFC in the browser and it came back and asked for the RDS password. Adam is this what you meant when you said to call the method via the browser? Here is the info it put out after I entered the password:
Nope, not quite. I mean do this:
http://domain/path/to/webservice.cfc?wsdl&method=foo&arg1=bar[&etc...]
How there's a problem here:
hierarchy: WEB-INF.cftags.component
Generation.BJ.CalculateTwoNumberspath: E:\Tristate\Generation\BJ\CalculateTwoNumbers.cfc serializable: Yes properties: methods: myCalcFunction * - private method
myCalcFunction public any myCalcFunction ( )
Output:
To call a method as a web service it must be access=remote. There are no remote methods in there.
--
Adam
Copy link to clipboard
Copied
Adam,
I ran this URL: http://servername/generation/bj/TestCalculation.wsdl?wsdl?method=TestCalculation&arg1=4&arg2=5 on the dev machine and it came back with the XML file.
Also, I did have remote on the cfinvoke, I think I grab the wrong one when BKBK said to try it with public and that is the one that was listed.
thanks,
BJ


-
- 1
- 2