Coldfusion Web服务错误,“无法将WSDL解析为XML文档。”
我试图让运行CF9 IIS7的web服务Coldfusion Web服务错误,“无法将WSDL解析为XML文档。”
testpage.cfm
<cfinvoke webservice ="https://nww.eastwickpark.nhs.uk/cfcs/test.cfc?wsdl"
method ="echoString"
input = "hello"
returnVariable="foo">
<cfoutput>#foo#</cfoutput>
test.cfc
<cfcomponent output="false" access="public" returntype="string">
<cffunction
name = "echoString"
returnType = "string"
output = "no"
access = "remote">
<cfargument name = "input" type = "string">
<cfreturn #arguments.input#>
</cffunction>
</cfcomponent>
的错误消息是
Unable to parse WSDL as an XML document.
Parsing error: Fatal Error: URI=null Line=83: The element type "img" must be terminated by the matching end-tag "".
It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct.
The error occurred in C:\inetpub\wwwroot\cf\testpage.cfm: line 4
2 : <cfinvoke webservice ="https://nww.eastwickpark.nhs.uk/cfcs/test.cfc?wsdl"
3 : method ="echoString"
4 : input = "hello"
5 : returnVariable="foo">
6 :
我可以在浏览器中访问https://nww.eastwickpark.nhs.uk/cfcs/test.cfc并获取组件信息页面好的。
如果我浏览到http://nww.eaastwickpark.nhs.uk/cfcs/test.cfc?wdsl我得到
<wsdl:definitions targetNamespace="http://cfcs" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://cfcs" xmlns:intf="http://cfcs" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://rpc.xml.coldfusion" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by ColdFusion version 9,0,0,251028-->
<wsdl:types>
<schema targetNamespace="http://rpc.xml.coldfusion" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="CFCInvocationException">
<sequence/>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="CFCInvocationException">
<wsdl:part name="fault" type="tns1:CFCInvocationException"/>
</wsdl:message>
<wsdl:message name="echoStringRequest">
<wsdl:part name="input" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="echoStringResponse">
<wsdl:part name="echoStringReturn" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="Test">
<wsdl:operation name="echoString" parameterOrder="input">
<wsdl:input message="impl:echoStringRequest" name="echoStringRequest"/>
<wsdl:output message="impl:echoStringResponse" name="echoStringResponse"/>
<wsdl:fault message="impl:CFCInvocationException" name="CFCInvocationException"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="test.cfcSoapBinding" type="impl:Test">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="echoString">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="echoStringRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://cfcs" use="encoded"/>
</wsdl:input>
<wsdl:output name="echoStringResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://cfcs" use="encoded"/>
</wsdl:output>
<wsdl:fault name="CFCInvocationException">
<wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="CFCInvocationException" namespace="http://cfcs" use="encoded"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestService">
<wsdl:port binding="impl:test.cfcSoapBinding" name="test.cfc">
<wsdlsoap:address location="https://nww.eastwickpark.nhs.uk/cfcs/test.cfc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
到CFC中的真实路径是C:\的Inetpub \ wwwroot的\ CF \氯氟烃\ test.cfc即不直接在Web根,所以我不得不映射作为
逻辑路径/熟食
目录路径C:\的Inetpub \ wwwroot的\ CF \氯氟烃
我不明白这一点...
过时了,越来越近,如果我从application.cfc中删除了我的onRequestStart方法,它工作正常。
<cffunction name="onRequestStart" output="false" returnType="void">
<cfinvoke component="cfcs.security" method="getControlData" returnvariable="controlData">
<cfinvokeargument name="dsn" value="#application.dsn#">
</cfinvoke>
<!--- if site has been closed force a logout and direct to siteclosed notice--->
<cfif #controlData.siteOpen# is false>
<CFSET structDelete(session, 'auth')>
<cflocation url='siteclosed.cfm' addtoken='No'>
<cfabort>
</cfif>
<!--- If user is not logged in, force them to do so now --->
<cfif not isDefined("session.auth.isLoggedIn")>
<!--- Check if page is excluded from authentication --->
<cfinvoke component="cfcs.security" method="checkIfUnathenticatedPage" returnvariable="pageUnauthenticated">
<cfinvokeargument name="dsn" value="#application.dsn#">
</cfinvoke>
<cfif pageUnauthenticated is 1>
<cfset currentPage="#listlast(CGI.script_name,"/")#">
<cfinclude template='#currentPage#'>
<cfabort>
<cfelse>
<!--- page is not excluded from authentication --->
<!--- If the user is now submitting "loginForm" form, --->
<!--- Include "Login Check" code to validate user --->
<cfif isDefined("form.username")>
<cfinclude template="loginCheck.cfm">
</cfif>
<cfinclude template="loginForm.cfm">
<cfabort>
</cfif>
</cfif>
</cffunction>
有登录表单中的图像,这可能是其中的神秘img标签是获得吸。
您是否尝试过使用HTTP?我看到你正在使用HTTP和HTTPS的混合,所以也许在那里有一个问题。
此外,您的cfcomponent
标记不需要access
和returntype
属性 - 它们仅适用于cffunction
标记。不知道这是否让你感到困扰。
编辑:
问题我认为是你onRequestStart()
实际上包括登录页面,如果他们还没有登录,对不对?你不想为你的Web服务请求。
您可以编写一个子目录CFC extends
更高级别的CFC和不使用onRequestStart()
的代码。查看更多关于here的信息。
您是否尝试刷新WSDL(或者代码,或者通过管理员)?请记住,CF缓存WSDL返回。如果您之前抛出一个错误,它可能仍然被缓存。
是的,我对Ben表示感谢,但没有欢乐。 – Saul 2010-06-28 16:00:10
该子部分中的空白Application.cfc将适用于纯公共cfcs。 但是如果它不是一个开放式的cfc(公开的,所有的时候),我通常都会采取不同的方式。即使是这样,你仍然可以处理AOP风格。
如果你想在onRequestStart方法应用一致的面向方面的安全性,我通常做这样的事情(在这里简单举例):
function onRequestStart(sRequestedObject) {
if(sRequestedObject does not contain '.cfc') { // Always suppress output in a cfc
checkRegularLoginSecurity(sRequestedObject); // This can allow to pass, redirect, etc.
} else {
return checkCFCSpecificSecurity(sRequestedObject) // returns true or false
// false will effectively kill the request, true will go to the next event
}
}
这样一来,我可以有某种安全法检查CFC不同于重定向到登录页面(也许它查找IP块或URL值标记,或者如果它在我的securityObjects网格中看到cfc是'public'),它只是让它继续下去,否则它可以正确地使用根据需要采取行动,还有onCFCRequest()可以处理基本的AOP安全专门用于cfc请求。
Could th是否通过https提供Web服务时出现问题? – Saul 2010-06-28 16:01:34
由于img不会出现在调用页面,cfc或application.cfc或生成的wdsl页面中,所以
位错误来自哪里? –
Saul
2010-06-28 16:29:23
您是否已将SSL证书添加到java密钥库并重新启动coldfusion?我猜你正在收到证书错误,错误包括img标签。 – Antony 2010-06-29 04:45:07