views:

382

answers:

3

Using C#, I am attempting to consume a web service that was created in Java and deployed on a WebLogic server. I am using VS 2008 and have created an ASP.NET Web Site. I added the service as a web reference and it appears that the classes are available. I attempt to consume the service with the following code:

    ShippingApplicationService ship = new ShippingApplicationService();
    CollectionPlanInfo cp = ship.getCollectionPlanInfo("TEST1","122");

The web site builds successfully. However, when I run the above code I receive the following error:

InvalidOperationException was unhandled by user code
Unable to generate a temporary class (result=1).
error CS0029: Cannot implicitly convert type 'string' to 'string[]'

A: 

It's impossible to know without looking at the generated proxy. But may be ship.getCollectionPlanInfo(..) is expecting an string[] (or variable arguments). Try

CollectionPlanInfo cp = ship.getCollectionPlanInfo(string[] { "TEST1","122" });

Again... I'm totally guessing here... b/c I don't have the proxy.

Nestor
Sorry, I wasn't clear. The error is on the first line of code: ShippingApplicationService ship = new ShippingApplicationService();
Ted
A: 

The browser provided some more meaningful information. The following is what is provided as the Source Error:

Line 43:         public ShippingApplicationService() {
Line 44:             string urlSetting = System.Configuration.ConfigurationManager.AppSettings["Service.Client.ShippingApplicationServiceDefinitions"];
Line 45:             if ((urlSetting != null)) {

The error is in Line 43.

Ted
A: 

The error is in line 43 only because it is appering in Constructor of webservice during temporary class generation.

This error occured because you have a field (or property) of Array type, which have wrong definition, you should try to change it (if it is possible) or change the wsdl of service.

Sorry for my English :)

VMAtm
http://www.kerrywong.com/2006/11/04/xml-serialization-surprise-in-vs-2005/Same problem solution
VMAtm