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

  • Home
  • SEARCH
  • 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 165963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:00:53+00:00 2026-05-11T12:00:53+00:00

I am trying to pass an array of a simple object to a web

  • 0

I am trying to pass an array of a simple object to a web service and I’m really stuck on this error during compile of my web client project:

Cannot implicitly convert type ‘TRIMBrokerUtil.MetaData[]’ to ‘TRIMBrokerASMXProxy.ASMXProxy.MetaData[]’

Here is my ‘utility’ project compiled into TRIMBrokerUtil.dll:

namespace TRIMBrokerUtil {     public class MetaData     {     protected string _Name;     protected string _Value;     public MetaData(string keyword, string setting)      {         this.Name = keyword;         this.Value = setting;     }     public string Name     {         get         {         return this._Name;         }         set         {         Name = value;         }     }     public string Value     {         get         {         return this._Value;         }         set         {         _Value = value;         }     }     } 

Here is a snippet of the web service which also compiles fine: using TRIMBrokerUtil; namespace TRIMBrokerService { [WebService(Namespace = ‘http://tempuri.org/‘)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] public class FileService : System.Web.Services.WebService {

    [WebMethod]     public string UploadFile(byte[] incomingArray         , string FileName         , long FileLengthInBytes         , MetaData[] metaDataArray)     { 

…and usage later as this:

Update update = BuildMetaData(metaDataArray); 

…and this:

private Update BuildMetaData(MetaData[] nvPairs) {     Update update = new Update();     InputProperty[] ip = new InputProperty[nvPairs.Length];     int i;     for (i=0; i < nvPairs.Length; i++)     {     ip[i].Name = 'udf:' + nvPairs[i].Name;     ip[i].Val = nvPairs[i].Value;     }     update.Items = ip;     return update; } 

Next, (via ‘Add Web Reference’) I have my proxy class for the ASMX webservice in a separate project and it compiles without problem. Inside the generated reference.cs file I find this which seems OK:

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute('http://tempuri.org/UploadFile', RequestNamespace='http://tempuri.org/', ResponseNamespace='http://tempuri.org/', Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]     public string UploadFile([System.Xml.Serialization.XmlElementAttribute(DataType='base64Binary')] byte[] incomingArray, string FileName, long FileLengthInBytes, MetaData[] metaDataArray) {         object[] results = this.Invoke('UploadFile', new object[] {                     incomingArray,                     FileName,                     FileLengthInBytes,                     metaDataArray});         return ((string)(results[0]));     } 

Now for the error that occurs in compilation in the web client project (default.aspx.cs):

    using TRIMBrokerUtil;  public partial class _Default : System.Web.UI.Page {     private void UploadFile(HttpPostedFile postedFile                 , string fileNameOnly                 , MetaData[] metaDataArray)     {         string strURI = string.Empty;         TRIMBrokerASMXProxy.ASMXProxy.FileService client = new TRIMBrokerASMXProxy.ASMXProxy.FileService();         BinaryReader b = new BinaryReader(postedFile.InputStream);         byte[] binData = b.ReadBytes(numBytes);         TRIMBrokerASMXProxy.ASMXProxy.MetaData[] kvData = metaDataArray; // error complains about this line         strURI = client.UploadFile(binData, fileNameOnly, binData.Length, kvData ); 

I have also tried changing the last 2 lines above to simply this one line:

strURI = client.UploadFile(binData, fileNameOnly, binData.Length, metaDataArray); 

…but that change introduces a 2nd error from the compiler which reads as:

The best overloaded method match for ‘TRIMBrokerASMXProxy.ASMXProxy.FileService.UploadFile(byte[], string, long, TRIMBrokerASMXProxy.ASMXProxy.MetaData[])’ has some invalid arguments

(note the original error about ‘cannot convert’ is the 2nd error).

Sorry about being so verbose above. Hope you can help shed light on this confusion.

  • 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. 2026-05-11T12:00:53+00:00Added an answer on May 11, 2026 at 12:00 pm

    You are trying to assign an array of TRIMBrokerUtil.MetaData to an array of TRIMBrokerASMXProxy.ASMXProxy.MetaData. Remember that the asp.net proxy declares its own type.

    Just copy the data into a new array with the proxy type.

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

Sidebar

Ask A Question

Stats

  • Questions 249k
  • Answers 249k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer That's what egg files are for. Read this: What are… May 13, 2026 at 9:00 am
  • Editorial Team
    Editorial Team added an answer Just use the javax.crypto and java.security packages. It's in the… May 13, 2026 at 9:00 am
  • Editorial Team
    Editorial Team added an answer $batchId = 2345; $code = 'AA1#'; $code = preg_replace( "/[A-Za-z]{2,4}[\d\_]{1,5}[\.YRCc]{0,4}[\#\&\@\^]{0,2}/e",… May 13, 2026 at 9:00 am

Related Questions

I am trying to make a simple redirector controller in CakePHP. I'd like the
I am trying to get some C++ code originally written in Microsoft Visual Studio
Previously, I ran into a problem trying to share a type definition between my
Alright here's the situation, I have an application written in the Zend_Framework, that is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.