[UPHPU] PHP SOAP to Java SOAP: issue with byte array

Justin Giboney giboney at giboneydesigns.com
Tue Jul 31 12:31:24 MDT 2007


This is more of a question than an answer, but wasn't xml created for  
stuff like that?

Justin Giboney



On Jul 31, 2007, at 11:24 AM, Kenneth Burgener wrote:

> We are attempting to write a PHP SOAP client that will interface with
> our Java SOAP server, but are experiencing difficulties when trying to
> pass a byte array from our PHP SOAP client to the Java SOAP server.
>
> We are using PHP NuSoap 0.7.2 for our client and Java Axis 1.4 for our
> server.
>
> We are attempting to remotely call a function, and one of the  
> components
> of the parameter is a Byte Array (actually to be the contents of a  
> file
> upload).  If we set the Byte Array component to null, all of the other
> components of the parameter object pass through fine to the Java
> function.  But if we try to populate the Byte Array with a simple
> string, or try to convert it to a null terminated array, or base64
> encode it, we always get an error reporting
> java.lang.IllegalArgumentException:
>
> The result we are seeing is the following:
>
>   Array (
>     [faultcode] => soapenv:Server.userException
>     [faultstring] => java.lang.IllegalArgumentException:
> java.lang.ClassCastException at 1b805ec
>     [detail] => Array (
>       [hostname] => test )
>   )
>
> So the question is how do we create a PHP "object" that will pass
> through SOAP and be interpreted correctly as a Java Byte Array?
>
> Here is a snipet of the code...
>
>   $content = "hello world";
> or
>   $content = array();
>   $content[0] = 'h';
>   $content[1] = 'h';
>   $content[2] = '\0';
> or
>   $content = "hello world";
>   $content = base64_encode($content);
>
>   $document = array();
>   $document['filename'] = $filename;
>   $document['name'] = $name;
>   $document['contentType'] = "text/html";
>   // THIS IS SUPPOSED TO BE RECEIVED AS A JAVA BYTE ARRAY
>   $document['content'] = $content;
>   $documents[] = $document;
>
>   $transactionContent = array('postData' => $postData, 'documents' =>
> $documents, 'images' => $images, 'styles' => $styles);
>
>   $client = new
> soapclient($_SESSION['settings']['url'].'/testservice/services/ 
> TransactionService?wsdl',
> true);
>
> $client->setCredentials($_SESSION['settings']['username'],$_SESSION 
> ['settings']['password']);
>   // Call the SOAP method
>   $result = $client->call('runTransaction', array('transactionId' =>
> $transactionId, 'content' => $transactionContent));
>
>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net




More information about the UPHPU mailing list