Generating a WCF client proxy and application configuration files using the svcutil tool with WSDL
Instructions for generating WCF clients from WSDL if the metadata of the service is unavailable.
If the metadata of the service cannot be directly retrieved to generate a client from the metadata from a running service, then, svcutil can be used to generate the client files from WSDL instead. The following modifications must be made to the WSDL to specify that the IBM MQ custom channel is to be used:
- Add the following namespace definitions and policy information:
<wsdl:definitions xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsp:Policy wsu:Id="CustomBinding_IWMQSampleContract_policy"> <wsp:ExtactlyOne> <wsp:All> <xms:xms xmlns:xms="http://sample.schemas.ibm.com/policy/xms" /> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> ... </wsdl:definitions>
- Modify the bindings section to refer to the new policy section and remove any transport definition from the underlying binding element:
<wsdl:definitions ...> <wsdl:binding ...> <wsp:PolicyReference URI="#CustomerBinding_IWMQSampleContract_policy" /> <[soap]:binding ... transport="" /> ... </wsdl:binding> </wsdl:definitions>
- Run svcutil from a command prompt, for example:
svcutil /language:C# /r: MQ_INSTALLATION_PATH\bin\IBM.XMS.WCF.dll /config:app.config MQ_INSTALLATION_PATH\src\samples\WMQAxis\default\service \soap.server.stockQuoteAxis_Wmq.wsdl
Parent topic: Building client applications for WCF