I use the method of addAttachmentsToIssue in jira soap, but I am confused about the fourth parameters in the addAttachmentsToIssue($token,$issueKey, string[] filename, byte[][] attachments), no matter which data I pass to it, it will return the mistakes. this is my code:
$fPath = $_FILES['upload']["tmp_name"];
$fName = $_FILES['upload']["name"];
$fOpen = fopen($fPath,'rb');
$fByte = fread($fOpen,filesize($fPath));
$result = $client->call('createIssue',array($token, $issueInfo));
$issueKey=$result['key'];
$fileName=array();
$fileName[]=$fName;
$fileBytes=array();
$fileBytes[]=$fByte;
$attach=$client->call('addAttachmentsToIssue',array($token,$issueKey,$fileName,$fileBytes));
var_dump($attach);
exit;
the array returned is :
array
'faultcode' =>
<small>string</small>
'soapenv:Server.userException' (length=28) 'faultstring' =><small>string</small>
'org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the element content of the document.' (length=120) 'detail' => array 'faultData' => array 'columnNumber' =><small>int</small>
864 'exception' => null 'lineNumber' =><small>int</small>
1 'message' =><small>string</small>
'An invalid XML character (Unicode: 0x0) was found in the element content of the document.' (length=89) 'publicId' => null 'systemId' => null 'hostname' =><small>string</small>
'jira.nyc' (length=8)
Use addBase64EncodedAttachmentsToIssue and encode it with org.apache.axis.encoding.Base64.encode. There is code that does this in the addAttachment function here: https://bitbucket.org/bob_swift/jira-cli/src/6ef8b49e6268/src/main/java/org/swift/jira/cli/JiraClient.java
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.