Skip to main content
Participating Frequently
Mar 20, 2015 6:36 PM UTC
Question

401 Unauthorized error when calling a webservice

Have ColdFusion 11 installed, I have created a hello web service and I am trying to call it.  Each time I try to call the web service I get an error 401 Unauthorized.  I am not sure if I need to configure something more on the ColdFusion server, IIS or something else.

<cfcomponent displayname="Hello">

<cffunction name="helloWorld" returntype="string" access="remote">

     <cfreturn "Hello World!">

    </cffunction>

</cfcomponent>

<cfinvoke
  webservice="http://MyServer/Hello.cfc?wsdl"
  method="helloWorld"
  returnvariable="ws" refreshwsdl="yes">
</cfinvoke>

<cfdump var="#ws#">

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

BKBK
Community Expert
Community Expert
May 2, 2015 10:54 AM UTC

can you open the URL in the browser?

Translate
DwightAuthor
Participating Frequently
May 3, 2015 2:34 AM UTC

Yes I can browse to the CFC and browse to the wsdl.  I have no issues opening other files in this folder so it does not appear to be a permission issue to the folder.

Translate
BKBK
Community Expert
Community Expert
May 3, 2015 6:52 AM UTC

It appears that you have inadvertently enforced HTTP authentication. If so, you will have to include the attributes, username="your_username" and password="your_password" in the cfinvoke tag.

Translate