2013-10-16 87 views
4

这是我第一次使用SOAP.I'm试图调用使用CFINVOKE这是如下一个Web服务:获取无法读取WSDL错误

<cfinvoke 
    webservice="https://xyz/infoLookup.php?wsdl" 
    method="infoLookup" 
    returnVariable="info" 
    > 

    <cfinvokeargument name="phoneNumber" value="7182973186"/> 
    <cfinvokeargument name="userName" value="12345"/> 
    <cfinvokeargument name="password" value="password"/> 
</cfinvoke> 

<cfdump var="#info#"> 

这里是消息名称的一部分从WSDL:

<message name="infoLookupRequest"> 
    <part name="phoneNumber" type="xsd:string" /> 
    <part name="userName" type="xsd:string" /> 
    <part name="password" type="xsd:string" /> 
</message> 

这里是操作名称从WSDL部分:

<portType name="vtsInfoLookupPortType"> 
- <operation name="infoLookup"> 
    <documentation>Get phone number information.</documentation> 
    <input message="tns:infoLookupRequest" /> 
    <output message="tns:infoLookupResponse" /> 
    </operation> 
    </portType> 

我得到以下ERR或:

Unable to read WSDL from URL: https://xyz/infoLookup.php?wsdl. 
Error: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated. 

The error occurred in C:\XYZ\A\Soap\soapreq.cfm: line 37 

35 : <cfinvokeargument name="phoneNumber" value="7182973186"/> 
36 : <cfinvokeargument name="userName" value="12345"/> 
37 : <cfinvokeargument name="password" value="password"/> 
38 : </cfinvoke> 
39 : 

我试图在网上搜索错误,但无法确定我的代码中有什么问题。请让我知道如果我做错了什么

+0

我相信我需要将SSL证书导入到coldfusion信任库中。但在此之前,我正确地在我的代码中传递变量? – Jack

+0

如果它位于SSL后面,那么ColdFusion将需要证书与它通信。你的代码看起来好,那么为什么不试试呢?另外,您应该能够自己浏览WSDL以验证在运行代码之前可以获取它。只需浏览到“https://xyz/infoLookup.php?wsdl”,看看会发生什么。 –

+0

当我浏览WSDL时,它工作正常。 WSDL在Internet Explorer中打开。我相信我仍然需要将证书导入Coldfusion Trust Store。 – Jack

回答

1

以下是您需要执行的步骤,以便将证书安装到ColdFusion的Java密钥库中。首先,确保您正在更新ColdFusion正在使用的正确cacerts文件。如果您在该服务器上安装了多个JRE。您可以在“系统信息”下验证管理员使用的JRE ColdFusion。寻找Java Home行。

The default truststore is the JRE's cacerts file. This file is typically located in the following places:

  • Server Configuration:

    cf_root/runtime/jre/lib/security/cacerts

  • Multiserver/J2EE on JRun 4 Configuration:

    jrun_root/jre/lib/security/cacerts

  • Sun JDK installation:

    jdk_root/jre/lib/security/cacerts

  • Consult documentation for other J2EE application servers and JVMs

为了安装证书,您需要先获取证书的副本。这可以通过使用Internet Explorer来完成。 请注意,不同版本的Internet Explorer的行为会略有不同,但应与这些步骤非常相似。例如,早期版本的IE可能会将证书保存在与我提到的不同的选项卡下。

  1. 浏览到Internet Explorer的SSL URL - https://xyz/infoLookup.php?wsdl
  2. 通过点击锁图标,点击查看证书
  3. 查看证书然后点击安装证书...按钮(注意:如果您没有看到这个按钮,你必须关闭IE浏览器,并首次运行它以管理员身份)
  4. 点击IE浏览器的Internet选项,单击内容选项卡
  5. 点击证书按钮
  6. 查找中级证书颁发机构选项卡下的服务器证书,选择证书,然后单击导出...按钮
  7. 使用DER格式

复制导出的证书文件到您的ColdFusion服务器(你可以删除IE浏览器证书,如果你想)

  1. 运行cmd提示符ColdFusion服务器上管理员
  2. 出口
  3. 使原始cacerts中的备份文件的情况下,您遇到的问题

The keytool is part of the Java SDK and can be found in the following places:

  • Server Configuration:

    cf_root/runtime/bin/keytool

  • Multiserver/J2EE on JRun 4 Configuration:

    jrun_root/jre/bin/keytool

  • Sun JDK installation:

    jdk_root/bin/keytool

  • Consult documentation for other J2EE application servers and JVMs

要安装证书:

  1. 改变目录到您的信任的位置(其中cacerts文件所在)
  2. 键入以下命令(使用当前的JVM,并使用当前JVM的keytool)"c:\program files\java\jre7\bin\keytool" -import -v -alias your_cert_alias_name -file C:\wherever_you_saved_the_file\cert_file.cer -keystore cacerts -storepass changeit
  3. 类型是在提示“信任此证书?”

注:* your_cert_alias_name *我上面使用可以任何你想要的
注:* C:\ wherever_you_saved_the_file \ cert_file.cer *改变这些值,无论你使用的服务器文件夹和证书文件名

要验证证书:

  1. 键入以下命令(使用当前的JVM,并使用当前JVM的keytool)"c:\program files\java\jre7\bin\keytool" -list -v -keystore cacerts -alias your_cert_alias_name -storepass changeit

注:* your_cert_alias_name *使用相同的名字在这里,你上面使用安装证书

重新启动ColdFusion服务,直到你这样做,不会读取更新cacerts文件。

如果您愿意,您可以从服务器删除导入的证书文件。

+0

谢谢米格尔F非常好的描述。我成功安装了它,并在验证后看到它已列出。 – Jack

+0

好吧,现在我已经计算出并完成了Coldfusion Truststore的 SSL证书安装过程,现在我收到属性验证错误,其中明确指出我需要有 cfhttp。我明白。所以,我将不得不使用cfhttp,如下所示: 'url =“https://xyz/infoLookup.php?wsdl”', 'method =“post”,clientCert = ??和clientCetPassword = ?? result =“xyz”'。 – Jack

+0

我碰到过一些帖子(http://forums.adobe.com/message/800318) ,他们提到clientcert应该包含格式为 '.pkcs'的文件?如果是,那么,我想知道我应该从哪里下载这个文件,并且我正在按照正确的程序进行操作?它是否是我用DER格式下载 的文件?请在此点亮一下。 – Jack