meaning is there a difference between
<WebService(Namespace:="http://theurl.com/")>
and
<WebService(Namespace:="http://www.theurl.com/")>
?
Don't know if you're asking one of two things so I'll mention both.
1. What's the namespace for?
The reasons all derive from the W3C standards.
Very short answer: If you're doing some simple ASP.NET web services, all connecting through .NET you'll probably never know any difference. In fact, a lot of web services I've seen I see are still using tempuri.org ;-) Shame. If you're doing interop or are publishing a number of web services, a proper namespace guarantees uniqueness for similarly named services.
2. Does the subdomain matter?
Yes, different subdomain, therefore, while semantically equivalent, they're different namespaces. A namespace can look like a Url, but it's not. You could just as easily use something like "urn:org.tempuri" as a valid namespace.
This indicates the XML Namespace of the web service, and has nothing to with an actual address.
So yes, the namespaces mentioned are different. Just as the System.Data and the System namespaces in C# are different namespaces.
Does it matter which one you choose when creating the service? No, just pick one...
Does it matter which one you choose when consuming the service? Yes, use the one that the creator picked. (Which is described in the WSDL)
Short answer: No.
Long answer: Maybe.
If you are going to use the SOAP protocol yourself. The name space of the XML return might be required to be "www.*" in the code (a security "feature").
If you can type both into a browser and they work, then there's no difference. A lot of it depends on how the site is set up at the host. The option for the non "www" URL is simply a DNS entry.
Related
I have a web service and a client. The classes used in parameters and return types are in a common DLL shared by both. However, whenever I update the web reference, visual studio generates copies of the classes with the same names and public properties and methods. Then the solution won't compile because the client code tries to use the versions in the common DLL. I can solve the problem by deleting the "duplicate" classes every time I update the web reference, and adding a using statement to point at the common dll's namespace. Is there a way to fix this permanently?
UPDATE: See my comments below. This is a "feature" of asmx web services. There is no way around it other than one of the following:
1) Use a more modern type of web service.
2) Don't use a common DLL
3) Manually fix every time you update the web reference, as in the original question above.
This is a "feature" of asmx web services. There is no way around it other than one of the
following:
Use a more modern type of web service.
Don't use a common DLL
Manually fix every time you update the web reference, as in the original question above.
Sources: Other stackoverflow questions:
"Reuse existing types" is ignored when adding a service reference
How does Visual Studio 2008 and svcutil decide which types to re-use from referenced assemblies when generating a web service proxy class?
I had the same problem, but I had neglected to add the reference the correct assembly with the request/response types in my client. Once I added that reference, and ensured that the "Reuse types" checkbox was on in the Add Service Reference dialog, it worked properly.
There`s no way to do that.
However, I think we have a design problem here. When we create a web service, we expect that our clients don't need to reference any dll from us. Only the types exposed by the web service should be enough for their use (web services are all about interoperability, imagine your client app written in Java, you can't reference the .NET dll).
That's why these types are created when you reference a web service. In my opinion, you should only rely on the classes generated by the web service in your client app. Remove the reference to the shared dll from the client project.
This doesn't direct answer your question, but provides an alternative for your issue.
In the domain class, set AnonymousType=false to prevent generating class with prefix unexpected when adding the web reference
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = false)]
but this only ensure that the class, auto-gen in Reference.cs has the same structure as the domain class.
A way to walk aroud this is to serialize/deserialize to the domain object.
Disclaimer:
This is the first time I am asking a question that might be classified as subjective. As English is not my first language, it is hard to phrase this right. So please feel free to edit the question in order to make it clearer, or to point me at other ways for asking this.
Intro:
David Ebbo (architect on the ASP.NET team) just posted on Register your HTTP modules at runtime without config using the seemingly undocumented PreApplicationStartMethod assembly level attribute
I have mixed feelings about it.
On the one hand it is good to be able to do things as early in the application startup phase as possible.
On the other hand: Does it suffice? Do we need a PrePreApplicationStartMethod allowing to fiddle with the PreApplicationStartMethod behaviour? What about expansion to non-assembly use (for instance, NuGet already works around the single-use-per-assembly restriction of PreApplicationStartMethod)?
Question: Besides using it for config-less startup, what do you think of the PreApplicationStartMethod attribute?
I think one of the good usages for this is that it allows someone who is writing a 3rd party assembly, or a team that is working on an assembly that will be used in many projects, to be able to use this attribute to initialize stuff w/o requiring the end user/developer to create anything in the global.asax in the application startup events.
There are lots of app specific stuff that people like to/need to configure in global.asax, but if you are creating a DLL, you no longer have to make the user configure your classes in the global.asax, you can just put all your logic in your own init/bootstrap function and rely on asp.net to call your init logic when the app starts.
Sir/Madam,
I want to know where WSDL exists. Do user need to do interact with it for any kind of scenario during programing?
WSDL (Web Services Description Language) is an XML-based language for describing Web services and how to access them.
Web Services Description Language
With respect, this is a bad question. You're in effect asking us to do your research for you. When I say "bad" what I mean here is that you're in danger of harming yourself by asking questions like this. If instead you do some preliminary research, for example by googling WSDL, and find resources such as this then you expose yourself to the "Encyclopedia Effect", you encounter other related (or indeed unrelated information) and you learn more. When you research and come across something you don't understand then you can ask specific questions in places like this, and you have a context to understand the answers. I truly believe that researching in the way I describe will be most helpful to you in the long term.
To give one answer to your questions: you will find examples of useful WSDLs here.
As a programmer you can develop service clients from those WSDLs, or more usually use code generators to write the "boilerplate" code for you.
If you want to provide your own services then you may write WSDLs your self.
WSDL stands for Web Service Description Language, it uses XML to define functions that a web service exposes and the types that these functions receive as arguments and return.
http://en.wikipedia.org/wiki/WSDL
You can usually access the WSDL for a web service using a query string (in .NET web services at least). A developer usually won't look at the WSDL as it will be generated by a tool like Visual Studio or soapsuds and code will be generated to represent the types based on the definition in the WSDL that the developer will make use of instead. Changes to the WSDL will result in regeneration of this code.
What are the benefits of Spring Actionscript considering Dynamic Proxies are not possible in the current version of Actionscript and Reflection is quite limited.
So for example I could specify my object creation in an XML application context, but why would I do that when I can simply specify that in code, and hence take advantage of static type checking etc.
It is by no means my intent to belittle the work done on Spring Actionscript but more to find an application for it in my projects.
Besides XML configuration, Spring ActionScript also supports MXML configuration. The type of config (XML, MXML) depends on the use cases your application needs to support. For the reasons you mention, it makes perfect sense to configure most of the context in MXML, but I would encourage you to externalize the config of service endpoints in every case.
In a past project we opted for XML config since the configuration was generated at runtime when a user logged on to the application. Depending on the user credentials, different endpoints and various different settings were used. We could not have done this elegantly with static MXML configs.
Both config types have their strengths and weaknesses, and it's up to you to decide what type you want to use. I think we could even support a mixture of MXML and XML quite easily actually if that would make sense. As soon as we have Dynamic Proxies and class loading, XML config will make a lot more sense.
I would agree with Sean in the general sense that trying to force Flex inside of the Java box is generally a bad idea. As many similarities as there are, Flex is not Java.
That being said, there are plenty of reasons why you might want to have some of your configuration in an external XML file, not the least of which is in the use case of configuring your service destinations and endpoints, where you may have a need to be able to change the endpoint URI without having to recompile your application.
There are several projects available that are simply misguided ports of philosophies from other platforms. Whenever starting in on a new platform, I think the best thing to do is figure out how people are effectively developing and go from there.
I say all of that because I think all of the java-esque frameworks for flex/flash leave you worse off than you started. You do need dependency injection, but there are good as3/mxml-friendly frameworks for that (Mate, Swiz). There is absolutely no point in using xml when you can use mxml, which is strongly typed.
With NInject (preferably 2.0), what options do we have wrt wiring up our object dependencies in a web application?
Can they be defined in an XML configuration file?
Or does it have to be done via code?
There is an extension for xml based configuration: https://github.com/ninject/ninject.extensions.xml
You can do a lot more powerful binding in code though.
Ninject doesn't have XML configuration, sorry but I can't provide a direct link (cos their site has flash elements), but here is a quotation from ninject.org:
Free yourself from XML
Most other .NET dependency injection
frameworks are designed around the use
of XML to declare type bindings.
Rather than forcing you to write
cumbersome and error-prone text,
Ninject arms you with a fluent
interface, which lets you connect the
pieces of your application using
full-fledged code. This means you can
take advantage of the features of the
IDE and compiler, like code completion
and type-safety.
The problem I see with defining bindings in the code only is that you have to add reference to the dll.
You cannot change the binding without adding reference to new dll (removing reference to old one), change code and recompile.
If we had xml config I wouldn't need reference at all, and wouldn't have to recompile.
Right now I have MVC app that is using DI to pass repositories to Controllers. Nothing else then Ninject code for adding bindings uses the concrete implementations of repositories. And still I need to add reference to dll containing the implementations. For only one line of code!
Or maybe there is a possibility to achieve this using Ninject?
What are you looking to achieve? What sort of stuff are you looking to configure? Dynamically selecting a Strategy ? Passing in Port numbers? You could offer a lot more information as to what you're thinking in order to get a better answer [that you can acccept :P].
You need to split the concerns of:
known object wiring (DI)
configuration - generally you'll want to split those into small focused subsets e.g. Strongly Typed config elements vs having a global pool of settings in a big pile mishmashed together a la appSettings
plugins / unknown object wiring (MEF?)
In the first pool, doing it in Code is just the right way and I cant think of any advantage XML would give, esp. in the context of strong names etc.