wsdl objects are repeated when I add webservice reference - web-services

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), _

Related

Can JS-DOM test code that uses Tailwind's peer / peer-invalid mechanism?

Tailwind offers a feature where you can give an input element the peer class and then, in a sibling element use the peer-invalid: pseudoclass to apply conditional stylings. This is commonly used to provide helper text when a form field is not valid.
I don't see how this can be tested in JS-DOM though, as JS-DOM doesn't have access to the actual CSS when it is just rendering components in unit tests.
The information I have seen about getting JS-DOM to use CSS at all is kinda sketchy, so I was wondering if it's even worth trying to get it to evaluate a bunch of tailwind classes in a NextJS/Jest/RTL project. I'm using Tailwind 3 so it's not even like I have a big file full of generated classes I could try and pass to JS-DOM :/
So can it be done? (Note the hard fact please mods!!!)
(And, somewhat more subjectively, should it be done? Or is there a better way to approach this?)

JAX/WS wsgen is not generating

I have a problem like this ; Could you please help me if you know the reason?
I m trying to generate jaxb classes for input and out types using wsgen command line utility.
The print screen you posted (and #home's comment is spot on - you should add the stacktrace not a print screen) tells you the problem.
#javax.jws.WebService annotated classes that do not belong to a package must have the #javax.jws.WebService.targetNamespace element.
You don't specify a target namespace and wsgen can't infer one because you classes are in the default package. Having classes in the default package is a frown upon practice. Put your classes under a package and try again or have the WebService.targetNamespace element set up which also gives you more control on what the tool generates.
#javax.jws.WebService the annotated classe who implements Web Service Business interface, must have a no-argument constructor otherwise wsGen tool gets such error.
Reference: Creating a Simple Web Service and Client with JAX-WS

Can a Custom DataProvider class expose Custom Templates?

I am currently in the process of writing a custom DataProvider. Using the Intergrate External Data documentation.
I've managed to show the external data in the Sitecore back end. However whenever I try to view the data in the items I created, I am getting an error
Null ids are not allowed. <br> Parameter name: displayName
There seems to be precious little on the subject on how to create a custom DataProvider on the Sitecore Developer Network.
The example on their website seems to only show how to import a SINGLE item into a static database. However I am simply trying to merge some items into the hierarchy and I can't find any useful documentation.
It seems that one of your methods that should return an ID doesn't. It might be GetChildIds and/or GetParentId.
Nick Wesselman wrote a good article about it gathering all the information including an example on the Marketplace. I think that is your best start. You can read it here.
Turns out I needed to include at the very least, the Fields->Section->Template in the GetParent method. To be on the safe side I included the Fields/Sections/Templates into my implementations of
GetChildIDs
GetItemDefinition
GetParentID
It wasn't obvious that this was the case, since I had in fact implemented the GetTemplates method correctly, and I had expected that should be enough.

Accessing 't' (from r18n) in a rack-unit test of a Sinatra app

When using sinatra-r18n to handle internationalisation, the r18n lib exposes a variable t for use within your helpers, routes and templates, as per these instructions.
I have written a simple unit test using rack-unit to confirm that some of my pluralisations work but the test throws an error claiming t is nil.
I've tried referencing it via app.t, MySillyApp.t (where MySillyApp is the name of my Sinatra app), MySillyApp.settings.t etc and none of them give me access to the t I need.
What I am trying to achieve is a confirmation that my translation files include all the keys I need corresponding to plurals of various metric units my app needs to understand. Perhaps there is a more direct way of testing this without going via the Sinatra app itself. I'd welcome any insight here.
I had similar task to check localized strings in my Cucumber scenarios.
I've made working example.
Here you can find how strings got translated.
This file halps to understand how to add R18n support to your testing framework:
require 'r18n-core'
...
class SinCucR18nWorld
...
include R18n::Helpers
end
As you can see instead of rack/unit I'm using RSpec/Cucumber, sorry.

Is it possible to exclude Entity Framework Autogenerated Code from Code Coverage Statistics?

I have seen the [DebuggerNonUserCode] and [ExcludeFromCodeCoverage] attributes in resources and other SO questions about exlcuding code from coverage statistics, and wanted to know if it was possible to automatically add this attribute to the classes in the code generated by the Entity Framework using .NET 4.0.
Also would it need to be class level or could it be on the diagram.Designer.cs level, needing one attribute for all code generated by that diagram?
Since partial classes (which Entity Framework creates) merge attributes, extended functionality in other partial classes are also excluded if the attribute is class level in the template, it will have to be applied at the method level.
The best way that I've found to do this is using T4 (as recommended in #Craig Stuntz's answer) to:
include: using System.Diagnostics.CodeAnalysis; at the top of the file
Then apply [ExcludeFromCodeCoverage] to getters, setters and Factory methods by searching for:
#>get
#>set
Template_FactoryMethodComment
and placing them in the appropriate place.
This was made a lot easier using Tangible's T4 editor Extension for VS.
This is my first attempt and it seems to work, "your milage may vary", so complete a test run to make sure everything's working as necessary.