I am trying to consume the .net webservice from cold fus开发者_开发知识库ion. Methods having simple types working fine. But i am having problems with one particular method which accepts byte[] array as input.
Below the sample webmethod declaration
[WebMethod]
public AVStatus ScanStream(byte[] fileObject)
{
// code
}
and the cold fusion code consuming this service is
<cffile action="readBinary" file="#FileName#" variable="filedata">
<cfset b64file = #toBase64(filedata)#>
<cfinvoke webservice = "http://xxx/scanservice.asmx?wsdl"
method = "ScanStream"
returnVariable = "result">
<cfinvokeargument name="fileObject" value="#b64file#" />
</cfinvoke>
This always leads to this error Web service operation ScanStream with parameters cannot be found.
can someone help me out this?
It seems that the binary data has been exposed as bas64
string in the coldfusion while byte[]
is exposed by the service as an XML array (of bytes).
Change the ScanStream
(if you can) to accept a string, if web service is not yours you could convince owners to provide another method which accepts string and uses Convert.FromBase64String
to change to byte array.
Webservices are remote, not public. Public allows access by other CF classes and pages. Change public to remote, and you should be able to "see" your webservice.
精彩评论