Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3671940
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:32:55+00:00 2026-05-19T02:32:55+00:00

In my WCF service I have method with ‘int’ parameter: [OperationContract] PublishResult PublishEnrollmentProfile( string

  • 0

In my WCF service I have method with ‘int’ parameter:

    [OperationContract]
    PublishResult PublishEnrollmentProfile(
        string siteName, int methodId,...
        );

When I created WebService reference to this WCF service the following signature was generated:

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("...",
        RequestNamespace="...", ResponseNamespace="...",
        Use=System.Web.Services.Description.SoapBindingUse.Literal,
        ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public PublishResult PublishEnrollmentProfile(
        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
        string siteName,
        int methodId,
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        bool methodIdSpecified, ...)
    {
        object[] results = this.Invoke("PublishEnrollmentProfile", new object[] {
                    siteName,
                    deployServerName,
                    methodId,
                    methodIdSpecified,
                    deviceClass,
                    deviceName,
                    registrationCode});
        return ((PublishResult)(results[0]));
    }

You can see that instead of one integer parameter I’ve got 2: integer (for value) and bool (for mark ‘if value was specified).

Is this ok? Why do I need the 2nd parameter (bool)?

Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:32:55+00:00Added an answer on May 19, 2026 at 2:32 am

    Specified” fields are only generated on optional parameters that are structs. (int, datetime, decimal etc). All such variables will have additional variable generated with the name Specified.

    Since the “Specified” fields are only generated on optional parameters, if you placed the parameters for the PublishEnrollmentProfile method inside of a DataContract and set the DataMember attribute on methodID to [DataMember(IsRequired=true)] the specified field should go away, unless this is an optional field in which case you would want to leave it how it is.

    Here’s a blog posting with some samples.

    UPDATE

    So you have your Operation Contract.

    [OperationContract]
    PublishResult PublishEnrollmentProfile(string siteName, int methodId,...);
    

    If the parameters of that method are not optional then you should create a DataContract and redefine the OperationContract like so:

    {
       [OperationContract]
       PublishResult PublishEnrollmentProfile(PublishEnrollmentProfileRequest request);
    }
    

    And then you have your DataContract like this.

    [DataContract]
    public class PublishEnrollmentProfileRequest
    {
        private string _siteName;
        [DataMember]
        public string siteName
        {
           get;
           set;
        }
    
    
        private int _methodId;
        [DataMember(IsRequired=True)]
        public int methodId
        {
           get;
           set;
        }
    
        .
        .
        .
    
    } 
    

    So you have a “request” object that you pass into the WCF service which has fields siteName and methodId. In the example I provided methodId is now required, this would elminate the “Specified” field.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple WCF service method: [OperationContract] public SetupGameResult SetupGame(long player1Id, long player2Id,
I have a WCF Service that exposes a method GetCustomers(). The internals of the
Hi I want to create a WCF service that have login method, which is
I have method: var listOfFiles=service .GetFiles(pathsOfFiles.ToArray(); service is my wcf service with streaming ,and
I have a method in a WCF service which returns a complex type (myComplexResult),
I have a WCF service that accepts an object as a parameter that has
I have a WCF service, in it i have a method that takes a
I have a desktop app I authenticate using the wcf authentication service login method,
I'm hosting my first WCF service in IIS. I have two methods, 1 to
How many ServiceContracts can a WCF service have? Specifically, since a ServiceContract is an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.