logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: soapval object do not get serialized in client code: msg#00019

Subject: Re: soapval object do not get serialized in client code
On Thu, March 2, 2006 1:31 pm, Gamshad, Mohsen said:
> I have come to the conclusion that NuSoap is not handling serialization
> of parameters when they are of type soapval objects in client code.  I
> am consuming a .Net service (document/literal) that has in the WSDL
> input data defined as node attributes.  Therefore, I tried to code the
> input data as soapval object with the hope of being able to specify the
> attributes, but it doens't work.
>
> A little flow :
>
> client ----> call ----> serializeRPCParameters : in this method the
> parametersArrayType var is of type struct, which is not handled in any
> of the if() cases and falls to the last case which is calling
> serializeType() with null data values.  So, the payload does not get
> generated as one would expect.
 -->8--
> So, how can I specify node attributes in the input data?

Are you using the right function.  I thought you were on the server end
earlier, but as a client trying to generate the XML output I tried this.

I'm not sure about the XML namespaces and all the other parameters, but I
think this does what you are looking for with the right inputs.

<FlagUpdate xsi:type="xsd:string" Flag="flagstuff" ID="pr">value</FlagUpdate>

Here is the code.
<?
include_once('./lib/nusoap.php');

        /**
        * serializes PHP values in accordance w/ section 5. Type
information is
        * not serialized if $use == 'literal'.
        *
        * @param        mixed   $val    The value to serialize
        * @param        string  $name   The name (local part) of the XML
element
        * @param        string  $type   The XML schema type (local part)
for the element
        * @param        string  $name_ns        The namespace for the name
of the XML element
        * @param        string  $type_ns        The namespace for the type
of the element
        * @param        array   $attributes     The attributes to
serialize as name=>value pairs
        * @param        string  $use    The WSDL "use" (encoded|literal)
        * @return       string  The serialized element, possibly with
child elements
        * @access   public
*/

$ff = array('Flag' => 'flagstuff', 'ID' => 'pr');

$debug = 1;
$base = new nusoap_base();

$outxml = $base ->
serialize_val("value","FlagUpdate",$type=false,$name_ns=false,$type_ns=false,$ff,$use='encoded');

echo $outxml;
?>

Cheers,
Chris
-- 
http://www.nesser.org


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>