views:

927

answers:

2

Hi All,

I have .xsd file i need to convert it into wsdl,how would i do so?and is this conversion the right approach. I have request and response data in same .xsd file

A: 

Web Services Description Language Tool (Wsdl.exe)

abmv
is it downlaodable file? i am not getting the .exe in it ?
sarah
you will find it in the sdk folder
abmv
+1  A: 

You can not do that so easily. Usually, the xsd defines the structure (type) of the input and output messages. The wsdl used the xsd to define the operations that will be exposed by the service. An operation has usually a name and a pair of input and output messages.

I don't see how a tool could "reconstruct" the operations out of only the xsd only, except if it uses naming convention. E.g. messages requestDoIt and responseDoIt --> operation DoIt. If the xsd already contains the operations (which would be unusual) that could be ok, but it doesn't seem to be your case.

Manually creating the wsdl shouldn't be too long.

<types>
    <xsd:schema xmlns="..." targetNamespace="...">
        <xsd:import namespace="..." schemaLocation="MySchema.xsd"/>
    </xsd:schema>
</types>
...
 <wsdl:portType name="...">
    <wsdl:operation name="doIt">
        <wsdl:input message="tns:requestDoIt"/>
        <wsdl:output message="tns:responseDoIt"/>
    </wsdl:operation>
</wsdl:portType>

Have a look at WSDL essentials to get the general structure of the wsdl.

Or you can give a try to the tool WSDL Generator (from http://www.theprogrammerfactory.com/) whose purpose is apparently to ease this task. (Note that I never used it).

Another approach would be to generate classes out of the xsd, then use them to define the service class manually (this is the tedious part of matching types together into the corresponding operation) and then use another tool to transform the service class back into a complete wsdl. There are various tools available to convert to/from xsd and wsdl, for both Java or C#: wsgen, wsimport, xsd.exe, wsdl.exe.

ewernli
See also http://stackoverflow.com/questions/920086/generating-a-wsdl-from-a-xsd-file
ewernli