Facebook   Twitter    e-mail newsletter    YouTube    RSS Feed    Android App    iPhone and iPad App     BlackBerry App    


Results 1 to 3 of 3

Thread: Please help me set up my WCF for .Net.

  1. #1

    Default Please help me set up my WCF for .Net.

    For starters, I should state that I'm fairly clueless on this topic.

    I have a website that references a web service, using basicHttpBinding.

    If I have methods that return XML as string, everything works fine, but as soon as I try to add my own custom object to use for data transfer, nothing works. I have checked the code against the MSDN library, and it seems correct.

    Is there something I'm missing here?


    Code:
        [ServiceContract]
        public interface IUploadService
        {
            [OperationContract]
            string ReturnNewOrder(string OrderKey);
    
            [OperationContract]
            Document GetAnOrder();
        }
    
            [DataContract]
            public class Document
            {
                private string _doccode;
    
                [DataMember]
                public string Doccode
                {
                    get { return _doccode; }
                    set { _doccode = value; }
                }
    
                private List<DocumentLine> _lines;
    
                [DataMember]
                public List<DocumentLine> Lines
                {
                    get { return _lines; }
                    set { _lines = value; }
                }
            }
    
            [DataContract]
            public class DocumentLine
            {
                private string _itemcode;
    
                [DataMember]
                public string ItemCode
                {
                    get { return _itemcode; }
                    set { _itemcode = value; }
                }
    
                private int _quantity;
    
                [DataMember]
                public int Quantity
                {
                    get { return _quantity; }
                    set { _quantity = value; }
                }
            }

    The error only appears when I compile the website's code:

    Code:
    Error	14	Reference.svcmap: Failed to generate code for the service reference 'UploadService'.  Cannot import wsdl:portType  Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter  Error: Could not load file or assembly 'xxx.dll, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.  XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IUploadService']  Cannot import wsdl:binding  Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.  XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IUploadService']  XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='basicHttpBinding']  Cannot import wsdl:port  Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.  XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='basicHttpBinding']  XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='UploadService']/wsdl:port[@name='basicHttpBinding']	App_WebReferences/UploadService/
    Librarian - The original search engine

  2. #2

    Default

    /tries to give thread some CPR...
    Librarian - The original search engine

  3. #3

    Default

    When you add the Service Reference, open the Advanced dialog and uncheck the 'Re-use types in referenced assemblies' checkbox.

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •