2010-02-26 16 views
15

मैं इस तरह एक WebService बना लिया है से एक WSDL फ़ाइल उत्पन्न करने के लिए? मैंने खोज की और मुझे SvcUtil.exe & wsdl.exe के बारे में जानकारी मिली, लेकिन यह केवल एक कार्यशील वेब सेवा से डब्लूएसडीएल को पुनर्प्राप्त करते समय ही काम करता है।कैसे एक सी # वेब सेवा

(जावा के लिए, वहाँ एक उपकरण java2wsdl कहा जाता है, वहाँ के लिए #सी एक बराबर है?)



: अपडेट:
संदर्भ के लिए यह सवाल यह है कि मैं SharePoint पर नई कस्टम वेब सेवा जोड़ना चाहता हूं जिसे SharePoint पर _vti_bin फ़ोल्डर में WSPBuilder का उपयोग करके तैनात किया जाना चाहिए। SharePoint.SE पर भी my post देखें।

और मैं स्वचालित रूप से (MSBuild कमांड का प्रयोग) उत्पन्न करना चाहते 'MyServicewsdl.aspx' & 'MyServicedisco.wsdl' जो _vti_bin फ़ोल्डर में रखा जाना चाहिए।



शायद मैं कुछ बातें याद कर रहा हूँ? svcutil.exe से आउटपुट है:

bin\Debug>SvcUtil.exe MyWebService.dll 
Microsoft (R) Service Model Metadata Tool 
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152] 
Copyright (c) Microsoft Corporation. All rights reserved. 

Generating metadata files... 
Warning: No metadata files were generated. No service contracts were exported. 
To export a service, use the /serviceName option. To export data contracts, spe 
cify the /dataContractOnly option. This can sometimes occur in certain security 
contexts, such as when the assembly is loaded over a UNC network file share. If 
this is the case, try copying the assembly into a trusted environment and runnin 
g it. 
+1

आप .NET 2.0 का उपयोग कर फंस रहे हैं पर पाया जा सकता है? आप नई एएसएमएक्स वेब सेवाएं क्यों बना रहे हैं? –

+0

अद्यतन प्रश्न पाठ देखें ... –

+0

प्रॉक्सी फ़ाइल प्राप्त करने के लिए आपको एएसएमएक्स सेवा लैंडिंग पृष्ठ के यूआरएल का उपयोग करना होगा, असेंबली डीएलएल नहीं। – vapcguy

उत्तर

15

मैंने एक ऐसा टूल बनाया है जो एक संकलित सी # असेंबली (डीएलएल) से डब्लूएसडीएल फ़ाइल उत्पन्न कर सकता है जिसमें एक या अधिक वेब सर्विसेज हैं। आम तौर पर आप चल रहे एक सेवा (आईआईएस या अन्य) जो .asmx होस्ट करता है, ताकि आप /MyWebService.asmx?wsdl

का उपयोग कर यह उपकरण एक विधानसभा से सभी जानकारी प्राप्त कर सके प्रतिबिंब का उपयोग कर एक WSDL फ़ाइल उत्पन्न डबल्यूएसडीएल प्राप्त कर सकते हैं की आवश्यकता होती है (dll)।

डाउनलोड https://github.com/StefH/WSDLGenerator

+1

क्या WSDLGenerator WCF के साथ भी काम करता है? मैं [इस सवाल] के लिए एक समाधान खोज रहा हूं (http://stackoverflow.com/questions/11099335/bind-a-custom-wsdl-to-an-existing-wcf- सेवा)। –

5

svcutil /?

      -= METADATA EXPORT =- 

Description: svcutil.exe can export metadata for services, contracts and data types in compiled assemblies. To 
    export metadata for a service, you must use the /serviceName option to indicate the service you would like 
    to export. To export all Data Contract types within an assembly use the /dataContractOnly option. By 
    default metadata is exported for all Service Contracts in the input assemblies. 

Syntax: svcutil.exe [/t:metadata] [/serviceName:<serviceConfigName>] [/dataContractOnly] <assemblyPath>* 

<assemblyPath> - The path to an assembly that contains services, contracts or Data Contract types to be 
        exported. Standard command-line wildcards can be used to provide multiple files as input. 

Options: 

/serviceName:<serviceConfigName> - The config name of a service to export. If this option is used, an 
            executable assembly with an associated config file must be passed as 
            input. Svcutil will search through all associated config files for the 
            service configuration. If the config files contain any extension types, 
            the assemblies containing these types must either be in the GAC or 
            explicitly provided using the /r option. 
/reference:<file path>   - Add the specified assembly to the set of assemblies used for resolving 
            type references. If you are exporting or validating a service that uses 
            3rd-party extensions (Behaviors, Bindings and BindingElements) registered 
            in config use this option to locate extension assemblies that are not in 
            the GAC. (Short Form: /r) 
/dataContractOnly    - Operate on Data Contract types only. Service Contracts will not be 
            processed. (Short Form: /dconly) 
/excludeType:<type>    - The fully-qualified or assembly-qualified name of a type to exclude from 
            export. 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 /dconly option. (Short Form: /et) 
2

देखें Svcutil.exe निश्चित रूप से नीचे सेवा के साथ डबल्यूएसडीएल उत्पन्न होगा। सही उपयोग svcutil your.executable.dll (exe) है। मैं इसका बहुत उपयोग कर रहा हूं इसलिए मुझे यकीन है कि यह डब्लूएसडीएल उत्पन्न करेगा।

+0

svcutil.exe त्रुटि दिखाता है "चेतावनी: कोई मेटाडेटा फ़ाइलें उत्पन्न नहीं हुईं" –

संबंधित मुद्दे