ecuguru has asked for the wisdom of the Perl Monks concerning the following question:

Hi gurus
I'm passing parameters in a soap call that are being auto-classed to something other than I'd like. My code is:

SOAP::Data->value(SOAP::Data->new->name('ID' => '0001')),SOAP::Data->value(SOAP::Data->new->name('pin' => '00001')) And they are getting encoded as integers, not strings:
<facilityPin xsi:type="xsd:int">0001</facilityPin> <personalPin xsi:type="xsd:int">00001</personalPin>

Anyway to define that I want those values passed as strings instead of integers? It seems to be auto-determining, which is very very cool, but the receiving code isn't handling the int correctly.

Full Code
$service -> AuthenticateUser(); my $som = $service -> call (SOAP::Data->name('AuthenticateUser')-> +attr({xmlns => 'http://test.live.org/WS/'}),SOAP::Data->value(SOAP::D +ata->new->name('id' => '0001')),SOAP::Data->value(SOAP::Data->new->na +me('pin' => '00001')),SOAP::Data->value(SOAP::Data->new->name('user' +=> 'user')),SOAP::Data->value(SOAP::Data->new->name('pass' => 'pass') +))||&soapGetBad();

Replies are listed 'Best First'.
Re: Soap Define Types
by grep (Monsignor) on Nov 02, 2006 at 17:54 UTC
    From SOAP::Data's POD:
    type(new type, optional value) $obj->type('int'); Gets or sets the type associated with the current value in the obj +ect. This is useful for those cases where the SOAP::Data object is us +ed to explicitly specify the type of data that would otherwise be int +erpreted as a different type completely (such as perceiving the strin +g 123 as an integer, instead). Allows the setting of the object's val +ue, if passed as a second argument to the method.


    grep
    One dead unjugged rabbit fish later
      That did it.
      SOAP::Data->value(SOAP::Data->type('string')->name('pin' => '001'))
      Thanks!!