I have defined some prefixes-to-NS mapping in my package-info.java and my response is dynamic i.e. it may or may not contain certain elements corresponding to some of the NS defined.
I have observed that when my response is tiny, even then also Metro is adding all the namespaces in the root tag.
Is there a way to tell JAXB to not add those unnecessary namespaces in the response when there is no element, belonging to those namespaces, is present?
I'm using JDK 1.8 and WS implementation of version 2.3 in Metro.
Thanks!
Related
Creating in-repo-addon in Ember.JS gives a lot of possibilities. Today I've stumbled into a case when I wanted to register all classes in directory (for example my-dir) into Dependency Injector (same way it's done with services by Ember, but I wanted to use some other namespace).
For example I want to allow developer to create multiple classes inside proxy directory, and register all of them in DI under proxy: namespace. So later we can use:
Ember.Component.extend({
myProxy: Ember.inject('proxy:my'),
});
You'll need to do this using an initializer. More details on this here: https://guides.emberjs.com/v2.12.0/applications/dependency-injection/
The hard part may be getting all proxy items in s folder to automatically register ...
Edit
Looks like I didn't spend enough time thinking about this. You should be able to do at least part of this easily. There are two parts to this.
Part 1
Ember currently uses the ember-resolver to handle lookups for various items. If you check the tests for the resolver you'll notice that you should be able to map in anything you want: https://github.com/ember-cli/ember-resolver/blob/master/tests/unit/resolvers/classic/basic-test.js
So in your case, if you do a Ember.getOwner(this).lookup('proxy:main') from within an Ember instantiated class (a route, controller or component for instance) it would look in app/proxy/main.js which your addon could be populating.
Details on the Ember.getOwner lookup are available here: https://emberjs.com/api/classes/Ember.html#method_getOwner
Part 2
So at this point you can lookup proxies (which would be doable in an init method). But if we want to get truly elegant we'd want to allow Ember.inject.proxy('main') syntax.
Doing so would involve calling a private method inside of Ember.inject in an initializer. Because that naming scheme is changing in the new Javascript modules RFC, it may be unwise to try to add this syntactic sugar ...
So I'd advise avoiding touching that private API unless it's really important to your app design.
I'm kinda new to SOAP.
In my WSDL, I've got a message element composed of several part elements. In the binding part of my WSDL, if the soap:body element does not include any parts attribute, I get the WS-I Basic Profile compliance error BP2119:
A document-literal binding which does not specify the parts attribute, has more than one wsdl:part in the associated wsdl:message element.
I read in some docs that if no parts attribute is specified, it is considered that all part elements are included in the binding, but I'm guessing this assertion does not take into account the Basic Profile compliance. I therefore added a parts attribute with all the message's parts:
<soap:body parts="cpName fpList" use="literal"/>
But then, I'm getting the BP2111 error:
One or more soapbind:body element(s) in a document-literal soap:binding does not have at most one part listed in the parts attribute.
So, I have to specify the parts, but I can put only one? Aren't these two errors contradictory? How do I get away with that?
Alternatively, do I have to be Basic Profile-compliant? If not, how do I deactivate these checks in axis2?
I found some answers here: http://www.ibm.com/developerworks/library/ws-usagewsdl/
In bulk, document-literal wrapped pattern doesn't authorize several parts for one message. A message has to be composed of only one part, whose type will be an XS element who itself can be composed of multiple elements.
In Rails 4 (which supports multilingual inflections), I can set:
config.i18n.default_locale = :es
in my config/application.rb, which allows me to do stuff like this in the console:
'general'.pluralize(:es) => "generales"
But when I run:
rails g model General conciencia:string atencion:string
Rails generates files with 'general' pluralized as 'generals' which in spanish should be 'generales'
Shouldn't Rails be using the multilingual inflector for its generators if the locale is set? Is there a way to force it to use them?
Thanks!
A bit late, but for the record: There's an argument in a Rails issue about why is it this way (so it's no a bug, but you can discuss it about):
Source: https://github.com/rails/rails/issues/10125#issuecomment-17274499
Up to Rails 4, the inflector had no support for multiple locales.
There was only one set of rules. The application has a default locale,
and in a i18n application each request may have a different locale,
but that didn't affect the inflector.
The inflector is not only used by the application, it is also used by
the framework to convert paths to class names, class names to tables,
create method names dynamically for the associations API, etc.
Obviously, those computations cannot vary. If your schema has a
"regions" table, Active Record has to map the Region class always to
the "regions" table, no matter the evolution of the application
(unless the schema changes, but the schema has to be visualized as
mostly static regarding to this, much more static that a configuration
option).
I have worked on applications that started development using :en, get
i18ned, and then switch to a default locale of :es. The locale is
something that affects the interface in that mindset. Everything
internal should work as it did before.
You should be able to change the default locale and everything else in
a way that does not affect static things like association names,
tables, routes, etc.
In could be the case that you have i18n routes (which change with the
locale of the request), but in general the statement above should be
true.
In order to be as backwards compatible as possible, we have left the
framework untouched, and have made the inflections to have a default
of :en so that existing applications get the same mappings after an
upgrade.
when I add webservice reference (not a service reference), I am getting same element with renamed added suffix as 1 as shown in the image. this causes an error when I try to debug. Inner exception says
Message=Types 'service.AddressType1' and 'service.AddressType' both use the XML type name, 'AddressType', from namespace 'xxx'. Use XML attributes to specify a unique XML name and/or namespace for the type.
I understand the error and I already saw some different threads here those tell me that I should specify different namespace but I don't have AddressType1 defined anywhere in my proxy classes. I have only AddressType. where from do I get that AddressType1 or others?
Anyone else got that error? thanks for your help.
Have you looked at this answer? Inheriting Existing .Net Class Serialization Error
This answer also discusses issues with hierarchical namespacing (seems you may be doing that), so that may be your main issue: Classes in different sub-namespaces all appear at top level in WSDL
It appears that you may need to specify the XmlTypeAttribute. Can you provide your code sample for review?
I was having inherited proxy classes which I generated using xsd2code tool. Problem was that this tool generated namespaces correctly for the parent xsd classes but when I check the class in the child which is shared/common by other parent classes, It appears that namespace field was empty as below. Therefore my service reference had same properties/classes more than one time with 1 suffix as shown in the question. I have just added same namespace for those child/inherited classes, It worked fine and no repeated properties. I hope that this helps to someone else having similar problem.
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=True), _
This page lists the following examples:
Addition of new WSDL operations to an existing WSDL document
Addition of new XML schema types within a WSDL document that are not contained within previously existing types
But is there a definition or standard
guideline for what changes are considered backwards-compatible. Or in other words, what changes can you make to your contract, and still expect not to break your clients.
I have spent some time on this particular subject, and found some guidelines in a book by Thomas Erl which I refer to at the bottom. Here is what they have to say;
Compatible Changes
adding a new WSDL operation definition and associated message definitions
adding a new WSDL port type definition and associated operation definitions
adding new WSDL binding and service definitions
adding a new optional XML Schema element or attribute declaration to a message definition
reducing the constraint granularity of an XML Schema element or attribute of a message definition type
adding a new XML Schema wildcard to a message definition type
adding a new optional WS-Policy assertion
adding a new WS-Policy alternative
Incompatible Changes
renaming an existing WSDL operation definition
removing an existing WSDL operation definition
changing the MEP of an existing WSDL operation definition
adding a fault message to an existing WSDL operation definition
adding a new required XML Schema element or attribute declaration to a message
definition
increasing the constraint granularity of an XML Schema element or attribute declaration
of a message definition
renaming an optional or required XML Schema element or attribute in a message
definition
removing an optional or required XML Schema element or attribute or wildcard
from a message definition
adding a new required WS-Policy assertion or expression
adding a new ignorable WS-Policy expression (most of the time)
There is a great book on this particular subject from Thomas Erl et al; The name is Web Service Contract Design & Versioning for SOA.
HTH.
Disclaimer: As I've mentioned, this is work done by the authors of the book and I'm merely sharing it. I'm also not affiliated in anyway; just liked the book :)
Additional optional request elements (minoccurs=0) could also be backward compatible - this depends on the implementation of the service on the host side.
Also, changing a mandatory response element to optional could also be backward compatible - it depends on the implementation of your client.
This area is tricky.
If you are really worried about backward compatibility consider creating a new version of the service for new clients and keep the existing implementation for existing clients. Also, in general, avoid sending domain objects over your services - use DTOs.
Hope this helps.