我正在尝试测试 getfields 操作的彭博网络服务
Web服务参数名称参数在提供的参数{criteria}中找不到。
到目前为止代码。
<cfset FieldSearchCriteria = structNew()>
<cfset FieldSearchCriteria.mnemonic = "NAME">
<cfset GetFieldsRequest = structNew()>
<cfset getFieldsRequest.criteria = FieldSearchCriteria>
<cfinvoke
webservice="https://service.bloomberg.com/assets/dl/dlws.wsdl"
proxyserver="***"
proxyport="***"
proxyuser="***"
proxypassword="***"
method="getFields"
refreshwsdl="false"
wsVersion="1"
argumentcollection="#getFieldsRequest#"
returnvariable="aTemp">
<cfdump var="#aTemp#">
以下是效用的相应肥皂请求
<soapenv:Body>
<ns:getFieldsRequest>
<ns:criteria>
<!--Optional:-->
<ns:mnemonic>NAME</ns:mnemonic>
</ns:criteria>
</ns:getFieldsRequest>
任何指针?
更新1: createObject()在一定程度上与参数更改一起工作。但是现在丢了握手错误。
javax.net.ssl.sslhandshakeexception:收到致命警报:handshake_failure
代码:
<cfscript>
ws = createObject("webservice", "https://service.bloomberg.com/assets/dl/dlws.wsdl",{refreshwsdl=true,proxyserver="***",proxyport="***",proxyuser="***",proxypassword="***",wsversion=1});
//show web service methods for debugging purposes
//writeDump(ws);
// construct arguments
args = {parameters={criteria={mnemonic="NAME"}}
};
writeDump(args);
// call the method
result = ws.getFields(argumentCollection=args);
writeDump(result)
</cfscript>
我们获得了X.509 .p12证书,并已使用OpenSSL编码DER。目前,不确定存储的证书是否有问题。
最终更新:最后,设法使用CFHTTP调用来使Web服务运行。Ben的博客文章是一个很棒的指南。我无法解决cfinvoke
的密钥库证书问题。
<cfsavecontent variable="soapBody">
<soapenv:Envelope
xxmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://services.bloomberg.com/datalicense/dlws/ps/20071001">
<soapenv:Header/>
<soapenv:Body>
<ns:getFieldsRequest>
<ns:criteria>
<!--Optional:-->
<ns:mnemonic>NAME</ns:mnemonic>
</ns:criteria>
</ns:getFieldsRequest>
</soapenv:Body>
</soapenv:Envelope>
<cfhttp
url="https://dlws.bloomberg.com/dlps"
method="post"
result="httpResponse"
clientcert="#ExpandPath(".")#cert.p12"
clientcertpassword="****">
<!---
Most SOAP action require some sort of SOAP Action header
to be used.
--->
<cfhttpparam
type="header"
name="SOAPAction"
value="""getFields"""
/>
<cfhttpparam
type="xml"
value="#trim( soapBody )#"
/>
</cfhttp>
<cfdump var="#XmlParse(httpResponse.filecontent)#">
尝试使用createObject()并改为调用getfields()方法。它似乎已经超越了"找不到参数错误"。
<cfset svc = createObject("webservice"
, "https://service.bloomberg.com/assets/dl/dlws.wsdl"
, {wsVersion=1}
)>
<cfset getFieldsRequest = {criteria={mnemonic="NAME"}}>
<cfset result = svc.getFields(getFieldsRequest)>
<cfdump var="#result#">
(与问题无关,但是CF11支持结构的快捷方式语法,即{}
)
设法使用cfhttp
调用来使Web服务运行。Ben的博客文章是一个很棒的指南。我无法解决cfinvoke
方法的密钥库证书问题。
<cfsavecontent variable="soapBody">
<soapenv:Envelope
xxmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://services.bloomberg.com/datalicense/dlws/ps/20071001">
<soapenv:Header/>
<soapenv:Body>
<ns:getFieldsRequest>
<ns:criteria>
<!--Optional:-->
<ns:mnemonic>NAME</ns:mnemonic>
</ns:criteria>
</ns:getFieldsRequest>
</soapenv:Body>
</soapenv:Envelope>
<cfhttp
url="https://dlws.bloomberg.com/dlps"
method="post"
result="httpResponse"
clientcert="#ExpandPath(".")#cert.p12"
clientcertpassword="****">
<!---
Most SOAP action require some sort of SOAP Action header
to be used.
--->
<cfhttpparam
type="header"
name="SOAPAction"
value="""getFields""" <!--- Note : extra pair of quotes are required --->
/>
<cfhttpparam
type="xml"
value="#trim( soapBody )#"
/>