Search Results

Search found 1221 results on 49 pages for 'contract'.

Page 5/49 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Can a WCF contract use multiple callback interfaces?

    - by mafutrct
    I'm trying something like this: [ServiceContract ( CallbackContract = typeof (CallbackContract_1), CallbackContract = typeof (CallbackContract_2), CallbackContract = typeof (CallbackContract_3)) ] public interface SomeWcfContract { I know it does not work like this. Is there still a way to get a single contract use multiple callback interfaces?

    Read the article

  • Why do I get a AssociationTypeMismatch when creating my model object?

    - by Maxm007
    Hi I get the following error: ActiveRecord::AssociationTypeMismatch in ContractsController#create ExchangeRate(#2183081860) expected, got HashWithIndifferentAccess(#2159586480) Params: {"commit"=>"Create", "authenticity_token"=>"g2/Vm2pTcDGk6uRas+aTgpiQiGDY8lsc3UoL8iE+7+E=", "contract"=>{"side"=>"BUY", "currency_id"=>"488525179", "amount"=>"1000", "user_id"=>"633107804", "exchange_rate"=>{"rate"=>"1.7"}}} My relevant model is : class Contract < ActiveRecord::Base belongs_to :currency belongs_to :user has_one :exchange_rate has_many :trades accepts_nested_attributes_for :exchange_rate end class ExchangeRate < ActiveRecord::Base belongs_to :denccy, :class_name=>"Currency" belongs_to :numccy, :class_name=>"Currency" belongs_to :contract end My view is: <% form_for @contract do |contractForm| %> Username: <%= contractForm.collection_select(:user_id, User.all, :id, :username) %> <br> B/S: <%= contractForm.select(:side,options_for_select([['BUY', 'BUY'], ['SELL', 'SELL']], 'BUY')) %> <br> Currency: <%= contractForm.collection_select(:currency_id, Currency.all, :id, :ccy) %> <br> <br> Amount: <%= contractForm.text_field :amount %> <br> <% contractForm.fields_for @contract.exchange_rate do |rateForm|%> Rate: <%= rateForm.text_field :rate %> <br> <% end %> <%= submit_tag :Create %> <% end %> My View Controller: class ContractsController < ApplicationController def new @contract = Contract.new @contract.build_exchange_rate respond_to do |format| format.html # new.html.erb format.xml { render :xml => @contract } end end def create @contract = Contract.new(params[:contract]) respond_to do |format| if @contract.save flash[:notice] = 'Contract was successfully created.' format.html { redirect_to(@contract) } format.xml { render :xml => @contract, :status => :created, :location => @contract } else format.html { render :action => "new" } format.xml { render :xml => @contract.errors, :status => :unprocessable_entity } end end end I'm not sure why it's not recognizing the exchange rate attributes? Thank you

    Read the article

  • Spring Design By Contract: where to start?

    - by Build Monkey
    I am trying to put a "Contract" on a method call. My web application is in Spring 3. Is writing customs Annotations the right way to go. If so, any pointers( I didn't find anything in spring reference docs). Should I use tools like "Modern Jass", JML ...? Again any pointers will be useful. Thanks

    Read the article

  • Full Time Employee versus Contract Work?

    - by Elijah Manor
    What types of programmers tend to be attracted to full-time positions and what types are drawn to contract positions? Which type are you, and have you swapped between one to another? Does there come a time in a programmer's life when he/she typically switches from one to another? Do you find one more challenging than the other?

    Read the article

  • ReSharper - Possible Null Assignment when using Microsoft.Contracts

    - by HVS
    Is there any way to indicate to ReSharper that a null reference won't occur because of Design-by-Contract Requires checking? For example, the following code will raise the warning (Possible 'null' assignment to entity marked with 'NotNull' attribute) in ReSharper on lines 7 and 8: private Dictionary<string, string> _Lookup = new Dictionary<string, string>(); public void Foo(string s) { Contract.Requires(!String.IsNullOrEmpty(s)); if (_Lookup.ContainsKey(s)) _Lookup.Remove(s); } What is really odd is that if you remove the Contract.Requires(...) line, the ReSharper message goes away. Update I found the solution through ExternalAnnotations which was also mentioned by Mike below. Here's an example of how to do it for a function in Microsoft.Contracts: Create a directory called Microsoft.Contracts under the ExternalAnnotations ReSharper directory. Next, Create a file called Microsoft.Contracts.xml and populate like so: <assembly name="Microsoft.Contracts"> <member name="M:System.Diagnostics.Contracts.Contract.Requires(System.Boolean)"> <attribute ctor="M:JetBrains.Annotations.AssertionMethodAttribute.#ctor"/> <parameter name="condition"> <attribute ctor="M:JetBrains.Annotations.AssertionConditionAttribute.#ctor(JetBrains.Annotations.AssertionConditionType)"> <argument>0</argument> </attribute> </parameter> </member> </assembly> Restart Visual Studio, and the message goes away!

    Read the article

  • Code Contracts: Do we have to specify Contract.Requires(...) statements redundantly in delegating me

    - by herzmeister der welten
    I'm intending to use the new .NET 4 Code Contracts feature for future development. This made me wonder if we have to specify equivalent Contract.Requires(...) statements redundantly in a chain of methods. I think a code example is worth a thousand words: public bool CrushGodzilla(string weapon, int velocity) { Contract.Requires(weapon != null); // long code return false; } public bool CrushGodzilla(string weapon) { Contract.Requires(weapon != null); // specify contract requirement here // as well??? return this.CrushGodzilla(weapon, int.MaxValue); } For runtime checking it doesn't matter much, as we will eventually always hit the requirement check, and we will get an error if it fails. However, is it considered bad practice when we don't specify the contract requirement here in the second overload again? Also, there will be the feature of compile time checking, and possibly also design time checking of code contracts. It seems it's not yet available for C# in Visual Studio 2010, but I think there are some languages like Spec# that already do. These engines will probably give us hints when we write code to call such a method and our argument currently can or will be null. So I wonder if these engines will always analyze a call stack until they find a method with a contract that is currently not satisfied? Furthermore, here I learned about the difference between Contract.Requires(...) and Contract.Assume(...). I suppose that difference is also to consider in the context of this question then?

    Read the article

  • Multiple WCF Services implementing same Service Contract interface

    - by andrewczwu
    Is it possible for multiple wcf services to implement the same service contract interface? What I want to do is allow for a test service to be interchangeable for the real service, and to specify which service to be used in the configuration file. For example: [ServiceContract] public interface IUselessService { [OperationContract] string GetData(int value); } Test implementation public class TestService : IUselessService { public string GetData(int value) { return "This is a test"; } } Real class public class RealService : IUselessService { public string GetData(int value) { return string.Format("You entered: {0}", value); } }

    Read the article

  • Iterator performance contract (and use on non-collections)

    - by polygenelubricants
    If all that you're doing is a simple one-pass iteration (i.e. only hasNext() and next(), no remove()), are you guaranteed linear time performance and/or amortized constant cost per operation? Is this specified in the Iterator contract anywhere? Are there data structures/Java Collection which cannot be iterated in linear time? java.util.Scanner implements Iterator<String>. A Scanner is hardly a data structure (e.g. remove() makes absolutely no sense). Is this considered a design blunder? Is something like PrimeGenerator implements Iterator<Integer> considered bad design, or is this exactly what Iterator is for? (hasNext() always returns true, next() computes the next number on demand, remove() makes no sense). Similarly, would it have made sense for java.util.Random implements Iterator<Double>? Should a type really implement Iterator if it's effectively only using one-third of its API? (i.e. no remove(), always hasNext())

    Read the article

  • Comparable and Comparator contract with regards to null

    - by polygenelubricants
    Comparable contract specifies that e.compareTo(null) must throw NullPointerException. From the API: Note that null is not an instance of any class, and e.compareTo(null) should throw a NullPointerException even though e.equals(null) returns false. On the other hand, Comparator API mentions nothing about what needs to happen when comparing null. Consider the following attempt of a generic method that takes a Comparable, and return a Comparator for it that puts null as the minimum element. static <T extends Comparable<? super T>> Comparator<T> nullComparableComparator() { return new Comparator<T>() { @Override public int compare(T el1, T el2) { return el1 == null ? -1 : el2 == null ? +1 : el1.compareTo(el2); } }; } This allows us to do the following: List<Integer> numbers = new ArrayList<Integer>( Arrays.asList(3, 2, 1, null, null, 0) ); Comparator<Integer> numbersComp = nullComparableComparator(); Collections.sort(numbers, numbersComp); System.out.println(numbers); // "[null, null, 0, 1, 2, 3]" List<String> names = new ArrayList<String>( Arrays.asList("Bob", null, "Alice", "Carol") ); Comparator<String> namesComp = nullComparableComparator(); Collections.sort(names, namesComp); System.out.println(names); // "[null, Alice, Bob, Carol]" So the questions are: Is this an acceptable use of a Comparator, or is it violating an unwritten rule regarding comparing null and throwing NullPointerException? Is it ever a good idea to even have to sort a List containing null elements, or is that a sure sign of a design error?

    Read the article

  • JQuery Deferred - Adding to the Deferred contract

    - by MgSam
    I'm trying to add another asynchronous call to the contract of an existing Deferred before its state is set to success. Rather than try and explain this in English, see the following pseudo-code: $.when( $.ajax({ url: someUrl, data: data, async: true, success: function (data, textStatus, jqXhr) { console.log('Call 1 done.') jqXhr.pipe( $.ajax({ url: someUrl, data: data, async: true, success: function (data, textStatus, jqXhr) { console.log('Call 2 done.'); }, }) ); }, }), $.ajax({ url: someUrl, data: data, async: true, success: function (data, textStatus, jqXhr) { console.log('Call 3 done.'); }, }) ).then(function(){ console.log('All done!'); }); Basically, Call 2 is dependent on the results of Call 1. I want Call 1 and Call 3 to be executed in parallel. Once all 3 calls are complete, I want the All Done code to execute. My understanding is that Deferred.pipe() is supposed to chain another asynchronous call to the given deferred, but in practice, I always get Call 2 completing after All Done. Does anyone know how to get jQuery's Deferred to do what I want? Hopefully the solution doesn't involve ripping the code apart into chunks any further. Thanks for any help.

    Read the article

  • WCF - Contract Name could not be found in the list of contracts

    - by user208662
    Hello, I am relatively new to WCF. However, I need to create a service that exposes data to both Silverlight and AJAX client applications. In an attempt to accomplish this, I have created the following service to serve as a proof of concept: [ServiceContract(Namespace="urn:MyCompany.MyProject.Services")] public interface IJsonService { [OperationContract] [WebInvoke(Method = "GET", RequestFormat=WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] List<String> JsonFindNames(); } [ServiceContract(Namespace="urn:MyCompany.MyProject.Services")] public interface IWsService { [OperationContract(Name="FindNames")] List<String> WsFindNames(); } [ServiceBehavior(Name="myService", Namespace="urn:MyCompany.MyProject.Services")] public class myService : IJsonService, IWsService { public List<String> JsonFindNames() { return FindNames(); } public List<String> WsFindNames() { return FindNames(name); } public List<string> FindNames() { List<string> names = List<string>(); names.Add("Alan"); names.Add("Bill"); return results; } } When I try to access this service, I receive the following error: The contract name 'myService' could not be found in the list of contracts implemented by the service 'myService'. What is the cause of this? How do I fix this? Thank you

    Read the article

  • amount of data returned by wcf 3.0 service contract method causes error

    - by ferrell carr
    CommuncationException was unhandled The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. here is my svc.map file <?xml version="1.0" encoding="utf-8"?> <ServiceReference> <ProxyGenerationParameters ServiceReferenceUri="http://d3w9501/SimpleWCF/SimpleWCF.svc" Name="svc" NotifyPropertyChange="False" UseObservableCollection="False"> </ProxyGenerationParameters> <EndPoints> <EndPoint Address="http://d3w9501.americas.hpqcorp.net/SimpleWCF/SimpleWCF.svc" BindingConfiguration="BasicHttpBinding_ISimpleWCF" Contract="TestSimpleWCF.svc.ISimpleWCF" > </EndPoint> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_ISimpleWCF" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" > <security mode="None" /> </binding> </basicHttpBinding> </bindings> </EndPoints> </ServiceReference>

    Read the article

  • SQL Server error handling: exceptions and the database-client contract

    - by gbn
    We’re a team of SQL Servers database developers. Our clients are a mixed bag of C#/ASP.NET, C# and Java web services, Java/Unix services and some Excel. Our client developers only use stored procedures that we provide and we expect that (where sensible, of course) they treat them like web service methods. Some our client developers don’t like SQL exceptions. They understand them in their languages but they don’t appreciate that the SQL is limited in how we can communicate issues. I don’t just mean SQL errors, such as trying to insert “bob” into a int column. I also mean exceptions such as telling them that a reference value is wrong, or that data has already changed, or they can’t do this because his aggregate is not zero. They’d don’t really have any concrete alternatives: they’ve mentioned that we should output parameters, but we assume an exception means “processing stopped/rolled back. How do folks here handle the database-client contract? Either generally or where there is separation between the DB and client code monkeys. Edits: we use SQL Server 2005 TRY/CATCH exclusively we log all errors after the rollback to an exception table already we're concerned that some of our clients won't check output paramaters and assume everything is OK. We need errors flagged up for support to look at. everything is an exception... the clients are expected to do some message parsing to separate information vs errors. To separate our exceptions from DB engine and calling errors, they should use the error number (ours are all 50,000 of course)

    Read the article

  • What do I need to know before accepting a contract position in the United States?

    - by Andrew
    I just received an initial job offer for a contract position as a PHP developer. I have never had a contract position before, so I don't know what the implications of this are, and how it differs from a salaried position with benefits. =/ What are some things that I should be aware of before accepting the contract position? (i.e. taxes, wages, benefits, etc) It also mentions that I will sign a "day-to-day contract". What does that mean? Resources Here are some links that I've collected so far: First timer's guide to contracting - Covers contracting in the U.K., but not the U.S. The contract employee's handbook - Talks about the differences between a "Contract Employee" and an "Independent Contractor"

    Read the article

  • Do you have a contract between the Product Owner and the Team?

    - by Martin Hinshelwood
    Working in Scrum it is useful to define a Sprint Contract between the Product Owner (PO) and the implementation Team. Doing this helps to improve common understanding in, and sometimes to enforce, the relationship between the PO and the Team. This is simply an agreement between the PO for one Sprint and is not really a commercial contract and should be confirmed via an e-mail at the beginning of every Sprint. “The implementation team agrees to do its best to deliver an agreed on set of features (scope) to a defined quality standard by the end of the sprint. (Ideally they deliver what they promised, or even a bit more.) The Product Owner agrees not to change his instructions before the end of the Sprint.” - Agile Project management (http://agilesoftwaredevelopment.com/blog/peterstev/10-agile-contracts#Sprint) Each of the Sprints in a Scrum project can be considered a mini-project that has Time (Sprint Length), Scope (Sprint Backlog), Quality (Definition of Done) and Cost (Team Size*Sprint Length). Only the scope can vary and this is measured every sprint. Figure: Good Example, the product owner should reply to the team and commit to the contract This Rule has been added to SSW’s Rules to better Scrum with TFS   Technorati Tags: SSW,Scrum,SSW Rules

    Read the article

  • Why values in my WCF data contract were suddenly wrong...

    - by mipsen
    A WCF Service I provided took a very simple data contract as parameter (containing one string and one int...) and had a very simple task to do. A .NET 3.5 client was created using the VS2008 feature "Add Service Reference". Everything worked as expected. Then a slight change came in: The client was expected to run on machines with .NET 2.0 only. So we set the Target  Framework to .NET 2.0, removed the references to System.ServiceModel, System.Runtime.Serialization and the ServiceReference and created a new Reference to the Service using the old "Add Web Reference" . A matter of 2 minutes.  When testing, the int value in the data contract arriving at the WCF Service suddenly was 0, instead of 38 as we expected. What happened? When generating an old  Web Reference on a WCF data contract an additional boolean field for each value-type field is created called [Fieldname]Specified (e.g. AgeSpecified) which defaults to "false". WCF inspects these boolean fields to determine if a value was provided for the value-type field. If the "Specified"-field is "false", WCF translates that to using the default-value of the value-type field. For int this is 0. So we had to insert  setting the "Specified"-field  for the int-value to "true" and everything was fine again. That was what we forgot after setting the Framework-version to 2.0...

    Read the article

  • Who owns the IP rights of the software without written employment contract? Employer or employee? [closed]

    - by P T
    I am a software engineer who got an idea, and developed alone an integrated ERP software solution over the past 2 years. I got the idea and coded much of the software in my personal time, utilizing my own resources, but also as intern/employee at small wholesale retailer (company A). I had a verbal agreement with the company that I could keep the IP rights to the code and the company would have the "shop rights" to use "a copy" of the software without restrictions. Part of this agreement was that I was heavily underpaid to keep the rights. Recently things started to take a down turn in the company A as the company grew fairly large and new head management was formed, also new partners were brought in. The original owners distanced themselves from the business, and the new "greedy" group indicated that they want to claim the IP rights to my software, offering me a contract that would split the IP ownership into 50% co-ownership, completely disregarding the initial verbal agreements. As of now there was no single written job description and agreement/contract/policy that I signed with the company A, I signed only I-9 and W-4 forms. I now have an opportunity to leave the company A and form a new business with 2 partners (Company B), obviously using the software as the primary tool. There would be no direct conflict of interest as the company A sells wholesale goods. My core question is: "Who owns the code without contract? Me or the company A? (in FL, US)" Detailed questions: I am familiar with the "shop rights", I don't have any problem leaving a copy of the code in the company for them to use/enhance to run their wholesale business. What worries me, Can the company A make any legal claims to the software/code/IP and potential derived profits/interests after I leave and form a company B? Can applying for a copyright of the code at http://www.copyright.gov in my name prevent any legal disputes in the future? Can I use it as evidence for legal defense? Could adding a note specifying the company A as exclusive license holder clarify the arrangements? If I leave and the company A sues me, what evidence would they use against me? On what basis would the sue since their business is in completely different industry than software (wholesale goods). Every single source file was created/stored on my personal computer with proper documentation including a copyright notice with my credentials (name/email/addres/phone). It's also worth noting that I develop significant part of the software prior to my involvement with the company A as student. If I am forced to sign a contract and the company A doesn't honor the verbal agreement, making claims towards the ownership, what can I do settle the matter legally? I like to avoid legal process altogether as my budget for court battles is extremely limited at the moment. Would altering the code beyond recognition and using it for the company B prevent the company A make any copyright claims? My common sense tells me that what I developed is by default mine in terms of IP, unless there is a signed legal agreement stating otherwise. But looking online it may be completely backwards, this really worries me. I understand that this is not legal advice, and I know to get the ultimate answer I need to hire a lawyer. I am only hoping to get some valuable input/experience/advice/opinion from those who were in similar situation or are familiar with the topic. Thank you, PT

    Read the article

  • IOC Container Handling State Params in Non-Default Constructor

    - by Mystagogue
    For the purpose of this discussion, there are two kinds of parameters an object constructor might take: state dependency or service dependency. Supplying a service dependency with an IOC container is easy: DI takes over. But in contrast, state dependencies are usually only known to the client. That is, the object requestor. It turns out that having a client supply the state params through an IOC Container is quite painful. I will show several different ways to do this, all of which have big problems, and ask the community if there is another option I'm missing. Let's begin: Before I added an IOC container to my project code, I started with a class like this: class Foobar { //parameters are state dependencies, not service dependencies public Foobar(string alpha, int omega){...}; //...other stuff } I decide to add a Logger service depdendency to the Foobar class, which perhaps I'll provide through DI: class Foobar { public Foobar(string alpha, int omega, ILogger log){...}; //...other stuff } But then I'm also told I need to make class Foobar itself "swappable." That is, I'm required to service-locate a Foobar instance. I add a new interface into the mix: class Foobar : IFoobar { public Foobar(string alpha, int omega, ILogger log){...}; //...other stuff } When I make the service locator call, it will DI the ILogger service dependency for me. Unfortunately the same is not true of the state dependencies Alpha and Omega. Some containers offer a syntax to address this: //Unity 2.0 pseudo-ish code: myContainer.Resolve<IFoobar>( new parameterOverride[] { {"alpha", "one"}, {"omega",2} } ); I like the feature, but I don't like that it is untyped and not evident to the developer what parameters must be passed (via intellisense, etc). So I look at another solution: //This is a "boiler plate" heavy approach! class Foobar : IFoobar { public Foobar (string alpha, int omega){...}; //...stuff } class FoobarFactory : IFoobarFactory { public IFoobar IFoobarFactory.Create(string alpha, int omega){ return new Foobar(alpha, omega); } } //fetch it... myContainer.Resolve<IFoobarFactory>().Create("one", 2); The above solves the type-safety and intellisense problem, but it (1) forced class Foobar to fetch an ILogger through a service locator rather than DI and (2) it requires me to make a bunch of boiler-plate (XXXFactory, IXXXFactory) for all varieties of Foobar implementations I might use. Should I decide to go with a pure service locator approach, it may not be a problem. But I still can't stand all the boiler-plate needed to make this work. So then I try this: //code named "concrete creator" class Foobar : IFoobar { public Foobar(string alpha, int omega, ILogger log){...}; static IFoobar Create(string alpha, int omega){ //unity 2.0 pseudo-ish code. Assume a common //service locator, or singleton holds the container... return Container.Resolve<IFoobar>( new parameterOverride[] {{"alpha", alpha},{"omega", omega} } ); } //Get my instance: Foobar.Create("alpha",2); I actually don't mind that I'm using the concrete "Foobar" class to create an IFoobar. It represents a base concept that I don't expect to change in my code. I also don't mind the lack of type-safety in the static "Create", because it is now encapsulated. My intellisense is working too! Any concrete instance made this way will ignore the supplied state params if they don't apply (a Unity 2.0 behavior). Perhaps a different concrete implementation "FooFoobar" might have a formal arg name mismatch, but I'm still pretty happy with it. But the big problem with this approach is that it only works effectively with Unity 2.0 (a mismatched parameter in Structure Map will throw an exception). So it is good only if I stay with Unity. The problem is, I'm beginning to like Structure Map a lot more. So now I go onto yet another option: class Foobar : IFoobar, IFoobarInit { public Foobar(ILogger log){...}; public IFoobar IFoobarInit.Initialize(string alpha, int omega){ this.alpha = alpha; this.omega = omega; return this; } } //now create it... IFoobar foo = myContainer.resolve<IFoobarInit>().Initialize("one", 2) Now with this I've got a somewhat nice compromise with the other approaches: (1) My arguments are type-safe / intellisense aware (2) I have a choice of fetching the ILogger via DI (shown above) or service locator, (3) there is no need to make one or more seperate concrete FoobarFactory classes (contrast with the verbose "boiler-plate" example code earlier), and (4) it reasonably upholds the principle "make interfaces easy to use correctly, and hard to use incorrectly." At least it arguably is no worse than the alternatives previously discussed. One acceptance barrier yet remains: I also want to apply "design by contract." Every sample I presented was intentionally favoring constructor injection (for state dependencies) because I want to preserve "invariant" support as most commonly practiced. Namely, the invariant is established when the constructor completes. In the sample above, the invarient is not established when object construction completes. As long as I'm doing home-grown "design by contract" I could just tell developers not to test the invariant until the Initialize(...) method is called. But more to the point, when .net 4.0 comes out I want to use its "code contract" support for design by contract. From what I read, it will not be compatible with this last approach. Curses! Of course it also occurs to me that my entire philosophy is off. Perhaps I'd be told that conjuring a Foobar : IFoobar via a service locator implies that it is a service - and services only have other service dependencies, they don't have state dependencies (such as the Alpha and Omega of these examples). I'm open to listening to such philosophical matters as well, but I'd also like to know what semi-authorative reference to read that would steer me down that thought path. So now I turn it to the community. What approach should I consider that I havn't yet? Must I really believe I've exhausted my options?

    Read the article

  • Does Scala's BigDecimal violate the equals/hashCode contract?

    - by oxbow_lakes
    As the Ordered trait demands, the equals method on Scala's BigDecimal class is consistent with the ordering. However, the hashcode is simply taken from the wrapped java.math.BigDecimal and is therefore inconsistent with equals. object DecTest { def main(args: Array[String]) { val d1 = BigDecimal("2") val d2 = BigDecimal("2.00") println(d1 == d2) //prints true println(d1.hashCode == d2.hashCode) //prints false } } I can't find any reference to this being a known issue. Am I missing something?

    Read the article

  • Duplex Contract GetCallbackChannel always returns a null-instance

    - by Yaroslav
    Hi! Here is the server code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System.Runtime.Serialization; using System.ServiceModel.Description; namespace Console_Chat { [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(IMyCallbackContract))] public interface IMyService { [OperationContract(IsOneWay = true)] void NewMessageToServer(string msg); [OperationContract(IsOneWay = false)] bool ServerIsResponsible(); } [ServiceContract] public interface IMyCallbackContract { [OperationContract(IsOneWay = true)] void NewMessageToClient(string msg); [OperationContract(IsOneWay = true)] void ClientIsResponsible(); } [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] public class MyService : IMyService { public IMyCallbackContract callback = null; /* { get { return OperationContext.Current.GetCallbackChannel<IMyCallbackContract>(); } } */ public MyService() { callback = OperationContext.Current.GetCallbackChannel<IMyCallbackContract>(); } public void NewMessageToServer(string msg) { Console.WriteLine(msg); } public void NewMessageToClient( string msg) { callback.NewMessageToClient(msg); } public bool ServerIsResponsible() { return true; } } class Server { static void Main(string[] args) { String msg = "none"; ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); ServiceHost serviceHost = new ServiceHost( typeof(MyService), new Uri("http://localhost:8080/")); serviceHost.Description.Behaviors.Add(behavior); serviceHost.AddServiceEndpoint( typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); serviceHost.AddServiceEndpoint( typeof(IMyService), new WSDualHttpBinding(), "ServiceEndpoint" ); serviceHost.Open(); Console.WriteLine("Server is up and running"); MyService server = new MyService(); server.NewMessageToClient("Hey client!"); /* do { msg = Console.ReadLine(); // callback.NewMessageToClient(msg); } while (msg != "ex"); */ Console.ReadLine(); } } } Here is the client's: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System.Runtime.Serialization; using System.ServiceModel.Description; using Console_Chat_Client.MyHTTPServiceReference; namespace Console_Chat_Client { [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(IMyCallbackContract))] public interface IMyService { [OperationContract(IsOneWay = true)] void NewMessageToServer(string msg); [OperationContract(IsOneWay = false)] bool ServerIsResponsible(); } [ServiceContract] public interface IMyCallbackContract { [OperationContract(IsOneWay = true)] void NewMessageToClient(string msg); [OperationContract(IsOneWay = true)] void ClientIsResponsible(); } public class MyCallback : Console_Chat_Client.MyHTTPServiceReference.IMyServiceCallback { static InstanceContext ctx = new InstanceContext(new MyCallback()); static MyServiceClient client = new MyServiceClient(ctx); public void NewMessageToClient(string msg) { Console.WriteLine(msg); } public void ClientIsResponsible() { } class Client { static void Main(string[] args) { String msg = "none"; client.NewMessageToServer(String.Format("Hello server!")); do { msg = Console.ReadLine(); if (msg != "ex") client.NewMessageToServer(msg); else client.NewMessageToServer(String.Format("Client terminated")); } while (msg != "ex"); } } } } callback = OperationContext.Current.GetCallbackChannel(); This line constanly throws a NullReferenceException, what's the problem? Thanks!

    Read the article

  • Data Contract Serialization Not Working For All Elements

    - by splatto
    I have an XML file that I'm trying to serialize into an object. Some elements are being ignored. My XML File: <?xml version="1.0" encoding="utf-8" ?> <License xmlns="http://schemas.datacontract.org/2004/07/MyApp.Domain"> <Guid>7FF07F74-CD5F-4369-8FC7-9BF50274A8E8</Guid> <Url>http://www.gmail.com</Url> <ValidKey>true</ValidKey> <CurrentDate>3/1/2010 9:39:28 PM</CurrentDate> <RegistrationDate>3/8/2010 9:39:28 PM</RegistrationDate> <ExpirationDate>3/8/2099 9:39:28 PM</ExpirationDate> </License> My class definition: [DataContract] public class License { [DataMember] public virtual int Id { get; set; } [DataMember] public virtual string Guid { get; set; } [DataMember] public virtual string ValidKey { get; set; } [DataMember] public virtual string Url { get; set; } [DataMember] public virtual string CurrentDate { get; set; } [DataMember] public virtual string RegistrationDate { get; set; } [DataMember] public virtual string ExpirationDate { get; set; } } And my Serialization attempt: XmlDocument Xmldoc = new XmlDocument(); Xmldoc.Load(string.Format(url)); string xml = Xmldoc.InnerXml; var serializer = new DataContractSerializer(typeof(License)); var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(xml)); License license = (License)serializer.ReadObject(memoryStream); memoryStream.Close(); The following elements are serialized: Guid ValidKey The following elements are not serialized: Url CurrentDate RegistrationDate ExpirationDate Replacing the string dates in the xml file with "blah" doesn't work either. What gives?

    Read the article

  • Xaml parse exception is thrown when i define a duplex contract

    - by Yaroslav
    Hi! I've got a WPF application containing a WCF service. The Xaml code is pretty simple: Enter your text here Send Address: Here is the service: namespace WpfApplication1 { [ServiceContract(CallbackContract=typeof(IMyCallbackContract))] public interface IMyService { [OperationContract(IsOneWay = true)] void NewMessageToServer(string msg); [OperationContract(IsOneWay = true)] bool ServerIsResponsible(); } [ServiceContract] public interface IMyCallbackContract { [OperationContract] void NewMessageToClient(string msg); [OperationContract] void ClientIsResponsible(); } /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { InitializeComponent(); ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); //behavior.HttpGetEnabled = true; //behavior. ServiceHost serviceHost = new ServiceHost( typeof(MyService), new Uri("net.tcp://localhost:8080/")); serviceHost.Description.Behaviors.Add(behavior); serviceHost.AddServiceEndpoint( typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex"); serviceHost.AddServiceEndpoint( typeof(IMyService), new NetTcpBinding(), "ServiceEndpoint"); serviceHost.Open(); MessageBox.Show( "server is up"); // label1.Content = label1.Content + String.Format(" net.tcp://localhost:8080/"); } } public class MyService : IMyService { public void NewMessageToServer(string msg) { } public bool ServerIsResponsible() { return true; } } } I am getting a Xaml parse exception in Line 1, what can be the problem? Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >