Link to home
Start Free TrialLog in
Avatar of robespierre_2010
robespierre_2010

asked on

simple question: SOAP, ASP.NET and C#

Hi,

I want to use the following web service:

http://www.webservicex.net/medicareSupplier.asmx

For that, I have added a web reference in VWD 2008 express. In my C# code behind I have added the following code:

        medicare.MediCareSupplier mc = new medicare.MediCareSupplier();

I want to display the results for one specific zip code, so I make the call by doing something like this:

mc.GetSupplierByZipCode("10016", ...);

but the method requires a second input parameter. I cannot get this second parameter right. The second argument is supposed to be "out medicare.SupplierDataList"

I am sure this is a simple SOPA issue that has to do with the second parameter being of List type, but as I do not know much about C# I am lost. Any valuable help will be most welcome.

Thanks and regards.


Avatar of HainKurt
HainKurt
Flag of Canada image

when you call it with a string parameter, what do you get

String supList;
Bool resOK;
resOK = mc.GetSupplierByZipCode("10016", supList);

what do you get as supList?
Avatar of robespierre_2010
robespierre_2010

ASKER

I cannot call it because there are the following compilation errors:

cannot convert from string to 'out medicare.SupplierDataList'

try this

medicare.SupplierDataList supList;
Bool resOK;
resOK = mc.GetSupplierByZipCode("10016", supList);

that is not giving errors but how do I display the result of the call?
loop all items

foreach (medicare.SupplierData s in supList) {
  Response.Write("<li>SupplierNumber : " + s.SupplierNumber);
  Response.Write("<li>CompanyName: " + s.CompanyName);
...
}

not sure abouth the structure, you should check the classes in medicare
this does it, unless you have a better suggestion

          for (int i = 0; i < supList.TotalRecords; i++)
          {
              Response.Write("<li>SupplierDatas[i].CompanyName : " + supList.SupplierDatas[i].CompanyName);
          }
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks