I have a WSDL with dozens of XSD and I need to generate client code from the WSDL to consume a Web Service. The owner of the web service uses Java and generated the WSDL/XSD using JAXB. JAXB specifies a "binding file" for customized bindings, and the owner has generated a XJB file (JAXB customized binding file) to be used with the WSDL.
I need to generate my client code in C#, but svcutil and Visual Studio's Add Service Reference don't have any provisions for this customized bindings file. There are tools to generate Java client code that take a binding file as an argument, but no tools for C# generation. I've trying just running svcutil without specifying the XJB, but I can't get it to work. I've done extensive Google searches with no luck. Any ideas on how to make this work?
You can customize WSDLs by providing binding declarations, but these are Java specific and the customizations apply only while generating Java code from the WSDL. The bindings can be declared inline (embedded in the XSD/WSDL) or within a separate file. You have a separate file so I'm thinking the WSDL and XSDs are "clean".
The JXB file is a red herring though. A WSDL is supposed to be technology agnostic, it doesn't care about Java, C# or whatever. You should be able to generate the code because svcutil will just ignore the Java bindings.
What error does svcutil throw at you? I've seen it fail with hard to understand messages when the WSDL was missing a <type>
section. You mentioned dozens of XSD files, how are they imported in the WSDL and does the import work? If you open the WSDL in Visual Studio does it show validation errors, is it complaining about something?
Finally, if everything fails, you could feed it all (including the JXB file) to a Java tool like wsimport and get some Java files out of it. You can do a quick deploy with Endpoint.publish and then point svcutil to the deployed address plus ?wsdl
and see if you get a different result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With