我正在编写一个PHP脚本,它与SOAP客户端(内部使用java)连接。
其中一个调用要求我传递Base64编码的内容。
我这样传递:
(Edit 1)
$content=file_get_contents('fileX');
fileX is a binary file which has been uploaded via POST and saved successfully in /tmp.
It is ~600kb in binary form.
$args[]=array('name'=>'content', 'value'=>base64_encode($content), 'type'=>'Base64Binary');
但是,我收到了一个错误:
java.lang.String cannot be cast to java.io.InputStream
(Edit2)
The documentation of the third party application says exactly:
Parameter Description Type
filename The name of the presentation file String
including the file extension.
content The content of the presentation file Base64Binary
encoded in Base64 scheme.
答案 0 :(得分:0)
由于输出类型base64_decode
,数组中的第二个参数是String类型。 Java错误意味着它期望一个InputStream类型的对象。
您可能需要使用Zend PHP Java Bridge,如下所示:
https://fosswiki.liip.ch/display/~chregu/Convert+PHP+String+to+a+Java+InputStream
以便将该String转换为Java InputStream。
在此处下载Zend Server:
http://www.zend.com/en/products/server/downloads
或其他PHP Java Bridge: