无法读取 WSDL 错误 [英] Getting Unable to read WSDL error

查看:32
本文介绍了无法读取 WSDL 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次使用 SOAP.我正在尝试使用 cfinvoke 调用网络服务,如下所示:

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

<part name="phoneNumber" type="xsd:string"/><part name="userName" type="xsd:string"/><part name="password" type="xsd:string"/></消息>

这是来自 WSDL 的操作名称的一部分:

 - <操作名称="infoLookup"><documentation>获取电话号码信息.</documentation><input message="tns:infoLookupRequest"/><output message="tns:infoLookupResponse"/></portType>

我收到以下错误:

无法从 URL 读取 WSDL:https://xyz/infoLookup.php?wsdl.错误:javax.net.ssl.SSLPeerUnverifiedException:对等方未通过身份验证.错误发生在 C:XYZASoapsoapreq.cfm: line 3735:<cfinvokeargument name="phoneNumber" value="7182973186"/>36:<cfinvokeargument name="userName" value="12345"/>37:<cfinvokeargument name="password" value="password"/>38:</cfinvoke>39 :

我试图在线搜索错误,但无法弄清楚我的代码出了什么问题.如果我做错了什么,请告诉我

解决方案

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

<块引用>

默认信任库是 JRE 的 cacerts 文件.此文件通常位于以下位置:

  • 服务器配置:

    cf_root/runtime/jre/lib/security/cacerts

  • JRun 4 配置上的多服务器/J2EE:

    jrun_root/jre/lib/security/cacerts

  • Sun JDK 安装:

    jdk_root/jre/lib/security/cacerts

  • 查阅其他 J2EE 应用服务器和 JVM 的文档

为了安装证书,您需要先获得证书的副本.这可以通过使用 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. 在 ColdFusion 服务器上以管理员身份运行 cmd 提示符
  2. 备份原始 cacerts 文件,以防您遇到问题

<块引用>

keytool 是 Java SDK 的一部分,可以在以下位置找到:

  • 服务器配置:

    cf_root/runtime/bin/keytool

  • JRun 4 配置上的多服务器/J2EE:

    jrun_root/jre/bin/keytool

  • Sun JDK 安装:

    jdk_root/bin/keytool

  • 查阅其他 J2EE 应用服务器和 JVM 的文档

安装证书:

  1. 将目录更改为您信任库的位置(cacerts 文件所在的位置)
  2. 键入此命令(使用当前 jvm 并使用当前 jvm 的 keytool) "c:program filesjavajre7inkeytool" -import -v -alias your_cert_alias_name -file C:wherever_you_saved_the_filecert_file.cer -keystore cacerts -storepass changeit
  3. 在提示中输入 yes 以信任此证书?"

注意:*your_cert_alias_name* 我上面使用的可以是任何你想要的
注意:*C:wherever_you_saved_the_filecert_file.cer* 将这些值更改为您用于服务器文件夹和证书文件名的任何值

验证证书:

  1. 键入此命令(使用当前 jvm 并使用当前 jvm 的 keytool) "c:program filesjavajre7inkeytool" -list -v -keystore cacerts -alias your_cert_alias_name -storepass changeit

注意:*your_cert_alias_name* 此处使用与您在上面安装证书时使用的名称相同的名称

重新启动 ColdFusion 服务 除非您这样做,否则它不会读取更新的 cacerts 文件.

您可以根据需要从服务器中删除导入的证书文件.

This is first time I'm using SOAP.I'm trying to invoke a webservice using cfinvoke which is as follows:

<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#">

And here is a part of the message name from the WSDL :

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

And here is a part of Operation name from WSDL:

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

I'm getting the following error:

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

The error occurred in C:XYZASoapsoapreq.cfm: line 37

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

I have tried to search for the error online but couldn't figure how what's wrong in my code. Please let me know if I'm doing something wrong

解决方案

Here are the steps you need to perform in order to install the certificate to the Java keystore for ColdFusion. First, be sure you are updating the correct cacerts file that ColdFusion is using. In case you have more than one JRE installed on that server. You can verify the JRE ColdFusion is using from the administrator under the 'System Information'. Look for the Java Home line.

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

In order to install the certificate you need to first get a copy of the certificate. This can be done by using Internet Explorer. Note that different versions of Internet Explorer will behave slightly differently but should be very similar to these steps. For example, earlier versions of IE might save the certificate under a different tab than I mention.

  1. Browse to the SSL URL in Internet Explorer - https://xyz/infoLookup.php?wsdl.
  2. View the certificate by clicking on the lock icon and clicking view certificate
  3. Then click the Install Certificate... button (note: if you do not see this button you must close IE and run it as administrator first)
  4. Click on IE's Internet Options and click the Content tab
  5. Click the Certificates button
  6. Find the server's certificate under the Intermediate Certification Authorities tab, select the cert and click the Export... button
  7. Export using DER format

Copy the exported certificate file to your ColdFusion server (you can delete the cert from IE if you want)

  1. Run cmd prompt as administrator on the ColdFusion server
  2. Make a backup of the original cacerts file in case you run into issues

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

To install the cert:

  1. Change directory to your truststore's location (where the cacerts file is located)
  2. Type this command (use current jvm and use current jvm's keytool) "c:program filesjavajre7inkeytool" -import -v -alias your_cert_alias_name -file C:wherever_you_saved_the_filecert_file.cer -keystore cacerts -storepass changeit
  3. Type yes at the prompt to "Trust this certificate?"

Note: *your_cert_alias_name* I used above can be whatever you want
Note: *C:wherever_you_saved_the_filecert_file.cer* change these values to whatever you use for the server folder and certificate file name

To verify the cert:

  1. Type this command (use current jvm and use current jvm's keytool) "c:program filesjavajre7inkeytool" -list -v -keystore cacerts -alias your_cert_alias_name -storepass changeit

Note: *your_cert_alias_name* use the same name here that you used above to install the cert

Restart the ColdFusion service It will not read the updated cacerts file until you do this.

You can delete the imported certificate file from the server if you wish.

这篇关于无法读取 WSDL 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆