I'm having trouble writing a SOAP / XML client to talk to the API provided by Domainbox. I am writing a client in Perl using the module / library SOAP :: Lite. I get the following error message:
Possible SOAP version mismatch: The envelope namespace http://schemas.xmlsoap.org/soap/envelope/ was unexpected. Waiting for http://www.w3.org/2003/05/soap-envelope .
This is because the library sends the SOAP envelope using the SOAP 1.1 namespace, and the server expects SOAP 1.2.
But I can’t come up with a solution, I tried to explicitly set $ soap-> soapversion ('1.2'); in the SOAP :: Lite object, but this only affects the envelope received in the response message, and not the envelope sent by the client.
The server starts ASP.net and does not seem to want to accept SOAP version 1.1 messages.
A request to the soapversion () method returns version 1.1 by default, and when I change it to 1.2, it returns 1.2, but internally it explicitly ignores it somewhere.
WSDL does not seem to define xmlns: soap or xmlns: soap12 correctly, but SOAP :: Lite also does not use these namespaces. I would provide a link, but I am not allowed to post more than two here.
I also tried using the service () method of SOAP :: Lite, but that didn't make any difference.
Here is the code I'm using:
use strict;
use SOAP::Lite;
use Data::Dumper;
my $reseller = 'Removed';
my $username = 'Removed';
my $password = 'Removed';
my $soap = SOAP::Lite->new(proxy => 'https://sandbox.domainbox.net/');
$soap->default_ns('https://sandbox.domainbox.net/');
$soap->soapversion('1.2');
my $header = SOAP::Header->new->attr({xmlns => 'https://sandbox.domainbox.net/'});
my $body = SOAP::Data->name('CheckDomainAvailability' => \SOAP::Data->value(
SOAP::Data->name('AuthenticationParameters' => \SOAP::Data->value(
SOAP::Data->name('Reseller' => $reseller),
SOAP::Data->name('Username' => $username),
SOAP::Data->name('Password' => $password),
)
)
)
);
$soap->on_action( sub { "https://sandbox.domainbox.net/" });
my $som = $soap->call('',
$header,
$body
);
die $som->faultstring if ($som->fault);
print $som->result, "\n";
Additionally:
xmlns: soap http://schemas.xmlsoap.org/soap/envelope, soapversion . , Perl - WSDL, . WSDL: http://sandbox.domainbox.net/?WSDL
XML-:
<?xml version="1.0" encoding="UTF-8"?><Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org
/2001/XMLSchema-instance"><Header><c-gensym3
xmlns="https://sandbox.domainbox.net/" /></Header><Body><DomainboxAPI
xmlns="https://sandbox.domainbox.net/"><CheckDomainAvailability>
<AuthenticationParameters><Reseller
xsi:type="xsd:string">Removed</Reseller><Username
xsi:type="xsd:string">Removed</Username><Password
xsi:type="xsd:string">Removed</Password></AuthenticationParameters>
</CheckDomainAvailability></DomainboxAPI></Body></Envelope>
XML:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header>
<soap12:Upgrade xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:SupportedEnvelope qname="soap12:Envelope"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"/></soap12:Upgrade>
</soap:Header><soap:Body><soap:Fault><soap:Code>
<soap:Value>soap:VersionMismatch</soap:Value></soap:Code><soap:Reason>
<soap:Text xml:lang="en">Possible SOAP version mismatch: Envelope
namespace was unexpected. Expecting http://www.w3.org/2003/05/soap-
envelope.</soap:Text></soap:Reason><soap:Detail /></soap:Fault>
</soap:Body></soap:Envelope>
Update:
, , . SOAP:: Lite, , soapversion SOAP:: Lite:: Serializer. SOAP-, .
my $soap = SOAP::Lite->new(proxy => 'https://sandbox.domainbox.net/');
$soap->default_ns('https://sandbox.domainbox.net/');
$soap->soapversion('1.2');
$soap->serializer->soapversion('1.2');
, XML-, Domainbox, .
- Hash, SOAP:: Lite:: SOM . , .