I now have a working sample Web service! Woohoo! I'm psyched!
As far as I can tell, my
WSDL document was written without any problems. It WAS, indeed, my
Perl server that had the problem. At first glance, it seemed as though it was my return values that had the problems. Instead of returning instances of the SOAP::Data class, I've been attempting to return flat scalar values. Even though the types are being defined in my
WSDL document, they must also be defined with the SOAP::Data instance being returned, along with the namespace URI.
Therefore, when creating a simple "pinger" service, instead of doing something like...
#!/usr/bin/perl
# Packages Used
use strict;
use warnings;
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('pingService')
-> handle;
package pingService;
sub ping()
{
my ($self, $input) = (shift, shift);
$input = 'PING? PONG!' if $input eq '';
return $input;
}
...I should be doing something like...
#!/usr/bin/perl
# Packages Used
use strict;
use warnings;
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('pingService')
-> handle;
package pingService;
sub ping()
{
my ($self, $input) = (shift, shift);
$input = 'PING? PONG!' if $input eq '';
return SOAP::Data
-> name('pingResult')
-> value("$input")
-> type('string')
-> uri('urn:pingService');
}
Then, if I want to call this service from
Visual Basic .NET (for instance), all I have to do is add the accompanying
WSDL document as a Web reference and then call the Web service like this:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim pingServiceInstance As New WebReferenceName.pingService
Me.TextBox1.Text = pingServiceInstance.ping("Testing 1 2 3...")
End Sub
Luckily, I DO have a decent
XML Schema type listing available to me (from
WSDL Essentials), so I will be able to look up any types that I'm not familiar with from
C++ or
Java.
Thanks to Perl Median for posting his
working sample code to the
SOAP::Lite mailing list! I can base my future work off of this, and use it as an example from which to learn. Modifications to the
WSDL should be easy, now that I have something I know works.
On a similar note, I'm almost completely caught up with my
PHP labs. How about that for cutting it close? *wide grin*
Security Level: Public