I am looking for a programmatic solution to this, not asking about a tool.
Given a directory of XSD files with imports to other XSD files in that directory,
I would like to verify all required imports are present and the XSDs are valid XML.
My current manual process:
Open XML Spy
Start a new project
Add XSD files
'Validate XML' on all XSD files.
This gives error messages if there are issues or missing files.
How files are imported:
<xs:import schemaLocation="Other.xsd" namespace="Foo"/>
I'm looking for an automated way to achieve this, preferably without the overhead of XML Spy, so that this can be integrated in an automated test.
This is not about validation XML instances based on those XSD files, only about validating the XSD files and their dependencies.
It depends on the platform your are on, on .NET (with XSD 1.0) you have good support for checking schemas with XmlSchemaSet by loading/compiling them and checking for any warnings or errors, details are at https://learn.microsoft.com/en-us/dotnet/standard/data/xml/xmlschemaset-for-schema-compilation#compiling-schemas.
I think with Java there are different APIs but somehow similar functionality available.
Related
We are mantaining a java project that consumes a lot of different web services. Service definitions change regularly and new services are added very often. So we need to automate the generation of all the java clients.
We have a batch script that downloads(curl) all the needed wsdls and all the dependent schemas, then generates all the corresponding java clients(wsimport) and finally generates a jar that includes all the clients and all the wsdls and xsds which. We deploy this jar in our artifactory and we use it in our project. We need to include the wsdls and xsds in our jar to avoid jax-ws calls to the wsdls in execution.
The script has become a monster, because we use very different web services. Every wsdl, has it's own different schemas located in different urls, so we have to identify all the files that have to be downloaded and put the xsds in the correct path in the disk.
Our goal would be to have a script that, given a wsdl url list, downloads all the wsdls and dependent xsds in a folder so that we can execute wsimport against them.
SoapUI's "export definition" tool, exports the wsdld and the dependent schemas in a folder, and modifying the "ws:import" paths in the wsdl automaticaly. Is there any way to invoke this tool from command line?
Is there any other tool that would help us improving this process?
thanks in advance
I'm looking to find the 5.1.0 JasperReport XSD schema. I want to do some outside manipulation of the JRXML in a language other than Java.
The current publicly available XSD at http://jasperreports.sourceforge.net/xsd/jasperreport.xsd currently does not validate against my current 5.1.0 JRXML.
Anyone with guidance would be helpful. I also tried downloading the project files at sourceforge, and searching for any .XSD files, with none found.
I'm converting a XML from one XSD to another by using BizTalk maps. I have "schemalocation" import in one XSD just like below
<xs:import schemaLocation=".\CurrencySchema.xsd" namespace="http://Biztalk.CurrencySchema" />
I built this solution which includes two schemas and one BizTalk map. After I GACed it, İ have added the DLL to BizTalk assembly. There is no problem on this side.
The problem is beginning when I sent the XML to BizTalk for converting. While validation of this XML BizTalk gets error just like below.
System.Xml.Schema.XmlSchemaValidationException: Type 'http://Biztalk.CurrencySchema:curType' is not declared.
I checked the BizTalk schemas and maps from BizTalk application. Two schemas and one map uploaded correctly to BizTalk administration console.
I think BizTalk doesn't import the referenced XSD on validation process. I don't understand why.
Can someone tell me what is wrong?
Probably is a straight-forward question: do you know any tools for combining multiple wsdl + xsd files into a single wsdl?
Thank you.
Edit1:
The service is a WCF service, and I want to have a single wsdl for PHP (as client).
Edit2:
Too bad I need to use .Net 4.0 and not 4.5 where this would be possible. Maybe I could borrow then one of the new MS tools? Do you know which one? Is the svcutil.exe the responsible tool? If yes, what are his dependencies? Because I don't want to jump to .Net 4.5 just yet.
You can build a small application that can generate a flat wsdl. We do generate flat wsdl programatically in C# for building interoperable WCF services. Refer to the link on how to generate flat wsdl.
Hopefully seeing the code you can build a tool that does it for you.
Else you can manually do it using Altova Xml Spy and replacing the xsd import attributes by the xsd schema definition.
For sure, I can recommend a tool that can combine multiple XSD files into the minimum set possible (I am biased here, since I wrote it). This in itself can be a heavy task, if you have a large number of files, many namespaces, or both. The things might get trickier for multiple WSDLs into one, depending on some parameters you may have configure; for example, is it logically one WSDL authored over three layers that maintains separation of messages - portTypes - services, or multiple WSDLs, period? One thing you must ensure is that all share the same types subsystem, there's no conflict for operations, etc. But even this is a task that could be achieved, I could easily put an addon out... If this is refactoring of XML Schemas and WSDLs you see doing often, let me know.
We wanted one wsdl file to make use of some tools to automatically generate soap proxy on PHP side. But we ended up writing the DTO layer manually.
If you have wcf service in .NET 4.5 you can get easily only one wsdl file (inbuilt feature of WCF framework).
Can I have multiple log4net configurations for the same program? Functionality similar to Spring's <import> element would be optimal. The idea here would to have multiple programs that have their own log4net configuration, as well as sharing a central log4net configuration file containing a shared error log (so that definition isn't repeated). Alternatively is this functionality possible with .NET Common Logging?
Related: log4net - configure using multiple configuration files
you can achieve this by using named repositories i think
log4net.LogManager.CreateRepository(repositoryName)
log4net.Config.XmlConfigurator.Configure(repositoryName, configFile)
then by using
LogManager.GetLogger(repositoryName,loggerName)
you can get the corresponding logger.
Not out-of-the-box. You must implement yourself the merging of different config files into a single XmlNode and pass this to log4net XmlConfiguratot.
An example is to be found here: http://www.kopf.com.br/kaplof/using-multiple-configuration-files-with-log4net