I'm setting up a Web Service in c# and they are calling it using perl Soap::Lite. I am trying to get the program to remove the namespace prefox, and instead, define the full namespace as an xmlns attribute in the action tag. The request generated looks like this
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:tns="https://mynamespace.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<tns:myMethod>
<name xsi:type="s:string">First Cycle</name>
<desc xsi:type="s:string"> The Description</desc>
</tns:myMethod>
</soap:Body>
</soap:Envelope>
The code that generated the request above is this
use strict ;
use warnings ;
use SOAP::Lite +trace => [ transport => sub { print $_[0]->as_string } ];;
my $ns = "https://mynamespace.org";
my $HOST = "http://localhost:54387/WebService.asmx";
my $wsdl = "http://localhost:54387/WebService.asmx?wsdl";
my $soap = SOAP::Lite->service($wsdl);
$soap->default_ns($ns);
my $som = $soap->myMethod(
'First Cycle', 'The Description'
);
die $som->fault->{ faultstring } if ($som->fault);
print $som->result, "\n";
The parameters in the above show null in the web service because C# parses the parameters as being in different namespaces. instead of the prefix, I'd like the action to look like this
<myMethod xmlns="https://mynamespace.org">
I've tried using
my $soap = SOAP::Lite->new( proxy => $HOST);
instead of the service description. It works but the paramters are changes to something like this <c-sysgen3 xsi:type="s:string"><c-sysgen3>
I want the request to look like this
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:tns="https://mynamespace.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<myMethod xmlns="https://mynamespace.org">
<name xsi:type="s:string">First Cycle</name>
<desc xsi:type="s:string"> The Description</desc>
</myMethod>
</soap:Body>
</soap:Envelope>
or like this
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:tns="https://mynamespace.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<tns:myMethod>
<tns:name xsi:type="s:string">First Cycle</tns:name>
<tns:desc xsi:type="s:string"> The Description</tns:desc>
</tns:myMethod>
</soap:Body>
</soap:Envelope>
I should mention I am not allowed to explicitly define the element tags in perl e.g.
$soap->call('myMethod',
SOAP::Data->name('name')->value( 'First Cycle' ),
SOAP::Data->name('desc')->value('The Description') );
Please Help (-:
Edit: My version of perl is 5.28.1 and the version of SOAP::Lite is 1.27 I.m also using .net framework 4.5
Edit: I should probably add my web service implementation
namespace WebService
{
[WebService(Namespace = "https://mynamespace.org")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class SoapService : System.Web.Services.WebService
{
[WebMethod]
public string myMethod(string name, string desc)
{
// Implementation here
}
}
}