我正在寫一個與SOAP客戶端(內部使用java)接口的php腳本。java.lang.String不能轉換爲java.io.InputStream
其中一個調用要求我傳遞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'的類型? – 2010-11-13 15:23:43
@evan - 請參閱edit1 – siliconpi 2010-11-13 15:31:13
看起來像Java代碼,而不是PHP,是問題所在。 Java可能期望一個Stream而不是一個字符串。你可以發表解析這個數組的Java片嗎? – 2010-11-13 15:36:36