I'm attempting to use the WSDL interface with the soap-lite Perl
module.
I've done this in the past with other SOAP services, so I have some
experience, but I don't know WSDL very well.
I'm trying to use the NewSession WSDL interface, but my resultant
query isn't formed right... either that, or perhaps the version of
WSDL being used isn't compatible with soap-lite, which I believe only
supports version 1.0.
Which version of WSDL is being used in ifmap.wsdl?
Was the wsdl file generated with some sort of tool, or was it created
by hand?
If a tool was used (and the version is > 1.0) is there a way to export
a 1.0 version? If we're using a version > 1.0 already then the below
information may be moot.
One thing I've noticed is that the ifmap.wsdl file does things
differently than some of the examples I've seen floating around the
web, and it doesn't behave as I'd expect.
It *should* contain "new-session" in the body, but instead contains
"NewSession".
My script is below.
There are a few things you will need to do to make it work:
First, I assume a working omapd server.
0) (assuming Ubuntu) sudo apt-get install lib-soap-lite-perl
1) Download the wsdl and base xsd files and store them in the same
directory as the script.
2) Edit the wsdl file and change the references (both of them) to the
xsd file so that the name is correct (ifmap-base-1.0v28.xsd instead of
ifmap-base-1.0v23.xsd)
3) Edit the wsdl:service definition at the bottom of ifmap.wsdl to
point at
https://localhost:8081
3) Soft link the xsd to the root of the drive (I think there's a bug
in soap-lite) with sudo ln -s <full/path/to/ifmap-base-1.0v28.xsd> /
The Script:
#!/usr/bin/perl
use strict;
use warnings;
use SOAP::Lite
# For debugging
+trace=>'all';
my $soap = SOAP::Lite
->readable(1)
->service('file:ifmap.wsdl')
->endpoint("
https://127.0.0.1:8081");
my $soapResponse = $soap->NewSession();
Here's the resultant SOAP request:
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 692
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:ifmapwsdl="
http://www.trustedcomputinggroup.org/2008/IFMAP/1/
ifmap.wsdl"
xmlns:ifmap="
http://www.trustedcomputinggroup.org/2006/IFMAP/1"
xmlns:mime="
http://schemas.xmlsoap.org/wsdl/mime/"
soap:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:http="
http://schemas.xmlsoap.org/wsdl/http/">
<soap:Body>
<ifmapwsdl:NewSession xsi:nil="true" />
</soap:Body>
</soap:Envelope>
I did some research on WSDL trying to figure out why this was
happening... and I ran across the following tutorial:
http://www.w3schools.com/wsdl/wsdl_ports.asp
According to that page, a "message" type inside of a WSDL port is a
parameter. So I tried the following:
my $soapResponse = $soap->NewSession("NewSessionRequest");
Which gives a different result:
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 724
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:ifmapwsdl="
http://www.trustedcomputinggroup.org/2008/IFMAP/1/
ifmap.wsdl"
xmlns:ifmap="
http://www.trustedcomputinggroup.org/2006/IFMAP/1"
xmlns:mime="
http://schemas.xmlsoap.org/wsdl/mime/"
soap:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:http="
http://schemas.xmlsoap.org/wsdl/http/">
<soap:Body>
<ifmapwsdl:NewSession>
<request xsi:nil="true" />
</ifmapwsdl:NewSession>
</soap:Body>
</soap:Envelope>
So based on all of this I think the WSDL definition is incorrect.
I think that the WSDL format used here would behave as expected:
http://www.w3.org/2001/03/14-annotated-WSDL-examples.html
That example appears to use complex types and reference them from the
XSD, which is more like what I've done before... rather than message=
syntax, which doesn't behave properly... at least with soap-lite.