RE: [Axis2] Problem with C# client accessing a Web Service
Hi Raghu, My problem is opposite to yours. My C# is working fine but I m stuck with java client code. I am putting my c# code here for you. See if it can help you out. Code is: XmlSerializer mySerializer; try { StreamReader sr = new StreamReader(@C:\AirdHouse.xml); XmlTextReader xmlTextReader = new XmlTextReader(sr); mySerializer = new XmlSerializer(typeof(Product)); Product pViewupdate= (Product) mySerializer.Deserialize(xmlTextReader); AbstractView av = prodServ.AddProduct(pViewupdate); mySerializer = null; } catch(Exception ex) { //Handle exceptions } Raghu, can you put the equivalent java code here. Thanks in advance. Thanks Best Regards, Sudhir Sharma _ From: Raghu Upadhyayula [mailto:[EMAIL PROTECTED] Sent: Friday, October 26, 2007 10:25 PM To: axis-user@ws.apache.org Subject: RE: [Axis2] Problem with C# client accessing a Web Service Hi Sudhir, I figured out the problem but don't really know how to solve it. Looks like the wsdl.exe tool I'm using has a bug. It creates a two-dimensional string array if the wsdl has nested elements that contains maxOccurs=unbounded. In my WSDL I have the elements defined as follows. complexType name=RecordData sequence element maxOccurs=unbounded name=fieldNames nillable=true type=xsd:string/ element maxOccurs=unbounded name=records nillable=true type=tns:Record/ /sequence /complexType complexType name=Record sequence element maxOccurs=unbounded name=fieldValues nillable=true type=xsd:string/ /sequence /complexType In the service class, this structure is generated as follows., observe that the records field is created as a string[][] instead or Record[] /// remarks/ [System.CodeDom.Compiler.GeneratedCodeAttribute(wsdl, 2.0.50727.42)] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute(code)] [System.Xml.Serialization.XmlTypeAttribute(Namespace=urn:ws.rsys.com)] public partial class RecordData { private string[] fieldNamesField; private string[][] recordsField; /// remarks/ [System.Xml.Serialization.XmlElementAttribute(fieldNames, IsNullable=true)] public string[] fieldNames { get { return this.fieldNamesField; } set { this.fieldNamesField = value; } } /// remarks/ [System.Xml.Serialization.XmlArrayAttribute(IsNullable=true)] [System.Xml.Serialization.XmlArrayItemAttribute(fieldValues, typeof(string))] public string[][] records { get { return this.recordsField; } set { this.recordsField = value; } } } Thanks Raghu _ From: Sudhir Sharma [mailto:[EMAIL PROTECTED] Sent: Thursday, October 25, 2007 10:06 PM To: axis-user@ws.apache.org Subject: RE: [Axis2] Problem with C# client accessing a Web Service Hi Raghu, Can u put your code (java and C#) here so that we can check and compare them to find out the loop holes. Thanks Best Regards, Sudhir Sharma _ From: Raghu Upadhyayula [mailto:[EMAIL PROTECTED] Sent: Friday, October 26, 2007 4:09 AM To: axis-user@ws.apache.org Subject: [Axis2] Problem with C# client accessing a Web Service Hi, I have a webservice developed using Axis2 1.3. I wrote a Java client to access this webservice and everything is working fine. Today I started writing a C# client to access the same webservice. I've used the wsdl.exe tool that comes with Microsoft Visual Studio to generate the client code and wrote my own class to access methods in the web service. Now when I try to run the C# client, I'm getting the below exception. at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence) at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters
RE: [Axis2] Problem with C# client accessing a Web Service
Hi Sudhir, I figured out the problem but don't really know how to solve it. Looks like the wsdl.exe tool I'm using has a bug. It creates a two-dimensional string array if the wsdl has nested elements that contains maxOccurs=unbounded. In my WSDL I have the elements defined as follows. complexType name=RecordData sequence element maxOccurs=unbounded name=fieldNames nillable=true type=xsd:string/ element maxOccurs=unbounded name=records nillable=true type=tns:Record/ /sequence /complexType complexType name=Record sequence element maxOccurs=unbounded name=fieldValues nillable=true type=xsd:string/ /sequence /complexType In the service class, this structure is generated as follows., observe that the records field is created as a string[][] instead or Record[] /// remarks/ [System.CodeDom.Compiler.GeneratedCodeAttribute(wsdl, 2.0.50727.42)] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute(code)] [System.Xml.Serialization.XmlTypeAttribute(Namespace=urn:ws.rsys.com)] public partial class RecordData { private string[] fieldNamesField; private string[][] recordsField; /// remarks/ [System.Xml.Serialization.XmlElementAttribute(fieldNames, IsNullable=true)] public string[] fieldNames { get { return this.fieldNamesField; } set { this.fieldNamesField = value; } } /// remarks/ [System.Xml.Serialization.XmlArrayAttribute(IsNullable=true)] [System.Xml.Serialization.XmlArrayItemAttribute(fieldValues, typeof(string))] public string[][] records { get { return this.recordsField; } set { this.recordsField = value; } } } Thanks Raghu From: Sudhir Sharma [mailto:[EMAIL PROTECTED] Sent: Thursday, October 25, 2007 10:06 PM To: axis-user@ws.apache.org Subject: RE: [Axis2] Problem with C# client accessing a Web Service Hi Raghu, Can u put your code (java and C#) here so that we can check and compare them to find out the loop holes. Thanks Best Regards, Sudhir Sharma From: Raghu Upadhyayula [mailto:[EMAIL PROTECTED] Sent: Friday, October 26, 2007 4:09 AM To: axis-user@ws.apache.org Subject: [Axis2] Problem with C# client accessing a Web Service Hi, I have a webservice developed using Axis2 1.3. I wrote a Java client to access this webservice and everything is working fine. Today I started writing a C# client to access the same webservice. I've used the wsdl.exe tool that comes with Microsoft Visual Studio to generate the client code and wrote my own class to access methods in the web service. Now when I try to run the C# client, I'm getting the below exception. at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence) at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies) at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type) at System.Web.Services.Protocols.SoapClientType..ctor(Type type) at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor() at WSCSharpClient.ResponsysWSService..ctor() at WSCSharpClient.TestResponsysWS.login() at WSCSharpClient.TestResponsysWS.run() Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'string[]' to 'string' error CS0029: Cannot implicitly convert type 'string' to 'string[]' Does anyone have an idea what the problem is or am I missing anything else? Thanks in Advance. Raghu
RE: [Axis2] Problem with C# client accessing a Web Service
Hi Raghu, Can u put your code (java and C#) here so that we can check and compare them to find out the loop holes. Thanks Best Regards, Sudhir Sharma _ From: Raghu Upadhyayula [mailto:[EMAIL PROTECTED] Sent: Friday, October 26, 2007 4:09 AM To: axis-user@ws.apache.org Subject: [Axis2] Problem with C# client accessing a Web Service Hi, I have a webservice developed using Axis2 1.3. I wrote a Java client to access this webservice and everything is working fine. Today I started writing a C# client to access the same webservice. I've used the wsdl.exe tool that comes with Microsoft Visual Studio to generate the client code and wrote my own class to access methods in the web service. Now when I try to run the C# client, I'm getting the below exception. at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence) at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies) at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type) at System.Web.Services.Protocols.SoapClientType..ctor(Type type) at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor() at WSCSharpClient.ResponsysWSService..ctor() at WSCSharpClient.TestResponsysWS.login() at WSCSharpClient.TestResponsysWS.run() Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'string[]' to 'string' error CS0029: Cannot implicitly convert type 'string' to 'string[]' Does anyone have an idea what the problem is or am I missing anything else? Thanks in Advance. Raghu