Convert .xsd file to WSDL - xsd

I have a .xsd file and need to convert it to WSDL. How can I do that? Is converting it even the right approach? The .xsd file contains both request and response data.

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.

Web Services Description Language Tool (Wsdl.exe)

I realized in C# "XMas XSD Schema Tool" to incorporate an XSD Schema structure into a WSDL file.
The WSDL file produced includes minimal structures to be used in a web service consumer tool.
If you want to try it for free, you have the manual and download link here: https://www.nick4name.eu/downloads/xmas_en/
Let me know your opinion.

Related

Generate DDIC structure from XSD?

I have a number of XSDs that are part of the enterprise definitions for several services at the client.
I would like to be able to take a single XSD and generate a DDIC structure from it (without the use of PI!)
Seeing as you can generate proxies directly from a WSDL, and this also generates structures and data elements from the XSD definitions inside the WSDL, there is obviously already ABAP code that does this.
But do you know what classes/function modules to use to achieve this? Perhaps there is a convenient utility function or class method that takes the XSD as input and generates the relevant DDIC objects?
Some background on why I need this:
Some of the services include variable sections that include a piece of XML containing the data for one of the enterprise XSD entities; I am hoping to have a DDIC representation of these, which I can fill at runtime and then convert to XML to include in the message.
There is a program on the system called SPROX_XSD2PROXY with which you can upload one or more XSD files which will generate proxy objects for you.
You also end up with a service consumer with a corresponding class and what looks like a dummy operation.
The program is fairly short; it uploads the files(s) to an XSTRING, then converts the XSD(s) to WSDL(s) and finally the WSDL(s) to proxy objects using methods of a class called CL_PROXY_TEST_UTILS.
However, the result is satisfactory as it does give me a structure I can work with. And by examining the contents of those methods, it may be possible to build a more fine-tuned tool if I need one.

Generate XSD from Java WITH documentation

I created an XSD schema and have put in some documentation via the tag.
from the XSD i generated Java classes using Jaxb (from within eclipse - jdk1.6)
i now plan to use my java classes as "source" and modify them as per requirements that come up
I will generate XSD back from modified Java classes to keep the XSD in-sync.
in this process any "documentation" on the XSD gets lost. (i.e. when i generate it from Java). Is there some way to get around this? Thanks.

XSD question - Calling an xsd from another xsd

I know I have seen this somewhere before, but I cannot find it again. I need an example of calling an xsd file from within another xsd. This is quite useful where a number for xml files are being generated, but where there is large common areas between these xml files being validated. In that scenario, it is useful to have an xsd that validates the parts common to all xml files, then have separate smaller xsd validation files for the parts of the xml that are specific to each xml file.
Thanks
I'd probably call it referencing another XSD file (calling implies that the XSD is run or executed in some way, which isn't the case).
In any case you are probably looking for either the import or the include elements, for example:
<?xml version="1.0"?>
<xs:schema elementFormDefault="qualified" targetNamespace="http://www.w3.org/2001/05/XMLInfoset" xmlns="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.example.com/IPO" />
<xs:include schemaLocation="example.xsd" />
</xs:schema>
What is the difference between import and include? Use import to reference declarations in a different namespace and include to reference declarations in the same namespace.

Load XML file into object. Best method?

We are receiving an XML file from our client. I want to load the data from this file into a class, but am unsure about which way to go about it.
I have an XSD to defining what is expected in the XML file, so therefore i can easily validate the XML file.
Can i use the XSD file to load the data into a POCO, using some sort of serialization?
The other way i was thinking was to load the xml into a XMLDocument and use XPath to populate each property in my class.
Cheers for any advice
Depending on how complex the XSD is, you have a couple of options:
Use xsd.exe to generate C# classes which can be used in conjunction with the XmlSerializer.
Use svcutil.exe with the /dconly argument to generate DataContract-attributed types appropriate for use with the DataContractSerializer.

Integrating XMLRPC/Web Services with Core Data

I'm doing design for a project and nothing's been implemented - so I'm still going through the thought process to determine if Core Data is viable for the project.
Here's my query -
I want to create a managed object model using Core Data to represent some server side objects e.g Folder, File, etc....
All the objects (Folder, File etc..) are accessible via XMLRPC APIs that return some well formed XML.
For example, there may be an API called getFolders that can return the following -
<xml>
<folders>
<folder id=1>
<name>Test 123</name>
<files>
<file id=100>
<name>hello.txt</name>
<path>./hello.txt</path>
</file>
...
</files>
</folder>
...
</folders>
Similarly there can be an updateFolders API that operates on an existing folder item and for simplicity lets say it just updates the folder name. The request for it would post something like the following -
<xml>
<method name="updateFolder">
<folder_id="1">
<params>
<param name="folder_name" value="Test"/>
</params>
</method>
I'm trying to figure out -
1. How can I represent folder as a managed object i.e., how do I initialize it from the above XML
2. Once initialized, how can I handle an update to it using the updateFolder API shown above
It seems like the NSPersistentStore such as XMLStoreType point directly to actual XML files that hold the final data. In my case, the XML is simply whats returned from an XMLRPC call and the actual data is stored on a server side DB. Therefore, since the stores are not direct representations of the objects (or where the objects are stored), I was wondering if I should create a custom NSAtomicStore and handle load and save for initialization and update respectively. Here's a link on doing this for a NSAtomicStore -
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/AtomicStore_Concepts/Articles/asLoading.html#//apple_ref/doc/uid/TP40005298
Please let me know if this makes sense or if there's a better way to handle this.
Have you read through:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html
Also check out TBXML:
TBXML is a light-weight XML document parser written in Objective-C designed for use on Apple iPad, iPhone & iPod Touch devices. TBXML aims to provide the fastest possible XML parsing whilst utilising the fewest resources. This requirement for absolute efficiency is achieved at the expense of XML validation and modification. It is not possible to modify and generate valid XML from a TBXML object and no validation is performed whatsoever whilst importing and parsing an XML document.
There is no simple way to do what you ask and Core Data won't make it any easier for you.
I assume you've read the docs - you need to determine a suitable model to represent your remote data locally, manage the interactions between the remote end and the local end, and synchronize the state between the ends. Deciding on and coordinating your synchronization process is the hardest part. I'm not sure whether there is any third-party framework that can automate this process.

Resources