in reply to Re^6: using a client SOAP with SOAP::Lite with ComplexType
in thread using a client SOAP with SOAP::Lite with ComplexType

Yes i did it !! in fact i had 2 problems :
- the first was the creation of the complexType
- the second the type of the other params ( long in the prototype) was translated as int in the enveloppe.
First issue :

the solution is :
This ComplexType mod is simpler than the first i wrote (at the biginning of this thread) :
package ContextType; use strict; use warnings; use SOAP::Data::ComplexType; use vars qw(@ISA); @ISA = qw(SOAP::Data::ComplexType); use constant OBJ_URI => 'http://w1.agen.com/services/DeliveryWS'; use constant OBJ_TYPE => 'ns1:Context'; use constant OBJ_FIELDS => { user => ['soapenc:string', undef, undef], agent => ['xsd:boolean', undef, undef], }; sub new { my $proto = shift; my $class = ref($proto) || $proto; my $data = shift; my $obj_fields = shift; $obj_fields = defined $obj_fields && ref($obj_fields) eq 'HASH' +? {%{$obj_fields}, %{+OBJ_FIELDS}} : OBJ_FIELDS; my $self = $class->SUPER::new($data, $obj_fields); return bless($self, $class); }
now, the enveloppe that i send looks like :
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:/ +/www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xm +lsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema +" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmln +s:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><change +DeliveryState xmlns="http://w1.agen.com/services/DeliveryWS"><c-gensy +m3><agent xsi:type="xsd:boolean">1</agent><user xsi:type="soapenc:str +ing">jbbec</user></c-gensym3><c-gensym7 xsi:type="xsd:long">526101</c +-gensym7><c-gensym9 xsi:type="xsd:long">2</c-gensym9></changeDelivery +State></soap:Body></soap:Envelope>
For the second issue, i found a dirty workaround in the Lite.pm file.
In fact all the int are long
'int' => [25, sub {$_[0] =~ /^[+-]?(\d+)$/ && $1 >= -214748 +3648;}, 'as_long'], 'long' => [20, sub {$_[0] =~ /^[+-]?(\d+)$/ && $1 >= -214748 +3648; }, 'as_long'],
I will change this very very dirty thing to a better one later, maybe this WE.