I have a WSDL provided by a target system which has some schemas defined as inline on the 'wsdl:types' section, but one of the schema has same target namespace as the WSDL.
Target system also has provided me the associated schemas as .xsd. Now I want to remove the schemas from concrete WSDL and refer the .xsd provided but I am confused whether to use import or include.
I am using Tibco BW to invoke the servicr(XML based).please let me know if I should use import or include.
Related
Nutshell: The Entity Framework Provider for WCF Data Services pulls the schema namespace and EntityContainer name directly from the namespace and class name of the DbContext, respectively. This is also true for DbContexts that are developed using the code-first method.
Is there a way to modify this provider behavior a posteriori--that is, without modifying the class name or the EDM(X)?
Background/caveats/opinion: This is a handy behavior for prototyping, but in a production scenario, the class name is itself an implementation detail that should be hidden from service consumers.
Further, in my case the name cannot be changed, since I am using a framework that provides a very generic DbContext that I am then composing/extending.
Note that I am not discussing a way to create more "space" between the CLR and EDM representations of the data model. Rather, I'm looking for a way to modify the behavior of the DataService<T> extension itself, so that the internal CLR namespace and DbContext extension class name (preserved in the EDM, which is totally okay) aren't exposed externally.
The specific customization points in the service metadata (custom-ns and custom-container below):
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="<custom-ns>" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="EgEntity">
.
.
.
</EntityType>
.
.
.
<EntityContainer Name="<custom-container>" m:IsDefaultEntityContainer="true">
<EntitySet Name="EgEntity" EntityType="<custom-ns>.EgEntity" />
.
.
.
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
In code-first, you can specify the schema for tables in the SSDL with the Table annotation (look at the Schema property). Unfortunately, I don't think you can overwrite the schema namespaces used in the CSDL with either attributes or the model builder (please note that I haven't extensively researched this).
You may attempt to play with namespace aliases, although I'm not sure this would work as you intend.
In model-first and database-first, see this question which seems to answer yours. Let me know if it doesn't.
I realize this answer is not too helpful, but I would like to suggest that you specify proper namespaces for your codebase, even (especially) for production. This is because I can't immediately see why a namespace should be "hidden" in any normal scenario, but please do expand on your use-case if you disagree.
That being said, I agree that one should be able to map proper CLR namespaces to different EDM schemas for other reasons, I guess everybody is OK with using the same names as long as they make sense. By the way, don't forget vendor prefixes, especially since you're exposing these names to the network.
Note that the third-party framework namespace shouldn't be relevant as long as the context class is not sealed. Usually, entities are defined as POCOs so that's normally not a problem either. Thus, the standard solution would be to extend this generic context class in a namespace of your own, along with the entities.
What is the relationship between:
the import element in WSDL
-and-
the import element and in XML Schema
... and in particular the relationship between the location attribute of the former and the schemaLocation attribute of the latter?
Though I can use a catalog file (in a JAX-WS / wsimport toolchain) to "override" schemaLocation attributes for the xsd:import element it seems that I can't do the same for the location attributes of the wsdl:import statement.
In both cases, the import establishes a relationship between a document (be that WSDL or XSD) and an external resource).
Barring the confusion which surrounded the wsdl:import, specifically if it could be used to import XSDs or not (in the interoperable way it shouldn't), they're both meant to do the same thing for its own kind, i.e. bring in another WSDL's (in the WSDL case), or another XSD's (in the XSD case) definitions in scope, thus allowing a modular approach to authoring.
The attributes you're referring to are meant to be equivalent, in the same way an import in Java more or less matches a using in C#.
However, the specifics around each are different if you consider the WSDL 1.1 note: while in XSD the schemaLocation attribute is optional for xsd:import (since an import's location may be resolved through its namespace using other means allowed by the spec), the same was not built into the WSDL 1.1 note for the location attribute.
Also, the XSD spec is explicitly allowing for an override:
The ·actual value· of the schemaLocation, if present, gives a **hint** as to where a serialization of a ·schema document·...
If you look for the same in WSDL 2.0, you will notice that now WSDL supports an include in addition to the old import, basically following the same semantics relative to the namespace associated with the directive. More so, the use of the location attribute is also consistent to that in the XSD, which in return should foster a catalog-based approach to resolve the "dangling" imports.
To round it up, given the mandatory location attribute in WSDL 1.1, it didn't make sense to talk about catalogs or overrides since it was not implied or allowed by the note.
I have some quite big model, described in a number of xsd schemas. Schemas are referencing each other by includes. For example, A schema contains a 'someEnum' enumeration. B schema want to use that enum, so it include's the A schema. The problem is, when i import my XSD to eCore model's EMF are not only generates such an enum twice, but it aslo generates all the elements in B schema in model for A schema. I'm feeling that i'm doing something wrong, but can't figure out what exactly. Any help are very appreciated!
If you did select one xsd at a time in the EMF Project Wizard, then you should start with the xsd, that doesn't depend on anything. After the import of the first xsd finished, the EMF Project Explorer offers you to select referenced models during the import of the next xsd. Then you have to select the appropriate ones.
You are also able to import multiple xsds at once with the EMF Project Wizard. Then the references should be set correctly, if the namespaces of the xsds refer to each other.
Is it possible to have xsd.exe add "IsNullable=false" to XmlAttributes for fields/properties that are defined in the schema as being required?
Xjc adds it to the Java annotation, but I haven't found a way to get Xsd.exe to do something similar.
I'm trying to use reflection to do a merge of our configuration files that isn't configuration file type dependent. I want to use the required attributes of an element to determine if that element exists in both files or just one.
My requirement is that I have a very big schema and it has many different tags with different namespaces. I want to generate classes from that schema into different packages and I want this thing to be bases on namespace i.e. I want classes corresponding to tags in one namespace to be in one package and classes corresponding to tags in other namespace to be present in different name space.
I want an ant task to perform the above functionality
Actually, this is normal JAXB behaviour: XJC derives packages from namespace URIs (http://www.acme.com/foo -> com.acme.foo).
Here's a sample Ant "Purchase Order" project:
http://confluence.highsource.org/display/J2B/Downloads