Subject: | stubmaker is using the portType incorrectly when the WSDL described a document stype SOAP |
Greetings,
I started using stubmaker.pl to generate a stub by using a WSDL that
described a document style SOAP interface.
I executed the regular steps to generate the package and it was created
without warning or error.
After that I used the test.pl script to test the interface. The test.pl
was calling the generated method from the stub like this:
$f->Query( SOAP::Data->name('HealthCareProfessionals')->value('Contact') )
Generating this SOAP message:
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 655
Content-Type: text/xml; charset=utf-8
SOAPAction: "document/http://siebel.com/asi/:Query"
<?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:xsdLocal0="http://www.siebel.com/xml/BISAO Health Care
Professionals"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://siebel.com/asi/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<tns:Query>
<HealthCareProfessionals xsi:nil="true"
xsi:type="xsdLocal0:HealthCareProfessionals" />
</tns:Query>
</soap:Body>
</soap:Envelope>
This was the response of the server:
Cache-Control: no-cache, must-revalidate, max-age=0
Connection: close
Date: Fri, 10 Aug 2012 17:06:24 GMT
Pragma: no-cache
Via: 1.1 sahpx01.boehringer.com:80 (IronPort-WSA/7.1.3-014), 1.1
saopx03.am.boehringer.com:80 (IronPort-WSA/7.1.3-014)
Server: Microsoft-IIS/6.0
Content-Length: 755
Content-Type: text/xml;charset=UTF-8
Client-Date: Fri, 10 Aug 2012 17:06:24 GMT
Client-Peer: 127.0.0.1:60000
Client-Response-Num: 1
MicrosoftOfficeWebServer: 5.0_Pub
Proxy-Connection: close
X-Powered-By: ASP.NET
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001
/XMLSchema"><SOAP-ENV:Body><SOAP-ENV:Fault
xmlns:siebelf="http://www.siebel.com/ws/fault"><faultcode>Client</faultcode><faultstring>Argument
'tns:Query' for Operation 'Query' is not
known.(SBL-EAI-04304)</faultstring><detail><siebelf:errorstack><siebelf:error><siebelf:errorsymbol></siebelf:errorsymbol><siebelf:errormsg>Argument
'tns:Query' for Operation 'Query'
is not
known.(SBL-EAI-04304)</siebelf:errormsg></siebelf:error></siebelf:errorstack></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
And this the related error message:
s:Query' for Operation 'Query' is not known.(SBL-EAI-04304) at
C:\temp\soap\soap-lite\test.pl line 12.
I tested with SOAP UI the same WSDL and it generated this request:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:bis="http://www.siebel.com/xml/BISAO Health Care Professionals"
xmlns:bis1="http://siebel.com/asi/BISAO Health Care Professionals">
<soapenv:Header/>
<soapenv:Body>
<bis:HealthCareProfessionals>
<Contact>
<regionalConcilNumber>4206</regionalConcilNumber>
<federativeUnity>SP</federativeUnity>
<type>MEDICO</type>
</Contact>
</bis:HealthCareProfessionals>
</soapenv:Body>
</soapenv:Envelope>
I has some added data, but this is irrelevant. It works as expected and
the Boby does not include any "tns:Query" as complained by the server.
I copied the WSDL and forcely changed the portType and binding to use
"HealthCareProfessionals" as the operation name. This time, creating a
new stub and changing the called method to
my $som = $f->HealthCareProfessionals();
in test.pl generated the following message:
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 577
Content-Type: text/xml; charset=utf-8
SOAPAction: "document/http://siebel.com/asi/:Query"
<?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:xsdLocal0="http://www.siebel.com/xml/BISAO Health Care
Professionals"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://siebel.com/asi/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<tns:HealthCareProfessionals xsi:nil="true" />
</soap:Body>
</soap:Envelope>
with a non-error indicating message from the server:
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x22ae7ec)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Cache-Control: no-cache, must-revalidate, max-age=0
Connection: close
Date: Fri, 10 Aug 2012 17:12:40 GMT
Pragma: no-cache
Via: 1.1 sahpx01.boehringer.com:80 (IronPort-WSA/7.1.3-014), 1.1
saopx03.am.boehringer.com:80 (IronPort-WSA/7.1.3-014)
Server: Microsoft-IIS/6.0
Content-Length: 782
Content-Type: text/xml;charset=UTF-8
Client-Date: Fri, 10 Aug 2012 17:12:40 GMT
Client-Peer: 127.0.0.1:60000
Client-Response-Num: 1
MicrosoftOfficeWebServer: 5.0_Pub
Proxy-Connection: close
X-Powered-By: ASP.NET
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001
/XMLSchema"><SOAP-ENV:Body xmlns="http://siebel.com/asi/BISAO Health
Care Professionals"><Process_spcInstance_spcId
xsi:type="xsd:string"></Process_spcInstance_spcId><Object_spcId
xsi:type="xsd:string"><
/Object_spcId><Siebel_spcOperation_spcObject_spcId
xsi:type="xsd:string"></Siebel_spcOperation_spcObject_spcId><Error_spcCode
xsi:type="xsd:string"></Error_spcCode><Error_spcMessage
xsi:type="xsd:string"
Show quoted text
></Error_spcMessage><HealthCareProfessionals
xmlns="http://www.siebel.com/xml/BISAO Health Care
Professionals"></HealthCareProfessionals></SOAP-ENV:Body></SOAP-ENV:Envelope>
Looks like stubmaker is not considering that a document stype SOAP
message is different from the RPC style one. I'm not well versed in the
SOAP specification but due the results of the tests, that's the
conclusion that I make.
I attached the files used during the tests as well the last (working)
stub generated.
Regards,
Alceu
Subject: | test.wsdl |
Message body not shown because it is not plain text.
Subject: | BISAO_Health_Care_Professional.pm |
package BISAO_Health_Care_Professional;
# Generated by SOAP::Lite (v0.715) for Perl -- soaplite.com
# Copyright (C) 2000-2006 Paul Kulchenko, Byrne Reese
# -- generated at [Fri Aug 10 14:12:36 2012]
# -- generated from file:./test.wsdl
my %methods = (
'HealthCareProfessionals' => {
endpoint => 'http://saoasdctt1/eai_enu/start.swe?SWEExtSource=WebService&SWEExtCmd=Execute&UserName=sadmin&Password=newdc3000',
soapaction => 'document/http://siebel.com/asi/:Query',
namespace => 'http://siebel.com/asi/',
parameters => [
SOAP::Data->new(name => 'HealthCareProfessionals', type => 'xsdLocal0:HealthCareProfessionals', attr => {}),
], # end parameters
}, # end HealthCareProfessionals
); # end my %methods
use SOAP::Lite;
use Exporter;
use Carp ();
use vars qw(@ISA $AUTOLOAD @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter SOAP::Lite);
@EXPORT_OK = (keys %methods);
%EXPORT_TAGS = ('all' => [@EXPORT_OK]);
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);
}
}
$self->endpoint($method{endpoint})
->ns($method{namespace})
->on_action(sub{qq!"$method{soapaction}"!});
$self->serializer->register_ns("http://schemas.xmlsoap.org/soap/encoding/","soapenc");
$self->serializer->register_ns("http://www.siebel.com/xml/BISAO Health Care Professionals","xsdLocal0");
$self->serializer->register_ns("http://siebel.com/asi/","tns");
$self->serializer->register_ns("http://www.w3.org/2001/XMLSchema","xsd");
$self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/soap/","soap");
my $som = $self->SUPER::call($method => @parameters);
if ($self->want_som) {
return $som;
}
UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall : $som->result : $som;
}
sub BEGIN {
no strict 'refs';
for my $method (qw(want_som)) {
my $field = '_' . $method;
*$method = sub {
my $self = shift->new;
@_ ? ($self->{$field} = shift, return $self) : return $self->{$field};
}
}
}
no strict 'refs';
for my $method (@EXPORT_OK) {
my %method = %{$methods{$method}};
*$method = sub {
my $self = UNIVERSAL::isa($_[0] => __PACKAGE__)
? ref $_[0]
? shift # OBJECT
# CLASS, either get self or create new and assign to self
: (shift->self || __PACKAGE__->self(__PACKAGE__->new))
# function call, either get self or create new and assign to self
: (__PACKAGE__->self || __PACKAGE__->self(__PACKAGE__->new));
$self->_call($method, @_);
}
}
sub AUTOLOAD {
my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
return if $method eq 'DESTROY' || $method eq 'want_som';
die "Unrecognized method '$method'. List of available method(s): @EXPORT_OK\n";
}
1;
Subject: | test.pl |
use lib '.';
use BISAO_Health_Care_Professional;
use SOAP::Lite qw( debug );
my $f = BISAO_Health_Care_Professional->new();
$f->readable(1);
$f->want_som(1);
my $som = $f->Query( SOAP::Data->name('HealthCareProfessionals')->value('Contact') );
#my $som = $f->HealthCareProfessionals();
die $som->fault->{faultstring} if ( $som->fault );
print $som->result, "\n";
Subject: | BISAO_Health_Care_Professional.wsdl |
Message body not shown because it is not plain text.