Search Results

Search found 70 results on 3 pages for 'svcutil'.

Page 1/3 | 1 2 3  | Next Page >

  • Svcutil.exe for .Net 4.0?

    - by D.H.
    I was trying to use svcutil.exe to generate proxy classes for a service but when I use the /reference option to reference an assembly that is built for .Net 4.0 I get an error. Could not load file or assembly [...] or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. So it seems that I am using an old version of svcutil.exe. I am using the one in "C:\Program Files\Microsoft SDKs\Windows\v7.0A which was the latest one I could find. Is there a later version somewhere that I am supposed to use?

    Read the article

  • use svcutil to map multiple namespaces for generating wcf service proxies

    - by Pratik
    I want to use svcutil to map multiple wsdl namespace to clr namespace when generating service proxies. I use strong versioning of namespaces and hence the generated clr namespaces are awkward and may mean many client side code changes if the wsdl/xsd namespace version changes. A code example would be better to show what I want. // Service code namespace TestService.StoreService { [DataContract(Namespace = "http://mydomain.com/xsd/Model/Store/2009/07/01")] public class Address { [DataMember(IsRequired = true, Order = 0)] public string street { get; set; } } [ServiceContract(Namespace = "http://mydomain.com/wsdl/StoreService-v1.0")] public interface IStoreService { [OperationContract] List<Customer> GetAllCustomersForStore(int storeId); [OperationContract] Address GetStoreAddress(int storeId); } public class StoreService : IStoreService { public List<Customer> GetAllCustomersForStore(int storeId) { throw new NotImplementedException(); } public Address GetStoreAddress(int storeId) { throw new NotImplementedException(); } } } namespace TestService.CustomerService { [DataContract(Namespace = "http://mydomain.com/xsd/Model/Customer/2009/07/01")] public class Address { [DataMember(IsRequired = true, Order = 0)] public string city { get; set; } } [ServiceContract(Namespace = "http://mydomain.com/wsdl/CustomerService-v1.0")] public interface ICustomerService { [OperationContract] Customer GetCustomer(int customerId); [OperationContract] Address GetStoreAddress(int customerId); } public class CustomerService : ICustomerService { public Customer GetCustomer(int customerId) { throw new NotImplementedException(); } public Address GetStoreAddress(int customerId) { throw new NotImplementedException(); } } } namespace TestService.Shared { [DataContract(Namespace = "http://mydomain.com/xsd/Model/Shared/2009/07/01")] public class Customer { [DataMember(IsRequired = true, Order = 0)] public int CustomerId { get; set; } [DataMember(IsRequired = true, Order = 1)] public string FirstName { get; set; } } } 1. svcutil - without namespace mapping svcutil.exe /t:metadata TestSvcUtil\bin\debug\TestService.CustomerService.dll TestSvcUtil\bin\debug\TestService.StoreService.dll svcutil.exe /t:code *.wsdl *.xsd /o:TestClient\WebServiceProxy.cs The generated proxy looks like namespace mydomain.com.xsd.Model.Shared._2009._07._011 { public partial class Customer{} } namespace mydomain.com.xsd.Model.Customer._2009._07._011 { public partial class Address{} } namespace mydomain.com.xsd.Model.Store._2009._07._011 { public partial class Address{} } The client classes are out of any namespaces. Any change to xsd namespace would imply changing all using statements in my client code all build will break. 2. svcutil - with wildcard namespace mapping svcutil.exe /t:metadata TestSvcUtil\bin\debug\TestService.CustomerService.dll TestSvcUtil\bin\debug\TestService.StoreService.dll svcutil.exe /t:code *.wsdl *.xsd /n:*,MyDomain.ServiceProxy /o:TestClient\WebServicesProxy2.cs The generated proxy looks like namespace MyDomain.ServiceProxy { public partial class Customer{} public partial class Address{} public partial class Address1{} public partial class CustomerServiceClient{} public partial class StoreServiceClient{} } Notice that svcutil has automatically changed one of the Address class to Address1. I don't like this. All client classes are also inside the same namespace. What I want Something like this: svcutil.exe /t:code *.wsdl *.xsd /n:"http://mydomain.com/xsd/Model/Shared/2009/07/01, MyDomain.Model.Shared;http://mydomain.com/xsd/Model/Customer/2009/07/01, MyDomain.Model.Customer;http://mydomain.com/wsdl/CustomerService-v1.0, MyDomain.CustomerServiceProxy;http://mydomain.com/xsd/Model/Store/2009/07/01, MyDomain.Model.Store;http://mydomain.com/wsdl/StoreService-v1.0, MyDomain.StoreServiceProxy" /o:TestClient\WebServiceProxy3.cs This way I can logically group the clr namespace and any change to wsdl/xsd namespace is handled in the proxy generation only without affecting the rest of the client side code. Now this is not possible. The svcutil allows to map only one or all namespaces, not a list of mappings. I can do one mapping as shown below but not multiple svcutil.exe /t:code *.wsdl *.xsd /n:"http://mydomain.com/xsd/Model/Store/2009/07/01, MyDomain.Model.Address" /o:TestClient\WebServiceProxy4.cs But is there any solution. Svcutil is not magic, it is written in .Net and programatically generating the proxies. Has anyone written an alternate to svcutil or point me to directions so that I can write one.

    Read the article

  • Error generating Interface with svcutil.exe

    - by capdragon
    Can someone help me generate the Interface (c#) file for the following OGC schema? Schema files: Download Schema Files Link I need to create web services for the Ordering wsdl in the schema zip file above. I've been at it for days now with no luck generating the interface. I've tried: svcutil.exe thewsdl.wsdl /language:c# /out:ITheInterface.cs svcutil Order.wsdl /out:IOrder.cs svcutil Order.wsdl Order.xsd ..\ws-addressing\ws-addr.xsd /out:IOrder.cs svcutil Order.wsdl Order.xsd ws-addr.xsd /out:IOrder.cs and i get the following error: Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1] Copyright (c) Microsoft Corporation. All rights reserved. Error: Cannot read ws-addr.xsd. Cannot load file D:\Documents\DEV\SARPilot\Docs\eoschema\schema\OrderSchema\ws-addr.xsd as an Assembly. Check the FusionLogs f or more Information. Could not load file or assembly 'file:///D:\Documents\DEV\SARPilot\Docs\eoschema\schema\OrderSchema\ws-addr.xsd' or one of its dependencies. The module was expected to contain an assembly manifest.

    Read the article

  • .Net SvcUtil: attributes must be optional

    - by Michel van Engelen
    Hi, I'm trying to generate C# code classes with SvcUtil.exe instead of Xsd.exe. The latter is giving me some problems. Command line: SvcUtil.exe myschema.xsd /dconly /ser:XmlSerializer Several SvcUtil problems are described and solved here: http://blog.shutupandcode.net/?p=761 One problem I can't solve is this one: Error: Type 'DatafieldDescription' in namespace '' cannot be imported. Attributes must be optional and from namespace 'http://schemas.microsoft.com/2003/10/Seri alization/'. Either change the schema so that the types can map to data contract types or use ImportXmlType or use a different serializer. ' I changed <xs:attribute name="Order" use="required"> to <xs:attribute name="Order" use="optional"> and <xs:attribute name="Order"> But the error remains. Is it possible to use attributes, or do I have to delete them all (in that case, this excercition is over)?

    Read the article

  • Svcutil generating bad config with multiple endpoints

    - by vfilby
    I have a WCF service that has exposed a soap and an xml endpoint. When I use svcutil to generate the proxy code on the client side the generated configuration contains two endpoints which causes the client to fail. If I edit the web.config file and remove the second endpoint (with the custom binding) all works as expected. Is there a way I can get svcutil to generate a config that just works so that I don't need to hand edit the file everytime? Client-side error: An endpoint configuration section for contract 'MyNamespace.ITestService' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name. Svcutil command: svcutil http://api.local/Test.svc /reference:bin\MyNamespace.Interface.dll /config:web.config /mergeConfig /out:"Service References\TestService.cs" /n:*,MyNamespace Generated client config: <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_ITestService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> <customBinding> <binding name="CustomBinding_ITestService"> <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12" writeEncoding="utf-8"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> </textMessageEncoding> </binding> </customBinding> </bindings> <client> <endpoint address="http://api2.local/Test.svc/soap" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService" contract="MyNamespace.ITestService" name="BasicHttpBinding_ITestService" /> <endpoint binding="customBinding" bindingConfiguration="CustomBinding_ITestService" contract="MyNamespace.ITestService" name="CustomBinding_ITestService" /> </client> </system.serviceModel>

    Read the article

  • Passing Certificate to Svcutil to generate proxy for OSB Service

    - by webwires
    We are wanting to implement Two-Way SSL security from WCF to OSB Services. We have successfully deployed the certificates so that when you browse to the service with IE you get the appropriate prompt for certificate and then it takes you immediately to the WSDL. But, when you attempt to generate a proxy using svcutil as defined in steps 8 and 9 in this MSDN article. http://msdn.microsoft.com/en-us/library/cc949005.aspx I get the error: A reply message was received for operation 'Get' with action 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Get'. However, your client code requires action 'http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse'. The OSB services are set to use Soap 1.2 and the svcutil.exe.config we use is identicle to the article except for the findValue and x509FindType. Instead we used the FindByThumbprint pointing to the "My" store name and "CurrentUser" store location. The cert is there and is the same cert we select from the IE prompt.

    Read the article

  • svcutil, WSDL, and the generated interfaces not being sufficient for implementation

    - by chtmd
    I have a WSDL file defining a service that I have to implement in WCF. I had read that I could generate the proxy using svcutil from the WSDL file, and that I could then use the generated interfaces to implement the service. Unfortunately, I can't quite seem to find a way to have the interfaces contain the correct attributes to expose the contracts. All operations have the "OperationContractAttribute" attribute, but it appears as though for the service to be exposed, I require the "OperationContract" for each one. Same thing with "ServiceContractAttribute" and "ServiceContract", and I imagine DataContract, but I haven't gotten that far. I could manually make these changes, but I would much prefer a technique where the existing code could be easily used, or better code could be generated for my uses. Is there some way that this can be done? Thanks. EDIT: Command used: svcutil ObjectManagerService.wsdl /n:*,Sample /o:ObjectManagerServiceProxy.cs /nologo Code sample: public interface ObjectManagerSyncPortType { // CODEGEN: Generating message contract since the operation createObject is neither RPC nor document wrapped. [System.ServiceModel.OperationContractAttribute(Action="http://www.sample.com/createObject", ReplyAction="*")] [System.ServiceModel.XmlSerializerFormatAttribute()] Sample.createObjectResponse1 createObject(Sample.createObjectRequest1 request); As best as I can tell/see the WSDL file is entirely self-contained and requires no additional XSD files.

    Read the article

  • Space in Directory Parameter of svcutil.exe

    - by Drew Frisk
    I'm attempting to download metadata for a WCF service using svcutil but I'm running into issues with the /directory:< parameter. The directory I want to save to has a space in it: C:\Service References\Logging so when I execute /t:metadata I receive the following error: Error: The directory 'C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\References\Logging' could not be found. Verify that the directory exists and that you have the appropriate permissions to read it. It looks to me like the space in "Service References" is causing the issue. From my understanding of command shell (which is very little) spaces act as delimiters for an executable. So I tried escaping the space with a carrot Service^ References and surrounding the path in double quotes "C:\Service References\Logging" but neither of those seem to be working, as the /directory: parameter doesn't recognize them as valid characters in the value. I haven't been able to find any direction in regards to this and svcutil, so I'm at a loss right now. I could download the files to a temp folder and then move them, but I would prefer not to take that approach. I would appreciate any direction that could be given on trying to resolve this. Thanks in advance.

    Read the article

  • WCF ServiceContract and svcutil issue

    - by Valko
    Hi, I have a public interface auto-generated bu svcutil: [System.ServiceModel.ServiceContractAttribute(Namespace="...", ConfigurationName="...")] public interface MyInterface Then I have asmx web service inheriting it and working fine. I am trying ot convert it to WCF but when I instrument the service (in asmx.cs code behind) with ServiceContract: [ServiceContract(Namespace = "...")] public class MyService : MyInterface Also I have cerated .svc file and added the system.serviceModel setting in the config file. The goal is to migrate the asmx service to WCF service. I've got this error: The service class of type MyService both defines a ServiceContract and inherits a ServiceContract from type MyInterface. Contract inheritance can only be used among interface types. If a class is marked with ServiceContractAttribute, it must be the only type in the hierarchy with ServiceContractAttribute. The asmx service is still working fine. Only the .svc is giving me issues. My question is how to fix that. MyInterface is an interface so I do not see what the problem is and why I've got the error anyway. Note I do not want to change MyInterface, because it is autogenerated from svcutil from my wsdl schema and I do not want this interface to be edited manually. The whole idea is to have the service types automatically genereted from WSDL and to save my team development efforts with manual editing. Any help is appreciated.

    Read the article

  • Make svcutil.exe generate Properties with no Order attribute

    - by Luis Filipe
    I use svcutil.exe to generate proxy classes from a hosted WebService created by WebSphere that uses Java under the hood. I am using the XmlSerializer instead of DataContractSerializer and targeting Framework v3.5 with VS2010 The proxy classes are generated with the following attribute for each property [System.Xml.Serialization.XmlArrayAttribute(Order=20)] How can i tell the utility to suppress generating the Order parameter?

    Read the article

  • Problem with serialization of svcutil synthetized classes

    - by user295502
    I used svcutil to generate classes to access the web service. I need to serialize them. The class is quite simple, here is how it looks [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Name="cosemAttributeDescriptor", Namespace="http://www.energiened.nl/Content/Publications/dsmr/P32")] public partial class cosemAttributeDescriptor : object, System.Runtime.Serialization.IExtensibleDataObject { private System.Runtime.Serialization.ExtensionDataObject extensionDataField; private ushort ClassIdField; private string InstanceIdField; private sbyte AttributeIdField; public System.Runtime.Serialization.ExtensionDataObject ExtensionData { get { return this.extensionDataField; } set { this.extensionDataField = value; } } [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)] public ushort ClassId { get { return this.ClassIdField; } set { this.ClassIdField = value; } } [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, EmitDefaultValue=false)] public string InstanceId { get { return this.InstanceIdField; } set { this.InstanceIdField = value; } } [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true, Order=2)] public sbyte AttributeId { get { return this.AttributeIdField; } set { this.AttributeIdField = value; } } } Now, the problem is I can't serialize the class. Here is the serialization code: cosemAttributeDescriptor cAttrD = new cosemAttributeDescriptor(); cAttrD.ClassId = 3; cAttrD.InstanceId = "0100010800FF"; cAttrD.AttributeId = 0; DataContractSerializer dSer = new DataContractSerializer(typeof(cosemAttributeDescriptor)); StringBuilder sb = new StringBuilder(); XmlWriter xW = XmlWriter.Create(sb); dSer.WriteObject(xW, cAttrD); When I try to serialize the class, I get empty string. Any thoughts?

    Read the article

  • SvcUtil and /dconly generates XSD's for data types NOT marked with the DataContract attribute.

    - by Bellerephon
    Has anyone ever encountered a problem with Svcutil and the /dconly option where it generates metadata for EVERY data type in an Assembly, even if it is NOT marked with with the [DataContract()] attribute? It also appears to be generating metadata for types only referenced in the code, such as XmlDictionaryReaderQuotas even though these are not a part of the physical assembly that I generated metadata on. Some info: Using the .NET 4.0 version of SvcUtil. Does not matter if class is empty or not. No references are specified in the command line for SvcUtil. Command line: "C:\In Progress Work (Prospective)\Prospective Server\Prospective Server\Management\Prospective.Server.Server.NET40.Debug.AnyCPU.dll" /nologo /t:metadata /d:"C:\In Progress Work (Prospective)\Prospective Server\Prospective Server\Management" /dconly

    Read the article

  • svcutil, XmlSerializer and xsd:list

    - by Dmitry Ornatsky
    I'm using svcutil to generate classes from service metadata. This XML schema <xsd:complexType name="FindRequest"> ... <xsd:attribute name="Significance" type="Significance" use="optional" /> </xsd:complexType> <xsd:simpleType name="Significance"> <xsd:list> <xsd:simpleType> <xsd:restriction base="xsd:int"> <xsd:enumeration value="1" /> <xsd:enumeration value="2" /> <xsd:enumeration value="3" /> </xsd:restriction> </xsd:simpleType> </xsd:list> produces following code: public partial class FindRequest { ... private int significanceField; private bool significanceFieldSpecified; [System.Xml.Serialization.XmlAttributeAttribute()] public int Significance { get { return this.significanceField; } set { this.significanceField = value; } } [System.Xml.Serialization.XmlIgnoreAttribute()] public bool SignificanceSpecified { get { return this.significanceFieldSpecified; } set { this.significanceFieldSpecified = value; } } } My questions are: Is it possible to make XmlSerializer understand this type of list: <FindRequest Significance="1 2 3"/> For example by using some kind of a flags-style enum: public enum EmployeeStatus { [XmlEnum(Name = "1")] One = 1, [XmlEnum(Name = "2")] Two = 2, [XmlEnum(Name = "3")] Three = 4 } If the answer is yes, Is it possible to make svcutil/xsd.exe generate classes that are serialized that way without changing the schema?

    Read the article

  • WCF XmlSerializer assembly not speeding up first request

    - by Matt Dearing
    I am generating proxy classes to a clients java webservice wsdls and xsd files with svcutil. The first call made to each service proxy class takes a very long time. I was hoping to speed this up by generating the XmlSerializers assembly myself (based on the article How to: Improve the Startup Time of WCF Client Applications using the XmlSerializer), but when I do the first call to each service still takes the same amount of time. Here are the steps I am following: //generate strong name key file sn -k Blah.snk //generate the proxy class file svcutil blah.wsdl blah2.wsdl blah3.wsdl ... base.xsd blah.xsd ... /UseSerializerForFaults /ser:XmlSerializer /n:*,SomeNamespace /out:Blah.cs //compile the class into an assembly signing it with the strong name key file csc /target:library /keyfile:Blah.snk /out:Blah.dll Blah.cs //generate the XmlSerializer code this will give us Blah.XmlSerializers.dll.cs svcutil /t:xmlSerializer Blah.dll //compile the xmlserializer code into its own dll using the same key to sign it and referencing the original dll csc /target:library /keyfile:Blah.snk /out:Blah.XmlSerializers.dll Blah.XmlSerializers.dll.cs /r:Blah.dll I then create a standard Console application that references both Blah.dll and Blah.XmlSerializers.dll. I will then try something like: //BlahProxy is one of the generated service proxy classes BlahProxy p = new BlahProxy(); //this call takes 30ish seconds p.SomeMethod(); BlahProxy p2 = new BlahProxy(); //this call takes < 1 second p2.SomeMethod(); //BlahProx2y is one of the generated service proxy classes BlahProxy2 p3 = new BlahProxy2(); //this call takes 30ish seconds p3.SomeMethod(); BlahProxy2 p4 = new BlahProxy2(); //this call takes < 1 second p4.SomeMethod(); I know that the problem is not server side because I don't see the request made in Fiddler until around 29 seconds. Subsequent calls to each service take < 1 second, so thats why I was hoping the main slow down was the .net runtime generating the xmlserializer code itself, compiling it and loading the assembly. I figured this would be the reason the first call to each service is slow and the rest are fast. Unfortunatley, me generating the code myself is not speeding anything up. Does anyone see what I am doing wrong?

    Read the article

  • wcf service creating proxy by using svcutil.exe in command prompt?

    - by Surya sasidhar
    when i am trying to generate proxy manually using comand prompt i am getting this error Setting environment for using Microsoft Visual Studio 2008 x86 tools. C:\Program Files\Microsoft Visual Studio 9.0\VC>cd\ C:\>svcutil /language:cs /out:proxy.cs /config:app.config /http://localhost:2544 /myservicewcf/Sasi.svc 'svcutil' is not recognized as an internal or external command, operable program or batch file. C:\>svcutil.exe /language:cs /out:proxy.cs /config:app.config /http://localhost: 2544/myservicewcf/sasi.svc 'svcutil.exe' is not recognized as an internal or external command, operable program or batch file. C:\> can u help me please

    Read the article

  • Consume webservice from a .NET DLL - app.config problem

    - by Asaf R
    Hi, I'm building a DLL, let's call it mydll.dll, and in it I sometimes need to call methods from webservice, myservice. mydll.dll is built using C# and .NET 3.5. To consume myservice from mydll I've Added A Service in Visual Studio 2008, which is more or less the same as using svcutil.exe. Doing so creates a class I can create, and adds endpoint and bindings configurations to mydll app.config. The problem here is that mydll app.config is never loaded. Instead, what's loaded is the app.config or web.config of the program I use mydll in. I expect mydll to evolve, which is why I've decoupled it's funcionality from the rest of my system to begin with. During that evolution it will likely add more webservice to which it'll call, ruling out manual copy-paste ways to overcome this problem. I've looked at several possible approaches to attacking this issue: Manually copy endpoints and bindings from mydell app.config to target EXE or web .config file. Couples the modules, not flexible Include endpoints and bindings from mydll app.config in target .config, using configSource (see here). Also add coupling between modules Programmatically load mydll app.config, read endpoints and bindings, and instantiate Binding and EndpointAddress. Use a different tool to create local frontend for myservice I'm not sure which way to go. Option 3 sounds promising, but as it turns out it's a lot of work and will probably introduce several bugs, so it doubtfully pays off. I'm also not familiar with any tool other than the canonical svcutil.exe. Please either give pros and cons for the above alternative, provide tips for implementing any of them, or suggest other approaches. Thanks, Asaf

    Read the article

  • WCF Proxy generation

    - by dragonfly
    Hi, I'm generating proxy using svcutil tool. My contract methods return objects of particular type. However generated proxy client interface has return value of type object. What is more I get exception with message: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail] : The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:name. The InnerException message was 'XML 'Element' 'http://tempuri.org/:name' does not contain expected attribute 'http://schemas.microsoft.com/2003/10/Serialization/:Type'. The deserializer has no knowledge of which type to deserialize. Check that the type being serialized has the same contract as the type being deserialized.'. Please see InnerException for more details. Any ideas what's going on?

    Read the article

  • slsvcutil.exe Proxy and Interfaces

    - by JPM
    Is it possible when using slsvcutil.exe to generate a proxy through the command line not to have the proxy file output the Interface in an Asynchronous fashion. For example, if I have a function "foo()" on the serverside in the Interface, when I generate the proxy using Slsvcutil.exe, it makes two functions in the interface definition in the proxy named "BeginFoo()" and "EndFoo()". All I want is "Foo()", I don't need the other two methods. Is this possible? I'm using the proxy with Monotouch which is why I need to use Slsvcutil.exe but don't need the Asynchronous methods. Thanks!

    Read the article

  • Deploying service from development server to iis7 server

    - by MindWorX
    I have a service which works perfectly on the local development server, but once moved to the remote iis7 server, it fails. I've been browsing the service in a browser manually. Here's the steps I've been taking: Open up Service.svc Open up Service.svc?wsdl Open up Service.svc?wsdl0 Open up Service.svc?xsd=xsd0 Step 4. is where it fails. If i browse on the development server it works. If i browse on the iis7 server, I get a connection reset error. Any help appreciated.

    Read the article

  • WCF service reference namespace differs from original

    - by Thorarin
    I'm having a problem regarding namespaces used by my service references. I have a number of WCF services, say with the namespace MyCompany.Services.MyProduct (the actual namespaces are longer). As part of the product, I'm also providing a sample C# .NET website. This web application uses the namespace MyCompany.MyProduct. During initial development, the service was added as a project reference to the website and uses directly. I used a factory pattern that returns an object instance that implements MyCompany.Services.MyProduct.IMyService. So far, so good. Now I want to change this to use an actual service reference. After adding the reference and typing MyCompany.Services.MyProduct in the namespace textbox, it generates classes in the namespace MyCompany.MyProduct.MyCompany.Services.MyProduct. BAD! I don't want to have to change using directives in several places just because I'm using a proxy class. So I tried prepending the namespace with global::, but that is not accepted. Note that I hadn't even deleted the original assembly references yet, and "reuse types" is enabled, but no reusing was done, apparently. However, I don't want to keep the assembly references around in my sample website for it to work anyway. The only solution I've come up with so far is setting the default namespace for my web application to MyCompany (because it cannot be empty), and adding the service reference as Services.MyProduct. Suppose that a customer wants to use my sample website as a starting point, and they change the default namespace to OtherCompany.Whatever, this will obviously break my workaround. Is there a good solution to this problem? To summarize: I want to generate a service reference proxy in the original namespace, without referencing the assembly. Note: I have seen this question, but there was no solution provided that is acceptable for my use case. Edit: As John Saunders suggested, I've submitted some feedback to Microsoft about this: Feedback item @ Microsoft Connect

    Read the article

  • Only root object on request is deserialized when using Message.GetBody<>

    - by user324627
    I am attempting to create a wcf service that accepts any input (Action="*") and then deserialize the message after determining its type. For the purposes of testing deserialization I am currently hard-coding the type for the test service. I get no errors from the deserialization process, but only the outer object is populated after deserialization occurs. All inner fields are null. I can process the same request against the original wcf service successfully. I am deserializing this way, where knownTypes is a type list of expected types: DataContractSerializer ser = new DataContractSerializer(new createEligibilityRuleSet ().GetType(), knownTypes); createEligibilityRuleSet newReq = buf.CreateMessage().GetBody<createEligibilityRuleSet>(ser); Here is the class and sub-classes of the request object. These classes are generated by svcutil using a top down approach from an existing wsdl. I have tried replacing the XmlTypeAttributes with DataContracts and the XmlElements with DataMembers with no difference. It is the instance of CreateEligibilityRuleSetSvcRequest on the createEligibilityRuleSet object that is null. I have included the request retrieved from the request at the bottom /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.2152")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://RulesEngineServicesLibrary/RulesEngineServices")] public partial class createEligibilityRuleSet { private CreateEligibilityRuleSetSvcRequest requestField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true, Order = 0)] public CreateEligibilityRuleSetSvcRequest request { get { return this.requestField; } set { this.requestField = value; } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.2152")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://RulesEngineServicesLibrary")] public partial class CreateEligibilityRuleSetSvcRequest : RulesEngineServicesSvcRequest { private string requestField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 0)] public string request { get { return this.requestField; } set { this.requestField = value; } } } [System.Xml.Serialization.XmlIncludeAttribute(typeof(CreateEligibilityRuleSetSvcRequest))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(ApplyMemberEligibilitySvcRequest))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(CreateCompletionCriteriaRuleSetSvcRequest))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(CopyRuleSetSvcRequest))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(DeleteRuleSetByIDSvcRequest))] [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.2152")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://RulesEngineServicesLibrary")] public partial class RulesEngineServicesSvcRequest : ServiceRequest { } /// <remarks/> [System.Xml.Serialization.XmlIncludeAttribute(typeof(RulesEngineServicesSvcRequest))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(CreateEligibilityRuleSetSvcRequest))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(ApplyMemberEligibilitySvcRequest))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(CreateCompletionCriteriaRuleSetSvcRequest))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(CopyRuleSetSvcRequest))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(DeleteRuleSetByIDSvcRequest))] [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.2152")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://FELibrary")] public partial class ServiceRequest { private string applicationIdField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 0)] public string applicationId { get { return this.applicationIdField; } set { this.applicationIdField = value; } } } Request from client comes on Message body as below. Retrieved from Message at runtime. <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:rul="http://RulesEngineServicesLibrary/RulesEngineServices"> <soap:Header/> <soap:Body> <rul:createEligibilityRuleSet> <request> <applicationId>test</applicationId> <request>Perf Rule Set1</request> </request> </rul:createEligibilityRuleSet> </soap:Body> </soap:Envelope>

    Read the article

  • wcf metadata service page url

    - by Neil B
    I have a service with the metadata exposed. Trouble is when I browse to the wsdl the service page it has the machine name as below: MasterLibrary Service You have created a service. To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: svcutil.exe http://mymachine/Master/Master.svc?wsdl How do I make it show it as: http://www.url.co.uk/Master/Master.svc?wsdl

    Read the article

  • How to create a new WCF/MVC/jQuery application from scratch

    - by pjohnson
    As a corporate developer by trade, I don't get much opportunity to create from-the-ground-up web sites; usually it's tweaks, fixes, and new functionality to existing sites. And with hobby sites, I often don't find the challenges I run into with enterprise systems; usually it's starting from Visual Studio's boilerplate project and adding whatever functionality I want to play around with, rarely deploying outside my own machine. So my experience creating a new enterprise-level site was a bit dated, and the technologies to do so have come a long way, and are much more ready to go out of the box. My intention with this post isn't so much to provide any groundbreaking insights, but to just tie together a lot of information in one place to make it easy to create a new site from scratch. Architecture One site I created earlier this year had an MVC 3 front end and a WCF 4-driven service layer. Using Visual Studio 2010, these project types are easy enough to add to a new solution. I created a third Class Library project to store common functionality the front end and services layers both needed to access, for example, the DataContract classes that the front end uses to call services in the service layer. By keeping DataContract classes in a separate project, I avoided the need for the front end to have an assembly/project reference directly to the services code, a bit cleaner and more flexible of an SOA implementation. Consuming the service Even by this point, VS has given you a lot. You have a working web site and a working service, neither of which do much but are great starting points. To wire up the front end and the services, I needed to create proxy classes and WCF client configuration information. I decided to use the SvcUtil.exe utility provided as part of the Windows SDK, which you should have installed if you installed VS. VS also provides an Add Service Reference command since the .NET 1.x ASMX days, which I've never really liked; it creates several .cs/.disco/etc. files, some of which contained hardcoded URL's, adding duplicate files (*1.cs, *2.cs, etc.) without doing a good job of cleaning up after itself. I've found SvcUtil much cleaner, as it outputs one C# file (containing several proxy classes) and a config file with settings, and it's easier to use to regenerate the proxy classes when the service changes, and to then maintain all your configuration in one place (your Web.config, instead of the Service Reference files). I provided it a reference to a copy of my common assembly so it doesn't try to recreate the data contract classes, had it use the type List<T> for collections, and modified the output files' names and .NET namespace, ending up with a command like: svcutil.exe /l:cs /o:MyService.cs /config:MyService.config /r:MySite.Common.dll /ct:System.Collections.Generic.List`1 /n:*,MySite.Web.ServiceProxies http://localhost:59999/MyService.svc I took the generated MyService.cs file and drop it in the web project, under a ServiceProxies folder, matching the namespace and keeping it separate from classes I coded manually. Integrating the config file took a little more work, but only needed to be done once as these settings didn't often change. A great thing Microsoft improved with WCF 4 is configuration; namely, you can use all the default settings and not have to specify them explicitly in your config file. Unfortunately, SvcUtil doesn't generate its config file this way. If you just copy & paste MyService.config's contents into your front end's Web.config, you'll copy a lot of settings you don't need, plus this will get unwieldy if you add more services in the future, each with its own custom binding. Really, as the only mandatory settings are the endpoint's ABC's (address, binding, and contract) you can get away with just this: <system.serviceModel>  <client>    <endpoint address="http://localhost:59999/MyService.svc" binding="wsHttpBinding" contract="MySite.Web.ServiceProxies.IMyService" />  </client></system.serviceModel> By default, the services project uses basicHttpBinding. As you can see, I switched it to wsHttpBinding, a more modern standard. Using something like netTcpBinding would probably be faster and more efficient since the client & service are both written in .NET, but it requires additional server setup and open ports, whereas switching to wsHttpBinding is much simpler. From an MVC controller action method, I instantiated the client, and invoked the method for my operation. As with any object that implements IDisposable, I wrapped it in C#'s using() statement, a tidy construct that ensures Dispose gets called no matter what, even if an exception occurs. Unfortunately there are problems with that, as WCF's ClientBase<TChannel> class doesn't implement Dispose according to Microsoft's own usage guidelines. I took an approach similar to Technology Toolbox's fix, except using partial classes instead of a wrapper class to extend the SvcUtil-generated proxy, making the fix more seamless from the controller's perspective, and theoretically, less code I have to change if and when Microsoft fixes this behavior. User interface The MVC 3 project template includes jQuery and some other common JavaScript libraries by default. I updated the ones I used to the latest versions using NuGet, available in VS via the Tools > Library Package Manager > Manage NuGet Packages for Solution... > Updates. I also used this dialog to remove packages I wasn't using. Given that it's smart enough to know the difference between the .js and .min.js files, I was hoping it would be smart enough to know which to include during build and publish operations, but this doesn't seem to be the case. I ended up using Cassette to perform the minification and bundling of my JavaScript and CSS files; ASP.NET 4.5 includes this functionality out of the box. The web client to web server link via jQuery was easy enough. In my JavaScript function, unobtrusively wired up to a button's click event, I called $.ajax, corresponding to an action method that returns a JsonResult, accomplished by passing my model class to the Controller.Json() method, which jQuery helpfully translates from JSON to a JavaScript object.$.ajax calls weren't perfectly straightforward. I tried using the simpler $.post method instead, but ran into trouble without specifying the contentType parameter, which $.post doesn't have. The url parameter is simple enough, though for flexibility in how the site is deployed, I used MVC's Url.Action method to get the URL, then sent this to JavaScript in a JavaScript string variable. If the request needed input data, I used the JSON.stringify function to convert a JavaScript object with the parameters into a JSON string, which MVC then parses into strongly-typed C# parameters. I also specified "json" for dataType, and "application/json; charset=utf-8" for contentType. For success and error, I provided my success and error handling functions, though success is a bit hairier. "Success" in this context indicates whether the HTTP request succeeds, not whether what you wanted the AJAX call to do on the web server was successful. For example, if you make an AJAX call to retrieve a piece of data, the success handler will be invoked for any 200 OK response, and the error handler will be invoked for failed requests, e.g. a 404 Not Found (if the server rejected the URL you provided in the url parameter) or 500 Internal Server Error (e.g. if your C# code threw an exception that wasn't caught). If an exception was caught and handled, or if the data requested wasn't found, this would likely go through the success handler, which would need to do further examination to verify it did in fact get back the data for which it asked. I discuss this more in the next section. Logging and exception handling At this point, I had a working application. If I ran into any errors or unexpected behavior, debugging was easy enough, but of course that's not an option on public web servers. Microsoft Enterprise Library 5.0 filled this gap nicely, with its Logging and Exception Handling functionality. First I installed Enterprise Library; NuGet as outlined above is probably the best way to do so. I needed a total of three assembly references--Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, and Microsoft.Practices.EnterpriseLibrary.Logging. VS links with the handy Enterprise Library 5.0 Configuration Console, accessible by right-clicking your Web.config and choosing Edit Enterprise Library V5 Configuration. In this console, under Logging Settings, I set up a Rolling Flat File Trace Listener to write to log files but not let them get too large, using a Text Formatter with a simpler template than that provided by default. Logging to a different (or additional) destination is easy enough, but a flat file suited my needs. At this point, I verified it wrote as expected by calling the Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write method from my C# code. With those settings verified, I went on to wire up Exception Handling with Logging. Back in the EntLib Configuration Console, under Exception Handling, I used a LoggingExceptionHandler, setting its Logging Category to the category I already had configured in the Logging Settings. Then, from code (e.g. a controller's OnException method, or any action method's catch block), I called the Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException method, providing the exception and the exception policy name I had configured in the Exception Handling Settings. Before I got this configured correctly, when I tried it out, nothing was logged. In working with .NET, I'm used to seeing an exception if something doesn't work or isn't set up correctly, but instead working with these EntLib modules reminds me more of JavaScript (before the "use strict" v5 days)--it just does nothing and leaves you to figure out why, I presume due in part to the listener pattern Microsoft followed with the Enterprise Library. First, I verified logging worked on its own. Then, verifying/correcting where each piece wires up to the next resolved my problem. Your C# code calls into the Exception Handling module, referencing the policy you pass the HandleException method; that policy's configuration contains a LoggingExceptionHandler that references a logCategory; that logCategory should be added in the loggingConfiguration's categorySources section; that category references a listener; that listener should be added in the loggingConfiguration's listeners section, which specifies the name of the log file. One final note on error handling, as the proper way to handle WCF and MVC errors is a whole other very lengthy discussion. For AJAX calls to MVC action methods, depending on your configuration, an exception thrown here will result in ASP.NET'S Yellow Screen Of Death being sent back as a response, which is at best unnecessarily and uselessly verbose, and at worst a security risk as the internals of your application are exposed to potential hackers. I mitigated this by overriding my controller's OnException method, passing the exception off to the Exception Handling module as above. I created an ErrorModel class with as few properties as possible (e.g. an Error string), sending as little information to the client as possible, to both maximize bandwidth and mitigate risk. I then return an ErrorModel in JSON format for AJAX requests: if (filterContext.HttpContext.Request.IsAjaxRequest()){    filterContext.Result = Json(new ErrorModel(...));    filterContext.ExceptionHandled = true;} My $.ajax calls from the browser get a valid 200 OK response and go into the success handler. Before assuming everything is OK, I check if it's an ErrorModel or a model containing what I requested. If it's an ErrorModel, or null, I pass it to my error handler. If the client needs to handle different errors differently, ErrorModel can contain a flag, error code, string, etc. to differentiate, but again, sending as little information back as possible is ideal. Summary As any experienced ASP.NET developer knows, this is a far cry from where ASP.NET started when I began working with it 11 years ago. WCF services are far more powerful than ASMX ones, MVC is in many ways cleaner and certainly more unit test-friendly than Web Forms (if you don't consider the code/markup commingling you're doing again), the Enterprise Library makes error handling and logging almost entirely configuration-driven, AJAX makes a responsive UI more feasible, and jQuery makes JavaScript coding much less painful. It doesn't take much work to get a functional, maintainable, flexible application, though having it actually do something useful is a whole other matter.

    Read the article

1 2 3  | Next Page >