WSDL erreur : 404 not found
Les fichiers sont bien placés mais Est-ce qu'il faut installer le PERL dans le Wamp ? car j l'ai installé en dehors du dossier Wamp ?
Voici mes codes :
WorldFunctions.pm (C:\Perl\SOAP-Lite\WorldFunctions.pm) : la classe de traitement
Code:
1 2 3 4 5 6 7 8
| package WorldFunctions;
sub new { bless {}, shift; }
sub Hello { my ($s, $name) = @_;
return 'Hello, ' . $name . "\n";
}
sub GoodBye { my ($s, $name) = @_;
return 'Goodbye, ' . $name . "\n";
} |
a.pl (C:\Perl\SOAP-Lite\a.pl) : pour créer le fichier WSDL de la classe WorldFunctions.pm
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| #!/usr/bin/perl
use WSDL::Generator;
my $init = {
'schema_namesp' => 'http://localhost/world/WorldFunctions.xsd',
'services' => 'WorldFunctions',
'service_name' => 'WorldFunctions',
'target_namesp' => 'http://localhost/world',
'documentation' => 'Simple Hello World SOAP Service.',
'location' => 'http://localhost/world'
};
my $w = WSDL::Generator->new($init);
WorldFunctions->Hello('Joe');
WorldFunctions->GoodBye('Joe');
print $w->get(WorldFunctions); # Returns the WSDL code for a specific class
open(TOTO,"<a.wsdl");
close(TOTO);
open(TOTO,">a.wsdl");
print TOTO $w->get(WorldFunctions);
close(TOTO); |
c.pl (C:\Perl\SOAP-Lite\c.pl) : le client perl du fichier WSDL
Code:
1 2 3 4 5 6 7
| #!perl -w
#!/usr/bin/perl
use DBI();
use CGI;
use SOAP::Lite;
my $service = SOAP::Lite-> service('file:a.wsdl');
print "test retour : |".$service-> Hello('Joe')."|"; |
Sachant que je utilise un serveur local (avec Wamp server) et j’ai copié WorldFunctions.pm dans ma répertoire localhost/world.
Could not find or load mod_perl
Toujours pas de réponse :(
j'ai avancé unpeu et je suis bloqué sur un autre problème : lorsque j'execute le code qui suit, il m'affiche l'erreur "Could not find or load mod_perl at C:/Perl/site/lib/SOAP/Transport/HTTP.pm line 741"
mais j'ai installé le module mod_apache2 avec succés
Voici le code :
Code:
1 2 3 4 5 6 7 8
| #!/usr/bin/perl
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::Apache
-> dispatch_to('WorldFunctions')
-> handle;
package WorldFunctions;
sub new { bless {}, shift; } |
Aidez-moi ! c'est urgent .