I have been passed-on a very simple C# asp.net web service with it's supposed source-code, that has just one public method called Sync(). Also, I am provided a Powershell script that calls this method of Web Service as shown in following code:
$ws = New-WebServiceProxy -uri <http://webservice.svc?wsdl>
$arg1 = $true
$arg2 = $true
$ws.Sync([ref] $arg1, [ref] $arg2)
When I look at the provided source-code, the Sync() method doesn't have any parameters. However, as you can notice that the Powershell is calling the Sync method with two arguments.
And the powershell runs fine with these two arguments being passed. When I remove the arguments from the call, it fails saying Cannot find an overload for "Sync" and the argument count: "0"
When I reverse-engineer the deployed DLL using dotPeek, it also shows the Sync method without any parameters.
This is quite confusing to me as I expected that the Webservice call from PowerShell to have no parameters so not sure why these additional parameters are passed and service call doesn't run without them.
Is this peculiar to Webservice being called from Powershell (that we need to pass additional params) or I am missing something obvious? Any pointers highly appreciated.
EDIT: Adding the wsdl section
<wsdl:operation name="Sync">
<soap:operation soapAction="http://tempuri.org/ISyncService/Sync" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>