1 Reply Latest reply on May 19, 2010 8:51 AM by JR "Bob" Dobbs-qSBHQ2

    Unable to Consume Windows Communication Foundation Web Service with Basic Authentication

    JR "Bob" Dobbs-qSBHQ2 Level 3
      I have a problem when trying to consume a web service based on the Windows Communication Foundation (WCF) using ColdFusion 8.0.1 on Windows 2003/IIS.  The web service in question requires basic authentication.  Both the CF and WCF web service servers are in house.  My goal is to expose some business logic written in WCF to my CF web site.
      I receive the following ColdFusion error message when attempting to consume the service:
      Cannot generate stub objects for web service invocation.
      Name: http://example.com/MyService.svc?wsdl. WSDL: http://example.com/MyService.svc?wsdl. java.io.IOException: Server returned HTTP response code: 401 for URL: http://example.com/MyService.svc?xsd=xsd0 It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct. If the requested WSDL document cannot be retrieved or is dynamically generated, it is likely that the target web service has programming errors. 
      I have examined the web logs from the web service machine and it appears that the request to the WSDL URL specified in the CFOBJECT tag includes the required basic authentication user name and password.  WCF web service WSDL information is not contained in a single file.  The WSDL contains multiple import instructions that require additional URLs to be requested.  For example MyService.svc?wsdl would contain an instruction to import a file at MyService.svc?xsd=xsd0. This appears to be the cause of the failure.  The username and password is not being supplied to the requests for the additional files.
      Here are snippets from the IIS logs on the WCF web serivce machine:
      This request succeeded, the "200" is HTTP OK:
      2010-05-19 16:49:16 W3SVC1 GET /MyService.svc wsdl 80 my_user_name - 200 0 0
      This request failed, the "401" indicates that the request did not include the required authentication info:
      2010-05-19 16:49:16 W3SVC1 GET /MyService.svc xsd=xsd0 80 - Java/1.6.0_04 401 2 2148074254
      I have attempted to use the wsdl2javaArgs attribute of the CFOBJECT tag to specify the username and password but this does not change CF's behavior.  Here is my CF code:
      Has anyone run into this before and have a solution or workaround?  Is there any additional information I can provide?