BuildWSDL.pm 916 Bytes
Newer Older
1 2 3 4 5
package Lemonldap::NG::Common::BuildWSDL;

use Lemonldap::NG::Common::Conf;

sub new {
6
    my ( $class, $configStorage ) = @_;
7
    my $self = bless {}, $class;
8 9
    my $lmConf = Lemonldap::NG::Common::Conf->new($configStorage)
      or die($Lemonldap::NG::Common::Conf::msg);
10 11 12 13 14
    $self->{conf} = $lmConf->getConf() or die "Unable to load configuration";
    return $self;
}

sub buildWSDL {
15 16 17 18
    my ( $self, $xml ) = @_;
    my $portal = $self->{conf}->{portal};
    $portal .= "index.pl" if ( $portal =~ /\/$/ );
    $xml =~ s/__PORTAL__/$portal/gs;
19 20
    $xml =~ s/__DOMAIN__/$self->{conf}->{domain}/gs;
    my @cookies = split /\s+/, $self->{conf}->{cookieName};
21 22 23
    s#(.*)#<element name="$1" type="xsd:string"></element># foreach (@cookies);

#s#(.*)#<element name="$1" nillable="true" type="xsd:string"></element># foreach(@cookies);
24 25 26 27 28 29
    $xml =~ s/__XMLCOOKIELIST__/join("\n",@cookies)/ges;
    return $xml;
}

1;