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

Well it would be better if we could see the whole WSDL for the service but I think the problem is with the <c-gensym3 /> around the <Context /> element - you can lose that by not using the extra SOAP::Data as I described above; it is also possible that you need to supply specific names for the other 'arguments' to changeDeliveryState which is better described in the WSDL.

/J\

Replies are listed 'Best First'.
Re^6: using a client SOAP with SOAP::Lite with ComplexType
by jeanba (Novice) on May 12, 2006 at 09:24 UTC
    I can't show you the whole WSDL file but only a few line :
    <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://DefaultNamespace" xmlns:apac +hesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://DefaultNam +espace" xmlns:intf="http://DefaultNamespace" xmlns:soapenc="http://sc +hemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://fake.bean.middle +.delivery.agen.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xml +ns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http:/ +/www.w3.org/2001/XMLSchema"> <!--WSDL created by Apache Axis version: 1.2RC2 Built on Nov 16, 2004 (12:19:44 EST)--> <wsdl:types> <schema targetNamespace="http://fake.bean.middle.delivery.agen.com" +xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <complexType name="Context"> <sequence> <element name="agent" type="xsd:boolean"/> <element name="deliveryBlockedByApproval" type="xsd:boolean"/> <element name="fiabilisation" type="xsd:boolean"/> <element name="fromDispatch" type="xsd:boolean"/> <element name="fromEmission" type="xsd:boolean"/> <element name="fromSite" type="xsd:boolean"/> <element name="hasComment" nillable="true" type="soapenc:string"/ +> <element name="hasMetaDossier" nillable="true" type="soapenc:stri +ng"/> <element name="market" nillable="true" type="soapenc:string"/> <element name="mdHasConstraints" type="xsd:boolean"/> <element name="user" nillable="true" type="soapenc:string"/> </sequence> </complexType> . . . </schema> </wsdl:types> . . . <wsdl:message name="changeDeliveryStateRequest"> <wsdl:part name="in0" type="tns1:Context"/> <wsdl:part name="in1" type="xsd:long"/> <wsdl:part name="in2" type="xsd:long"/> </wsdl:message> . . . <wsdl:portType name="DeliveryServiceInterface"> <wsdl:operation name="changeDeliveryState" parameterOrder="in0 i +n1 in2"> <wsdl:input message="impl:changeDeliveryStateRequest" name="c +hangeDeliveryStateRequest"/> <wsdl:output message="impl:changeDeliveryStateResponse" name= +"changeDeliveryStateResponse"/> </wsdl:operation> . . . </ </wsdl:portType> <wsdl:definitions>
    juste let me know if you need more..cause it's from my work...;)
      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.