【发布时间】:2011-05-09 13:29:44
【问题描述】:
我正在编写一个与 SOAP 客户端(内部使用 java)交互的 php 脚本。
其中一个调用要求我传递 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.
【问题讨论】:
-
$content的类型是什么? -
@evan - 请参阅edit1
-
问题似乎是 Java 代码,而不是您的 PHP。 Java 可能需要一个 Stream 而不是一个字符串。你能发布解析这个数组的 Java 代码吗?
-
@evan - 嗨,evan - 实际上,这是一个稳定的第三方应用程序(我无法访问它的源代码)。我做错了什么,但我需要帮助来了解它的坏处。
-
(我需要改变我正在做的事情才能让它工作)
标签: java php string casting base64