Subject: | Missing support for inputless methods |
SOAP::Lite chokes on the following definition, because there is assumption that all messages have input and output. Clearly this is not a case, as there can be methods which either do not require any input or methods that do not give result.
<wsdl:operation name="getUpdatedDomains">
<soap:operation soapAction="https://server/api/service/call/api&method=getUpdatedDomains" style="rpc"/><wsdl:output>
<soap:body use="literal" namespace="https://server/api/"/>
</wsdl:output>
</wsdl:operation>
Please find proposed patch attached to fix this issue.
Subject: | 20130612_fix_inputless_soa.patch |
diff -urN a/Lite.pm b/Lite.pm
--- a/Lite.pm 2013-06-12 09:25:25.126594664 +0300
+++ b/Lite.pm 2013-06-12 09:24:58.183594637 +0300
@@ -3081,34 +3081,41 @@
$services{$opername} = {}; # should be initialized in 5.7 and after
my $soapaction = $_->operation->soapAction;
my $invocationStyle = $_->operation->style || $default_style || "rpc";
- my $encodingStyle = $_->input->body->use || "encoded";
- my $namespace = $_->input->body->namespace || $tns;
+ my $encodingStyle = "encoded";
+ my $namespace = $tns;
+ if ($_->input) {
+ $encodingStyle = $_->input->body->use || "encoded";
+ $namespace = $_->input->body->namespace || $tns;
+ };
+
my @parts;
foreach ($s->portType) {
next unless $_->name eq $porttype;
foreach ($_->operation) {
next unless $_->name eq $opername;
- my $inputmessage = SOAP::Utils::disqualify($_->input->message);
- foreach my $msg ($s->message) {
- next unless $msg->name eq $inputmessage;
- if ($invocationStyle eq "document" && $encodingStyle eq "literal") {
+ if ($_->input) {
+ my $inputmessage = SOAP::Utils::disqualify($_->input->message);
+ foreach my $msg ($s->message) {
+ next unless $msg->name eq $inputmessage;
+ if ($invocationStyle eq "document" && $encodingStyle eq "literal") {
# warn "document/literal support is EXPERIMENTAL in SOAP::Lite"
# if !$has_warned && ($has_warned = 1);
- my ($input_ns,$input_name) = SOAP::Utils::splitqname($msg->part->element);
- foreach my $schema ($s->types->schema) {
- foreach my $element ($schema->element) {
- next unless $element->name eq $input_name;
- push @parts,parse_schema_element($element);
+ my ($input_ns,$input_name) = SOAP::Utils::splitqname($msg->part->element);
+ foreach my $schema ($s->types->schema) {
+ foreach my $element ($schema->element) {
+ next unless $element->name eq $input_name;
+ push @parts,parse_schema_element($element);
+ }
+ $services{$opername}->{parameters} = [ @parts ];
}
+ }
+ else {
+ # TODO - support all combinations of doc|rpc/lit|enc.
+ #warn "$invocationStyle/$encodingStyle is not supported in this version of SOAP::Lite";
+ @parts = $msg->part;
$services{$opername}->{parameters} = [ @parts ];
}
}
- else {
- # TODO - support all combinations of doc|rpc/lit|enc.
- #warn "$invocationStyle/$encodingStyle is not supported in this version of SOAP::Lite";
- @parts = $msg->part;
- $services{$opername}->{parameters} = [ @parts ];
- }
}
}