Hey Guys sorry about the bad formatting and thnks for your support. I will try to explain better this time. I have a zip file named Content_4_2.zip at location 'C:\xampp\htdocs\drupalTheme'. This zip contains 2 xml files. Now the web service method to which i want to pass this zip has the definition as follows.
<soap:Body>
<AddFileToProject xmlns="http://tempuri.org/">
<Ticket>string</Ticket>
<ProjectID>string</ProjectID>
<Filename>string</Filename>
<FileData>base64Binary</FileData>
<SourceLanguageID>string</SourceLanguageID>
<TargetLanguageIDs>
<string>string</string>
<string>string</string>
</TargetLanguageIDs>
<Metadata>
<Meta Name="string" Value="string" />
<Meta Name="string" Value="string" />
</Metadata>
<IsReferenceMaterial>boolean</IsReferenceMaterial>
</AddFileToProject>
</soap:Body>
The FileData 'base64Binary' is the content i want to send i.e. the zip file. In Java i was able to convert the zip file into a bytearray and the web service was called sucessfully.Now i know that there is no such conversion in PHP. So my approach is 1.Get the name of the zip file from the directory 2.Pass the contents of the zip to web service.
I have tried this:
$zipFile = 'C:/xampp/htdocs/drupalTheme/Content_4_2.zip';
$zip = zip_open($zipFile);
$addFile = $ServicesLink->AddFileToProject(array('Ticket'=>$ticket,'ProjectID'=>$projectID,'Filename'=>$fileName,'FileData'=> $zip, 'SourceLanguageID'=> $srcLang, 'TargetLanguageIDs'=> $finalTarArray,'Metadata'=> null,'IsReferenceMaterial'=>false));
and this appraoch
$zipFile = 'C:/xampp/htdocs/drupalTheme/Content_4_2.zip';
$file = file_get_contents('./Content_4_2.zip',true);
$byteArr = str_split($file);
foreach ($byteArr as $key=>$val) { $byteArr[$key] = ord($val); }
$addFile = $ServicesLink->AddFileToProject(array('Ticket'=>$ticket,'ProjectID'=>$projectID,'Filename'=>$fileName,'FileData'=> $byteArr, 'SourceLanguageID'=> $srcLang, 'TargetLanguageIDs'=> $finalTarArray,'Metadata'=> null,'IsReferenceMaterial'=>false));
Both result in corrupt zip files sent over.
Would like to have your views on the same.