我正在嘗試在CF10中創建一個Web服務對象。我已經驗證它在SoapUI中按照預期工作。但是,當我在CF中運行它時,出現錯誤,它無法找到在WSDL中的導入語句中導入的XSD。這裏是createObject
呼叫CF和WSDL內import
聲明:ColdFusion在本地機器而不是Web服務器上查找Web服務導入語句中的文件
<cfset var ws = createObject("webservice", "https://XXXXXX.XXXX.net/billingandcollectionmgmt/billing/PaymentManagement_1.wsdl")
<xsd:import schemaLocation="PaymentManagement_1.xsd4.xsd" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
<xsd:import schemaLocation="PaymentManagement_1.xsd2.xsd" namespace="http://www.XXXXX.com/schemas/XXXXBilling/billingandcollectionmgmt/billing/PaymentManagement_1"/>
我得到這個錯誤是因爲它看起來在我的本地CF安裝的/ bin位置找到這些文件,而不是在與WSDL本身相同的目錄中的Web服務器上。我已通過使用上面提供的URL訪問XSD確認XSD確實位於該目錄中。即,文件https://XXXXXX.XXXX.net/billingandcollectionmgmt/billing/PaymentManagement_1.xsd4.xsd
確實存在。
這裏是堆棧跟蹤:
javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'PaymentManagement_1.xsd4.xsd'.: java.io.FileNotFoundException: This file was not found: file:/C:/ColdFusion10/cfusion/bin/PaymentManagement_1.xsd4.xsd
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at coldfusion.xml.rpc.XmlRpcServiceImpl.getServiceInfoGenerator(XmlRpcServiceImpl.java:468)
at coldfusion.xml.rpc.XmlRpcServiceImpl.generateServiceInfo(XmlRpcServiceImpl.java:372)
at coldfusion.xml.rpc.XmlRpcServiceImpl.registerWebService(XmlRpcServiceImpl.java:317)
at coldfusion.xml.rpc.XmlRpcServiceImpl.getWebServiceProxy(XmlRpcServiceImpl.java:679)
at coldfusion.xml.rpc.WebServiceProxyFactory.getProxy(WebServiceProxyFactory.java:22)
at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:65)
at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:5747)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5710)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5644)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5619)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5566)
at cfXXXXPayments2ecfc1210176705$funcDELETEPAYMENT.runFunction(C:\ColdFusion10\cfusion\wwwroot\XXXXPayments.cfc:74)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2659)
at cfXXXXPayments2ecfc1210176705$funcDELETEPAYMENTS.runFunction(C:\ColdFusion10\cfusion\wwwroot\XXXXPayments.cfc:64)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432)
at cftestPending2ecfm428388279.runPage(C:\ColdFusion10\cfusion\wwwroot\testPending.cfm:3)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:444)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.IpFilter.invoke(IpFilter.java:64)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:443)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:112)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:204)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.FileNotFoundException: This file was not found: file:/C:/ColdFusion10/cfusion/bin/PaymentManagement_1.xsd4.xsd
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
... 74 more
的問題是,沒有人知道爲什麼ColdFusion的可能會尋找我的本地機器上,而不是在網絡服務器上,其中文件的文件實際上位於?
不應該將Web服務器URL作爲schemaLocation的一部分嗎? – melancia
@MelanciaUK如果這是必要的,爲什麼它會在SoapUI中工作? – unaligned
只是一個猜測。我從未與CF合作過。 – melancia