Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Custom SOAP::Serializer for complexType

Expand Messages
  • Paul Kulchenko
    Hi, Sylvain! ... all you need to do is this: $soap- maptype- { biBusHeader } = http://.../bibus/2 ; If you don t do this, SOAP::Lite will use default
    Message 1 of 3 , Jun 14, 2002
    • 0 Attachment
      Hi, Sylvain!

      > What I want is my own namespace (not perl's one) like:
      all you need to do is this:

      $soap->maptype->{'biBusHeader'} = 'http://.../bibus/2';

      If you don't do this, SOAP::Lite will use default namespace. Hope it
      helps.

      Best wishes, Paul.

      --- sylvainstg <sylvainstg@...> wrote:
      > Hi all,
      >
      > When I write:
      > my $header = SOAP::Header->name('biBusHeader' => new
      > biBusHeader());
      >
      > my SOAP header is being serialized as:
      > <biBusHeader xsi:type="namesp2:biBusHeader">...
      >
      > (where namesp2 is defined as http://namespaces.soaplite.com/perl)
      >
      > What I want is my own namespace (not perl's one) like:
      >
      > <biBusHeader xsi:type="bus:biBusHeader"
      > xmlns:bus="http://.../bibus/2">...
      >
      > I can achieve this by setting the type and and attribute on the
      > SOAP::Header object :
      > ->attr({'xmlns:bus' => 'http://.../bibus/2'})
      > ->type('bus:biBusHeader');
      >
      > This is rather ugly to me since I have a quite complex header and I
      >
      > would have to ask my users to do this for each of them. So, I
      > looked
      > into hacking into the SOAP::Serializer.
      >
      > I simply added my type 'biBusHeader' in the _typeLookup hash:
      >
      > biBusHeader => [51, sub {1}, 'as_biBusHeader'],
      >
      > And implemented the as_biBusHeader method:
      >
      > sub as_biBusHeader {
      > my $self = shift;
      > my($value, $name, $type, $attr) = @_;
      > return [
      > $name,
      > {'xsi:type' => 'bus:biBusHeader',
      > 'xmlns:bus' => 'http://.../bibus/2', %$attr},
      >
      > ### SEE (1) below
      > #$self->encode_object($value, $name, $type, $attr)];
      >
      > ### SEE (2) below
      > $value];
      > }
      >
      > When I use form (1) serialization fails. When I use form (2) I get
      > a
      > reference to my object: 'SOAP::Header=HASH(0x34bec78)'...
      >
      > Am I taking the appropriate approach or not? If so what should my
      > custom serialiser be doing to serialize properly?
      >
      > Many thanks
      > Sylvain.
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Yahoo! - Official partner of 2002 FIFA World Cup
      http://fifaworldcup.yahoo.com
    Your message has been successfully submitted and would be delivered to recipients shortly.