Generating Client code using svcutil
I am trying to generate client proxy code using svcutil.exe tool. And its throwing follwong error.
I am using following command.
svcutil /namespace:http://www.starstandard.org/STAR/5,* /out:STARContract.cs /noConfig SendOrderOrder.wsdl SendOrderOrderType.xsd
--------------------Output ----------------------
Error: There was an error verifying some XML Schemas generated during export: The 'http://www.starstandard.org/STAR/5:SendOrder' element is not declared.
Error: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Descripti on.XmlSerializerMessageContractImporter Error: The elemen开发者_如何学Got 'http://www.starstandard.org/STAR/5:SendOrder' is missing. XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.starstandards.org/webservices /2005/10/transport/bindings']/wsdl:portType[@name='starTransportPortTypes']
Error: Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://www.starstandards.org/webservice s/2005/10/transport/bindings']/wsdl:portType[@name='starTransportPortTypes'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.starstandards.org/webservices /2005/10/transport/bindings']/wsdl:binding[@name='starTransport']
Error: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://www.starstandards.org/webservices /2005/10/transport/bindings']/wsdl:binding[@name='starTransport'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.starstandards.org/webservices /2005/10/transport/bindings']/wsdl:service[@name='SendOrderWebService']/wsdl:port[@name='SendOrderStarTransport']
Generating files... Warning: No code was generated. If you were trying to generate a client, this could be because the metadata documents did not contai n any valid contracts or services or because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to use the /dataContrac tOnly option.
--------- End of output -----------------
The relative file references looks fine.
When I try to create same code using WSE it works fine and generate relate proxy class without any errors. However it does not work when using svcutil.exe.
Any idea?
I'm not familiar with WSDL/XSDs you are referring to so I can't explain the specifics of why this is failing.
However, in my view, the code generation aspects of the .Net wsdl and xsd tools have been broken for a long time. They do not cope with many standard industry conventions (including handling AttributeGroup constructs, coercing of namespaces on includes, poor handling of nillable elements, and the list goes on.
If your WSDL/XSD files use import and/or include statements .Net is probably going to choke. I have had a number of occasions where tools like SOAPUI correctly handle the WSDL and can generate various artifacts but .Net is unable to cope.
Some people have had some success with a tool called WSCF Blue but unfortunately I have generally flattened/tidied the WSDL/XSD file by hand until .Net can cope with it.
精彩评论