I'm working on a *soap message *to send to a client system.

I must use the client's predefined data types specified on their soap to send my message.

Theres alot of arrays and enumerators used and my code gives the following error:

Error 1 Cannot implicitly convert type 'UpdateRatePs._Default.Rate.AvailAppType' to 'UpdateRatePs.IService.AvailAppType?'.
An explicit conversion exists (are you missing a cast?)

Upon investigation of the error I found that it is basically telling me that the data types in my code and the webservice are different but I'm not able to figure out how or where the discrepnacy lies because they look the same to me.

I have looked everywhere to fix this problem, even posted on a couple of forums to no avail.

I've looked up on everything to do with enumerators, even in web service, in arrays as well as converting enumerators to arrays.

Tried all the examples suggested.

Nothing works.

The error is still the same.

Also tried the Parse and tryParse methods for enum conversions with no luck

Here is a portion of my code where the error points:

 protected void SendSoapMessage()
 {

  Rate.AvailabilityApplicationType val  =  Rate.AvailAppType.SET;
  ureq.RatePackages[1].Rates[0].AvailAppType = val;
ureq is UpdateRatePs method from the webservice I am sending to

Classes/ Objects defined below from webservice data structure:

public class UpdateRatePs
{
 public string Username;
 public string Password;
 public UpdateRateP[] RatePackages;
}

    public class UpdateRateP
    {
        public Int64 RatePackageId;
        public Rate[] Rates;

    }


    public class Rate
    {


        public enum AvailAppType { SET , INCREASE, DECREASE };


    }

Can somebody please help me fix this.

Found the answer:

ureq.RatePackages[1].Rates[0].AvailAppType=UpdateRatePs.IService.AvailAppType.SET
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.