【发布时间】:2016-05-27 09:24:31
【问题描述】:
我对 SOAP 很陌生,这是我的第一个项目。我正在尝试连接到 HTTPS WSDL,以便在我的网页上提取一些信息。
已为本地服务器与服务提供商服务器连接准备好证书设置。当我尝试连接 https 网络服务时有响应,所以我相信两台服务器之间没有连接问题:
这是第三方技术团队提供的 SOAPUI 示例:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="http://soap.ipr.tfp.com/">
<soapenv:Header/>
<soapenv:Body>
<soap:create>
<arg0>
<attribute_1>abc</attribute_1>
<attribute_2></attribute_2>
<attribute_3>abc123</attribute_3>
<attribute_4>abc234</attribute_4>
<attribute_5></attribute_5>
</arg0>
</soap:create>
</soapenv:Body>
</soapenv:Envelope>
以下是我用于连接 Web 服务的 cfm 代码:
<cfscript>
ws = CreateObject("webservice", [HTTPS URL]?wsdl);
//show web service methods for debugging purposes
writeDump(ws);
// construct arguments
args = {attribute_1="abc"
, attribute_2=""
, attribute_3="abc123"
, attribute_4="abc234"
, attribute_5=""
};
// call the method
result = ws.create(arg0=args);
writeDump(result)
</cfscript>
问题:
执行 cfm 脚本时收到以下错误消息:
Cannot perform web service invocation create.
The fault returned when invoking the web service operation is:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: These policy alternatives can not be satisfied:
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}AsymmetricBinding: Received Timestamp does not match the requirements
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}X509Token: The received token does not match the token inclusion requirement
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}X509Token
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}InitiatorToken
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}RecipientToken
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}IncludeTimestamp: Received Timestamp does not match the requirements
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}SignedParts: {http://schemas.xmlsoap.org/soap/envelope/}Body not SIGNED
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}EncryptedParts: {http://schemas.xmlsoap.org/soap/envelope/}Body not ENCRY...
问题:
此错误是否与 ColdFusion 密钥库中的 SSL 证书设置有关?
-
我的 CFM 脚本有什么问题吗?参考SOAPUI示例,xml格式为`[arg0] --> [attribute_1]、[attribute_2]等。我可以这样传递属性吗?
- 结果 = ws.create(arg0=args);
SoapUI 工具提供相同的服务。我这里有什么遗漏吗?
感谢您的宝贵时间。感谢您的帮助。
2016-05-30 - 更新 -
我尝试使用CFHTTP 标记提交 XML,但它似乎返回了一个不同的错误:
<cfhttp
url = "[HTTPS URL]?wsdl"
method ="post"
result ="httpResponse"
charset ="utf-8">
<cfhttpparam
type="header"
name="accept-encoding"
value="no-compression"
/>
<cfhttpparam
type="xml"
value="#trim( soapBody )#"
/>
</cfhttp>
错误:
这是文件内容中的错误信息:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>These policy alternatives can not be satisfied:
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}
AsymmetricBinding: Received Timestamp does not match the requirements
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}
X509Token: The received token does not match the token inclusion requirement
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}
X509Token
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}
InitiatorToken
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}
RecipientToken
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}
IncludeTimestamp: Received Timestamp does not match the requirements
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}
SignedParts: {http://schemas.xmlsoap.org/soap/envelope/}
Body not SIGNED
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}
EncryptedParts:
{http://schemas.xmlsoap.org/soap/envelope/}
Body not ENCRYPTED
</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
错误消息似乎类似于cfobject 标记。当我仔细阅读错误消息时,它似乎与 X.509 ws-security 加密有关,其中 SOAP 内容需要在发送到 Web 服务请求之前进行加密。
经过一些研究,加密流程似乎如下:
将 SOAP 内容保存到临时文件夹中。
使用 Java Class 文件将 SOAP 内容加密为 X.509 ws-security 格式。
向 Webservice 发送新的加密 SOAP 内容。
我不知道 CF 如何处理 Java 类文件。有没有人做过同样的加密转换?
【问题讨论】:
-
您运行的是什么版本的 ColdFusion? Axis 1 还是 Axis 2 的 Web 服务设置?
-
嗨 Sean Coyne,我们正在使用 Coldfusion 9。我不确定我们的网络团队所做的 Web 服务设置。这2有什么区别吗?这是导致此错误的可能原因吗?
标签: web-services ssl soap https coldfusion