We would like to provide the ability for customers to enter in a web service, our application would inspect the service, provide them with the input parameters and type, the customer would the input parameters and our application would call that web service. I have found code examples which will dynamically inspect and invoke .asmx services, examples in 3.5 which rely on a shared interface, and examples in 4.0 using the new 4.0 assemblies.
What I am missing is a way to dynamically inspect a WCF service using .NET 3.5 without exchanging a shared interface. I have been able to determine the service name and method, but the value parameters are not coming through on the WSDL.
Here is my simple service:
[OperationContract]
string GetDataInt(int value);
[OperationContract]
string GetDataStringInt(int value, string stringValue);
[OperationContract]
string GetDataStringIntBool(int value, string stringValue, bool boolValue);
And here is what is coming through as parameters on the WSDL (for the parameters):
<wsdl:message name="IService1_GetDataInt_InputMessage">
<wsdl:part name="parameters" element="tns:GetDataInt"/>
</wsdl:message>
<wsdl:message name="IService1_GetDataInt_OutputMessage">
<wsdl:part name="parameters" element="tns:GetDataIntResponse"/>
</wsdl:message>
<wsdl:message name="IService1_GetDataStringInt_InputMessage">
<wsdl:part name="parameters" element="tns:GetDataStringInt"/>
</wsdl:message>
<wsdl:message name="IService1_GetDataStringInt_OutputMessage">
<wsdl:part name="parameters" element="tns:GetDataStringIntResponse"/>
</wsdl:message>
The parameter types are not coming through on the wsdl. Is there a way in .NET 3.5 to inspect a WCF service and invoke it?
Parameters are of course coming in WSDL but WSDL is not flatten (unless you are using WCFExtras which provide flattened WSDL). You must look for WSDL and XSD imports – those points to another files containing rest of WSDL related information.