Answered by:
Can we generate web service proxy class from XSD

Question
-
just see this post https://social.msdn.microsoft.com/Forums/vstudio/en-US/75a9d4d8-3612-43a0-92c8-0382e8d43a8b/generate-c-code-from-xsd-files-for-use-as-wcf-service?forum=wcf
they said it is possible but i knew that we can only create proxy c# class from wsdl.
How we can generate proxy from xsd file because wsdl has web service location and operation details but xsd has only schema details. so how one can generate proxy from xsd file ? please share the info.
second question
svcutil to generate the datacontractsonly. SVCUTIL.EXE => http://msdn.microsoft.com/en-us/library/aa347733.aspxsvcutil /dconly XSDSchemaFile.xsd /language:C#
what this command is doing svcutil /dconly XSDSchemaFile.xsd /language:C# ?
can we generate proxy from data contact only if it is in xsd file ?
please share the knowledge. thanks
Wednesday, November 30, 2016 12:43 PM
Answers
-
Hi Mou_inn,
>> How we can generate proxy from xsd file because wsdl has web service location and operation details but xsd has only schema details. so how one can generate proxy from xsd file ?
As your understanding, we only could generate data contract class from xsd file, it is not enough to generate client proxy, I would suggest you create proxy from wsdl.
>> what this command is doing svcutil /dconly XSDSchemaFile.xsd /language:C# ?
This command will generate data contract types in C# from the local schema document XSDSchemaFile.xsd.
>> can we generate proxy from data contact only if it is in xsd file ?
You could generate data contract from xsd, in other words, the generated class will only contains data contract in xsd.
Best Regards,
EdwardMSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- Proposed as answer by Edward8520Microsoft contingent staff Friday, December 2, 2016 7:01 AM
- Marked as answer by Sudip_inn Friday, December 2, 2016 1:50 PM
Thursday, December 1, 2016 5:39 AM
All replies
-
WSDL (Web Services Description Language) describes your service and its operations - what is the service called, which methods does it offer, what kind of in parameters and return values do these methods have?
It's a description of the behavior of the service - it's functionality.
XSD (Xml Schema Definition) describes the static structure of the complex data types being exchanged by those service methods. It describes the types, their fields, any restriction on those fields (like max length or a regex pattern) and so forth.
It's a description of datatypes and thus static properties of the service - it's about data.
question
we know that we can create proxy from WSDL but is it possible to create proxy from XSD file instead of wsdl file ?
to create proxy from WSDL we usesvcutil
svcutil http://localhost/MyService/ClassName.svc /Language=c# /t:Code /out:ClassNameProxy.cs /config:ClassNameProxy.config
if it is possible to create proxy from xsd file then which tool i need to use ?
thanks
- Merged by Edward8520Microsoft contingent staff Thursday, December 1, 2016 5:55 AM same issue
Wednesday, November 30, 2016 12:18 PM -
Hi Mou_inn,
>> How we can generate proxy from xsd file because wsdl has web service location and operation details but xsd has only schema details. so how one can generate proxy from xsd file ?
As your understanding, we only could generate data contract class from xsd file, it is not enough to generate client proxy, I would suggest you create proxy from wsdl.
>> what this command is doing svcutil /dconly XSDSchemaFile.xsd /language:C# ?
This command will generate data contract types in C# from the local schema document XSDSchemaFile.xsd.
>> can we generate proxy from data contact only if it is in xsd file ?
You could generate data contract from xsd, in other words, the generated class will only contains data contract in xsd.
Best Regards,
EdwardMSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- Proposed as answer by Edward8520Microsoft contingent staff Friday, December 2, 2016 7:01 AM
- Marked as answer by Sudip_inn Friday, December 2, 2016 1:50 PM
Thursday, December 1, 2016 5:39 AM -
you said ;- we only could generate data contract class from xsd file, it is not enough to generate client proxy.
i like to know when people generate data contract class from xsd file then where they use that class ?
just like to know what is the usage of generating data contract class from xsd file ?
in real life tell me a scenario where it will be important to generate data contract class from xsd file ?
thanks
Friday, December 2, 2016 1:53 PM -
Hi Mou_inn,
In general, there are data contract in wsdl file. Sometime, we may import xsd in other files like below definition.
<wsdl:import namespace="http://message.bloggedbychris.com/contractfirstdemo/equipment/v1" location="EquipmentServiceData.xsd"></wsdl:import>
At this time, we will need wsdl and xsd file to generate client code.
Best Regards,
Edward
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Wednesday, December 7, 2016 6:27 AM