Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filtering a WSDL to Only Some Operations

Tags:

wsdl

wcf

I have a huge WSDL, but I need just a few methods from it.

Is it possible to generate WCF proxies only for these methods?

"Full implementation" adds 9 megabytes to my DLL.

like image 951
Sergey Popov Avatar asked Nov 19 '12 22:11

Sergey Popov


2 Answers

You could manually build data contracts and an interface containing just the operations you are interested in and then use that interface with a ChannelFactory to create a basic client that will target only those operations, or...

... you could also strip the WSDL from all operations and elements you do not need and feed the result to svcutil.exe to create a simpler client. A safer approach would be to feed the large WSDL to svcutil.exe and strip what you do not need from the generated code (it's safer because the compilers will inform you immediately if you delete something you were not supposed to).

Either way, I think you will have to perform some manual interventions.

like image 195
Bogdan Avatar answered Nov 10 '22 12:11

Bogdan


svcutil has an /excludeType flag. It can be used during meta data export and type generation.

From the svcutil command line help:

/excludeType: - Fully-qualified or assembly-qualified type name to exclude from export or validation. This option can be used when exporting metadata for a service or a set of service contracts to exclude types from being exported. This option cannot be used with the /dataContractOnly option. (Short Form: /et)

The answer to How do I export metadata for a single contract with svcutil.exe? uses it to solve a simliar problem.

I hope type filtering works for you, because I don't know of an "out the box" way to do it by method.

like image 38
ErnieL Avatar answered Nov 10 '22 14:11

ErnieL