This queue is for tickets about the SOAP-Lite CPAN distribution.

Report information
The Basics
Id:
88448
Status:
open
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
herwig.burgert [...] hhjb.it
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Compatibility to M$ web services retrieved by wsdl
Date: Fri, 06 Sep 2013 00:09:48 +0200
To: bug-SOAP-Lite@rt.cpan.org
From: Herwig Burgert <herwig.burgert@hhjb.it>
Hallo SOAP::Lite developers,

to satisfy the M$ web service recommendation (you described this in conjunction with the default_ns directive),
an adequate method is needed when service definition is retrieved via wsdl.

I've done following changes to satisfy M$ but this should be done maybe by parameter-passing to the service directive
or by setting a flag to do so:

...
package SOAP::Schema;
...
sub _call {
    my ($self, $method) = (shift, shift);
    my $name = UNIVERSAL::isa($method => 'SOAP::Data') ? $method->name : $method;
    my %method = %{$methods{$name}};
    $self->proxy($method{endpoint} || Carp::croak "No server address (proxy) specified")
        unless $self->proxy;
    my @templates = @{$method{parameters}};
    my @parameters = ();
    foreach my $param (@_) {
        if (@templates) {
            my $template = shift @templates;
            my ($prefix,$typename) = SOAP::Utils::splitqname($template->type);
            my $method = 'as_'.$typename;
            # TODO - if can('as_'.$typename) {...}
            my $result = $self->serializer->$method($param, $template->name, $template->type, $template->attr);
            push(@parameters, $template->value($result->[2]));
        }
        else {
            push(@parameters, $param);
        }
    }
### BEGIN HHJB ###
#   $self->endpoint($method{endpoint})
#      ->ns($method{namespace})
#      ->on_action(sub{qq!"$method{soapaction}"!});
    $self->endpoint($method{endpoint})
       ->default_ns($method{namespace})
       ->on_action(sub{qq!"$method{soapaction}"!});
#### END HHJB ####
EOP
### BEGIN HHJB ###
#   my $namespaces = $self->deserializer->ids->[1];
#   foreach my $key (keys %{$namespaces}) {
#       my ($ns,$prefix) = SOAP::Utils::splitqname($key);
#       $self->{'_stub'} .= '  $self->serializer->register_ns("'.$namespaces->{$key}.'","'.$prefix.'");'."\n"
#           if ($ns eq "xmlns");
#   }
#### END HHJB ####
    $self->{'_stub'} .= <<'EOP';
    my $som = $self->SUPER::call($method => @parameters);
    if ($self->want_som) {
        return $som;
    }
    UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall : $som->result : $som;
}


These changes have been necessary to produce working SOAP like this:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <Read xmlns="urn:microsoft-dynamics-schemas/page/customer">
            <No xsi:type="xsd:string">700200</No>
        </Read>
    </soap:Body>
</soap:Envelope>

instead of this not working with M$:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:microsoft-dynamics-schemas/page/customer" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <tns:Read>
            <No xsi:type="xsd:string">700200</No>
        </tns:Read>
    </soap:Body>
</soap:Envelope>


Kind regards
Herwig Burgert

Subject: Re: [rt.cpan.org #88448] Compatibility to M$ web services retrieved by wsdl
Date: Thu, 5 Sep 2013 21:00:15 -0700
To: bug-SOAP-Lite@rt.cpan.org
From: Fred Moyer <fred@redhotpenguin.com>
Could you submit this as a github pull request please? If you don't have a github account, create one, then fork the codebase, apply your change, commit, and send me a pull request. I don't really know what to change from your post.



On Thu, Sep 5, 2013 at 3:10 PM, Herwig Burgert via RT <bug-SOAP-Lite@rt.cpan.org> wrote:
Show quoted text
Thu Sep 05 18:10:13 2013: Request 88448 was acted upon.
Transaction: Ticket created by herwig.burgert@hhjb.it
       Queue: SOAP-Lite
     Subject: Compatibility to M$ web services retrieved by wsdl
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: herwig.burgert@hhjb.it
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=88448 >


Hallo SOAP::Lite developers,

to satisfy the M$ web service recommendation (you described this in conjunction
with the default_ns directive),
an adequate method is needed when service definition is retrieved via wsdl.

I've done following changes to satisfy M$ but this should be done maybe by
parameter-passing to the service directive
or by setting a flag to do so:

...
package SOAP::Schema;
...
sub _call {
    my ($self, $method) = (shift, shift);
    my $name = UNIVERSAL::isa($method => 'SOAP::Data') ? $method->name : $method;
    my %method = %{$methods{$name}};
    $self->proxy($method{endpoint} || Carp::croak "No server address (proxy)
specified")
        unless $self->proxy;
    my @templates = @{$method{parameters}};
    my @parameters = ();
    foreach my $param (@_) {
        if (@templates) {
            my $template = shift @templates;
            my ($prefix,$typename) = SOAP::Utils::splitqname($template->type);
            my $method = 'as_'.$typename;
            # TODO - if can('as_'.$typename) {...}
            my $result = $self->serializer->$method($param, $template->name,
$template->type, $template->attr);
            push(@parameters, $template->value($result->[2]));
        }
        else {
            push(@parameters, $param);
        }
    }
### BEGIN HHJB ###
#   $self->endpoint($method{endpoint})
#      ->ns($method{namespace})
#      ->on_action(sub{qq!"$method{soapaction}"!});
    $self->endpoint($method{endpoint})
       ->default_ns($method{namespace})
       ->on_action(sub{qq!"$method{soapaction}"!});
#### END HHJB ####
EOP
### BEGIN HHJB ###
#   my $namespaces = $self->deserializer->ids->[1];
#   foreach my $key (keys %{$namespaces}) {
#       my ($ns,$prefix) = SOAP::Utils::splitqname($key);
#       $self->{'_stub'} .= '
$self->serializer->register_ns("'.$namespaces->{$key}.'","'.$prefix.'");'."\n"
#           if ($ns eq "xmlns");
#   }
#### END HHJB ####
    $self->{'_stub'} .= <<'EOP';
    my $som = $self->SUPER::call($method => @parameters);
    if ($self->want_som) {
        return $som;
    }
    UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall :
$som->result : $som;
}


These changes have been necessary to produce working SOAP like this:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <Read xmlns="urn:microsoft-dynamics-schemas/page/customer">
            <No xsi:type="xsd:string">700200</No>
        </Read>
    </soap:Body>
</soap:Envelope>

instead of this not working with M$:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:microsoft-dynamics-schemas/page/customer"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <tns:Read>
            <No xsi:type="xsd:string">700200</No>
        </tns:Read>
    </soap:Body>
</soap:Envelope>


Kind regards
Herwig Burgert





This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.