I'm brand new to SOAP::Lite and trying to work through the quick start. I have a JAMA server (requirements gathering app) that supports SOAP and I am looking at its WSDL.
Is the information I need for SOAP::Lite available in the WSDL (specifically the proxy and the namespace/uri)?
The WSDL contains this:
<wsdl:definitions xmlns:ns1="http://v3.ws.contour.jamasoftware.com/"
xmlns:ns2="http://cxf.apache.org/bindings/xformat"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://v3.ws.contour.jamasoftware.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ContourSoapServiceV3"
targetNamespace="http://v3.ws.contour.jamasoftware.com">
<wsdl:import
location="http://MYSERVER/jama/ws/v3/soap/ContourSoapService?wsdl=ContourSoapService.wsdl"
namespace="http://v3.ws.contour.jamasoftware.com/"/>
<wsdl:binding name="ContourSoapServiceV3SoapBinding" type="ns1:ContourSoapService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
And a little later on...
<wsdl:operation name="getProjects">
<soap:operation soapAction="getProjects" style="document"/>
<wsdl:input name="getProjects">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getProjectsResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
For future reference, I did get this mostly working, here's the code:
my $soap = SOAP::Lite
-> proxy('http://MYSERVER/jama/ws/v3/soap/ContourSoapService')
-> uri('http://v3.ws.contour.jamasoftware.com');
print "Soap is $soap\n";
# Soap is SOAP::Lite=HASH(0x7fdc24e3fb70)
The PERL code I have sort of runs:
my $service = SOAP::Lite->service('http://MYSERVER/jama/ws/v3/soap/ContourSoapService?wsdl');
print "service is $service\n";
# This says service is ContourSoapServiceV3=HASH(0x7fd244804678) which is happy
# But then I can't figure out what to do with $service
my %hash = %$service;
foreach my $key (keys %hash )
{
print "key $key\n";
}
# service is ContourSoapServiceV3=HASH(0x7f8c8bf342f8)
# key _packager
# key _transport
# key _on_fault
# key _on_nonserialized
# key _deserializer
# key _on_action
# key _autoresult
# key _schema
my $schema = $service->_schema();
print "schema is $schema\n";
# Unrecognized method '_schema'. List of available method(s):
# getDownstreamRelationships getRelationshipsForProject addAttachmentToItem
# signBaseline clearSuspectLinksForItem deactivateProject
# and eventually:
# getVersion
# and then many more
print "Version is " . $service->getVersion(3, 6) . "\n";
# Use of uninitialized value in concatenation (.) or string at ./JamaItems.perl line 66.
# And if I bypass the $service it's no better:
print "Version is " . SOAP::Lite
-> proxy('http://MYSERVER/jama/ws/v3/soap/ContourSoapService')
-> uri('http://v3.ws.contour.jamasoftware.com')
-> getVersion(3, 6)
-> result . "\n";
# Use of uninitialized value in concatenation (.) or string at ./JamaItems.perl line 70.
The parameters I'm passing to getVersion() are definitely wrong, is that enough to cause the function to return nothing? I had thought it would at least return me some kind of error ...
I've used SOAP::Lite to talk to a .NET web-service (*.asmx format). The web-service provides a WSDL, but that's NOT what I reference in the code.
my $soap = SOAP::Lite
-> uri('http://myserver')
-> on_action( sub { join '/', 'http://myserver', $_[1] } )
-> proxy('http://myserver/services/GetEmailAddress/Service.asmx');
my $method = SOAP::Data->name('GetEmailAddress')
->attr({xmlns => 'http://myserver/'});
my @params = ( SOAP::Data->name(username => "someusername") );
my $email = $soap->call($method => @params)->result;
Everything in there I learned from https://msdn.microsoft.com/en-us/library/ms995764.aspx. Not sure if that will help you, as you might not have an asmx-format web-service, but maybe it will!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With