Hi, I need to call a method with 3 parameters. It should be easy , but one of this parameters is a ComplexType defined in a wsdl file like this :
<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>
I build the Complextype with the SOAP::Data::ComplexType mod and when i call the method i have this error message :
Type 'Context' can't be found in a schema class 'SOAP::Serializer'
FYI the complex type looks like this :
<?xml version="1.0" encoding="UTF-8"?> <SOAP:ENV xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:namesp2="http://namespaces.soaplite.com/perl" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <namesp1:Context xmlns:namesp1="http://wsprod.egencia.com/services/D +eliveryWS?wsdl" xsi:type="namesp2"> <agent xsi:type="xsd:int">1</agent> <user xsi:type="xsd:string">jbbec</user> </namesp1:Context> </SOAP:ENV>
the way i build the complex type is :
my $request_obj = ContextType_inner->new({Context=>{ user => 'jbbec', agent => 1 }}); print $request_obj->as_xml_data;# it's printing what is written above
and the mod ContextType_inner.pm is like :
package ContextType; use strict; use warnings; use SOAP::Data::ComplexType; use vars qw(@ISA); @ISA = qw(SOAP::Data::ComplexType); use constant OBJ_URI => 'http://my_serv/services/DeliveryWS?wsdl'; use constant OBJ_TYPE => ''; use constant OBJ_FIELDS => { user => ['string', undef, undef], agent => ['int', 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); } package ContextType_inner; use strict; use warnings; use SOAP::Data::ComplexType; use vars qw(@ISA); @ISA = qw(SOAP::Data::ComplexType); use constant OBJ_URI => 'http://my_serv/services/DeliveryWS?wsdl'; use constant OBJ_TYPE => ''; use constant OBJ_FIELDS => { Context => [ [ ContextType::OBJ_TYPE, ContextType::OBJ_FIELDS ], ContextType::OBJ_URI, 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); }
Could someone help me please ?

In reply to using a client SOAP with SOAP::Lite with ComplexType by jeanba

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.