Re: Issue with Axis when sending abstract class to .NET webservice
Can some please help, I have a same problem but once again: server side (web service in c#): public abstract class CatalogValue { public int id; public CatalogValue next; public CatalogValue() { } } public class CatalogValueImpl : CatalogValue //Linked list { public string name; public CatalogValueImpl() { this.next = null; } } public class DataSource { public CatalogValue value; public DataSource() { } } Now the main mistery: this two calls work fine [WebMethod] public CatalogValue getCat() { CatalogValueImpl i = new CatalogValueImpl(); i.name = jhjhfdajd; return i; } [WebMethod] public CatalogValue updateCat(CatalogValue c) { c.id = -1; return c; } BUT why this two call dont work: [XmlInclude(typeof(CatalogValueImpl))] [WebMethod] public DataSource get() { DataSource ds = new DataSource(); ds.init(); return ds; } [XmlInclude(typeof(CatalogValue))] [XmlInclude(typeof(CatalogValueImpl))] [WebMethod] public DataSource update(DataSource value) { value = new DataSource(); value.init(); return value; } Just to say that on client side (client is in java, and I'm using axis 1.3) data that I getting from the server is correct, but when I try to call update(DataSource value) I get following error: xisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client faultSubcode: faultString: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---gt; System.InvalidOperationException: There is an error in XML document (1, 272). ---gt; System.InvalidOperationException: The specified type is abstract: name='CatalogValue', namespace='http://tempuri.org/', at lt;value xmlns='http://tempuri.org/'gt;. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read2_CatalogValue(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read4_DataSource(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read9_update() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer8.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() --- End of inner exception stack trace --- at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() Sorry for any typing mistake, one my arm is broken. Please Help I need solution for this. -- View this message in context: http://www.nabble.com/Issue-with-Axis-when-sending-abstract-class-to-.NET-webservice-tf3326681.html#a12449320 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Issue with Axis when sending abstract class to .NET webservice
David, You cannot send an element of an abstract type. Your choices: - don't send the Address/ element (requires minOccurs=0) - define it as a concrete type Anne On 3/1/07, David Elliott [EMAIL PROTECTED] wrote: I am testing some interoperability between a Java Client using Axis and a .NET ASMX Webservice and am experiencing a problem and was wondering if anyone has an idea of what is going on. If I have a class that contains a data member that is abstract and try to pass a derived class type into the webservice, an XML error is generated. If I receive the same exact structure from the webservice all works as expected. I have a full .NET webservice and java client that will demonstrate the issue if anyone wants the code. I am including the soap messages that are received on the service. The class definition follows the SOAP Messages. Thanks, Dave WebbertSolutions[at]hotmail[dot]com Good Message - don't send address in - receive address == - SoapRequest at 2/27/2007 2:01:41 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:41 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body GetAdminResponse xmlns=urn:emp:service GetAdminResult xsi:type=Admin xmlns=urn:emp:data NameHello World/Name Age12/Age Address xsi:type=HomeAddress HouseNumber234 State Street/HouseNumber /Address HasPasswordtrue/HasPassword /GetAdminResult /GetAdminResponse /soap:Body /soap:Envelope Bad Message - populate HomeAddress - send HomeAddress in == - SoapRequest at 2/27/2007 2:01:13 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age ns1:Address / /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:13 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body soap:Fault faultcodesoap:Client/faultcode faultstringSystem.Web.Services.Protocols.SoapException: Server was unable to read request. --- System.InvalidOperationException: There is an error in XML document (1, 353). --- System.InvalidOperationException: The specified type is abstract: name='Address', namespace='urn:emp:data', at Address xmlns='urn:emp:data'. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read5_Address(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read6_Person(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read7_GetAdmin() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() --- End of inner exception stack trace --- at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()/faultstring detail / /soap:Fault /soap:Body /soap:Envelope public abstract class PersonBase { protected PersonBase() { } private string _name; public string Name { get { return ( _name ); } set { _name = value; } } } public class Person : PersonBase { private int _age; private Address _address; public int Age { get { return ( _age ); } set { _age = value; } } public Address Address { get { return ( _address ); } set { _address = value; } } } public abstract class Address { protected Address() { } } public class
RE: Issue with Axis when sending abstract class to .NET webservice
If he uses nillable=true in the Schema, it might work? -jeff -Original Message- From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Friday, March 02, 2007 4:04 PM To: axis-user@ws.apache.org Subject: Re: Issue with Axis when sending abstract class to .NET webservice In the message that generates the fault, you send an empty Address/ element. That's not allowed: - SoapRequest at 2/27/2007 2:01:13 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age ns1:Address / /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope On 3/2/07, David Elliott [EMAIL PROTECTED] wrote: I am sending a concrete type: HomeAddress that is derived from Address. The place holder in the class is the abstract type. This is the Java Client code being performed. HomeAddress homeAddress = new HomeAddress(); homeAddress.setHouseNumber(123 Main Street); Person person = new Person(); person.setAge(12); person.setName(Hello World); person.setAddress(homeAddress); IEmployeeServiceProxy service = new IEmployeeServiceProxy(); admin = service.getAdmin(person); Dave Date: Fri, 2 Mar 2007 09:11:03 -0500 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Subject: Re: Issue with Axis when sending abstract class to .NET webservice David, You cannot send an element of an abstract type. Your choices: - don't send the Address/ element (requires minOccurs=0) - define it as a concrete type Anne On 3/1/07, David Elliott [EMAIL PROTECTED] wrote: I am testing some interoperability between a Java Client using Axis and a .NET ASMX Webservice and am experiencing a problem and was wondering if anyone has an idea of what is going on. If I have a class that contains a data member that is abstract and try to pass a derived class type into the webservice, an XML error is generated. If I receive the same exact structure from the webservice all works as expected. I have a full .NET webservice and java client that will demonstrate the issue if anyone wants the code. I am including the soap messages that are received on the service. The class definition follows the SOAP Messages. Thanks, Dave WebbertSolutions[at]hotmail[dot]com Good Message - don't send address in - receive address == - SoapRequest at 2/27/2007 2:01:41 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:41 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body GetAdminResponse xmlns=urn:emp:service GetAdminResult xsi:type=Admin xmlns=urn:emp:data NameHello World/Name Age12/Age Address xsi:type=HomeAddress HouseNumber234 State Street/HouseNumber /Address HasPasswordtrue/HasPassword /GetAdminResult /GetAdminResponse /soap:Body /soap:Envelope Bad Message - populate HomeAddress - send HomeAddress in == - SoapRequest at 2/27/2007 2:01:13 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age ns1:Address / /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:13 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body soap:Fault faultcodesoap:Client/faultcode faultstringSystem.Web.Services.Protocols.SoapException: Server was unable to read request. --- System.InvalidOperationException: There is an error in XML document (1, 353). --- System.InvalidOperationException: The specified type is abstract: name='Address', namespace='urn:emp:data', at Address xmlns='urn:emp:data'. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Re
Re: Issue with Axis when sending abstract class to .NET webservice
No. Nillable won't work. A null value still is not valid for an abstract element. If you send the Address element, you must include an xsi:type attribute and specify a concrete type. Either don't send the element (minOccurs=0 required) or send a concrete type. Anne On 3/2/07, Walker, Jeff [EMAIL PROTECTED] wrote: If he uses nillable=true in the Schema, it might work? -jeff -Original Message- From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Friday, March 02, 2007 4:04 PM To: axis-user@ws.apache.org Subject: Re: Issue with Axis when sending abstract class to .NET webservice In the message that generates the fault, you send an empty Address/ element. That's not allowed: - SoapRequest at 2/27/2007 2:01:13 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age ns1:Address / /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope On 3/2/07, David Elliott [EMAIL PROTECTED] wrote: I am sending a concrete type: HomeAddress that is derived from Address. The place holder in the class is the abstract type. This is the Java Client code being performed. HomeAddress homeAddress = new HomeAddress(); homeAddress.setHouseNumber(123 Main Street); Person person = new Person(); person.setAge(12); person.setName(Hello World); person.setAddress(homeAddress); IEmployeeServiceProxy service = new IEmployeeServiceProxy(); admin = service.getAdmin(person); Dave Date: Fri, 2 Mar 2007 09:11:03 -0500 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Subject: Re: Issue with Axis when sending abstract class to .NET webservice David, You cannot send an element of an abstract type. Your choices: - don't send the Address/ element (requires minOccurs=0) - define it as a concrete type Anne On 3/1/07, David Elliott [EMAIL PROTECTED] wrote: I am testing some interoperability between a Java Client using Axis and a .NET ASMX Webservice and am experiencing a problem and was wondering if anyone has an idea of what is going on. If I have a class that contains a data member that is abstract and try to pass a derived class type into the webservice, an XML error is generated. If I receive the same exact structure from the webservice all works as expected. I have a full .NET webservice and java client that will demonstrate the issue if anyone wants the code. I am including the soap messages that are received on the service. The class definition follows the SOAP Messages. Thanks, Dave WebbertSolutions[at]hotmail[dot]com Good Message - don't send address in - receive address == - SoapRequest at 2/27/2007 2:01:41 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:41 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body GetAdminResponse xmlns=urn:emp:service GetAdminResult xsi:type=Admin xmlns=urn:emp:data NameHello World/Name Age12/Age Address xsi:type=HomeAddress HouseNumber234 State Street/HouseNumber /Address HasPasswordtrue/HasPassword /GetAdminResult /GetAdminResponse /soap:Body /soap:Envelope Bad Message - populate HomeAddress - send HomeAddress in == - SoapRequest at 2/27/2007 2:01:13 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age ns1:Address / /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:13 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body soap:Fault faultcodesoap:Client/faultcode faultstringSystem.Web.Services.Protocols.SoapException: Server was unable to read request
RE: Issue with Axis when sending abstract class to .NET webservice
I am not sending an empty Address/ element. I am sending a HomeAddress as in my example and the Axis framework doesn't seem to want to serialize it into the soap message. This is why the received soap message is empty and this is ultimately my problem.Dave Date: Fri, 2 Mar 2007 16:04:11 -0500 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Subject: Re: Issue with Axis when sending abstract class to .NET webservice In the message that generates the fault, you send an empty Address/ element. That's not allowed: - SoapRequest at 2/27/2007 2:01:13 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age ns1:Address / /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope On 3/2/07, David Elliott [EMAIL PROTECTED] wrote: I am sending a concrete type: HomeAddress that is derived from Address. The place holder in the class is the abstract type. This is the Java Client code being performed. HomeAddress homeAddress = new HomeAddress(); homeAddress.setHouseNumber(123 Main Street); Person person = new Person(); person.setAge(12); person.setName(Hello World); person.setAddress(homeAddress); IEmployeeServiceProxy service = new IEmployeeServiceProxy(); admin = service.getAdmin(person);Dave Date: Fri, 2 Mar 2007 09:11:03 -0500 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Subject: Re: Issue with Axis when sending abstract class to .NET webservice David, You cannot send an element of an abstract type. Your choices: - don't send the Address/ element (requires minOccurs=0) - define it as a concrete type Anne On 3/1/07, David Elliott [EMAIL PROTECTED] wrote: I am testing some interoperability between a Java Client using Axis and a .NET ASMX Webservice and am experiencing a problem and was wondering if anyone has an idea of what is going on. If I have a class that contains a data member that is abstract and try topass a derived class type into the webservice, an XML error is generated. If I receive thesame exact structure from the webservice all works as expected. I have a full .NET webservice and java client that will demonstrate theissue ifanyone wants the code. I am including the soap messages that are received on the service. The class definition follows the SOAP Messages. Thanks, Dave WebbertSolutions[at]hotmail[dot]com Good Message- don't send address in- receive address == - SoapRequest at 2/27/2007 2:01:41 PM -soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;soapenv:Body GetAdmin xmlns=urn:emp:servicens1:person xmlns:ns1=urn:emp:datans1:NameHello World/ns1:Name ns1:Age12/ns1:Age/ns1:person/GetAdmin /soapenv:Body/soapenv:Envelope - SoapResponse at 2/27/2007 2:01:41 PM -soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema;soap:Body GetAdminResponse xmlns=urn:emp:serviceGetAdminResult xsi:type=Admin xmlns=urn:emp:dataNameHello World/Name Age12/AgeAddress xsi:type=HomeAddressHouseNumber234 State Street/HouseNumber/Address HasPasswordtrue/HasPassword/GetAdminResult /GetAdminResponse/soap:Body/soap:Envelope Bad Message- populate HomeAddress- send HomeAddress in== - SoapRequest at 2/27/2007 2:01:13 PM -soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;soapenv:Body GetAdmin xmlns=urn:emp:servicens1:person xmlns:ns1=urn:emp:datans1:NameHello World/ns1:Name ns1:Age12/ns1:Agens1:Address //ns1:person /GetAdmin/soapenv:Body/soapenv:Envelope - SoapResponse at 2/27/2007 2:01:13 PM -soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema;soap:Body soap:Faultfaultcodesoap:Client/faultcode faultstringSystem.Web.Services.Protocols.SoapException:Server was unable to read request. ---System.InvalidOperationException: There is an error in XMLdocument (1, 353
Re: Issue with Axis when sending abstract class to .NET webservice
In the message that generates the fault, you send an empty Address/ element. That's not allowed: - SoapRequest at 2/27/2007 2:01:13 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age ns1:Address / /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope On 3/2/07, David Elliott [EMAIL PROTECTED] wrote: I am sending a concrete type: HomeAddress that is derived from Address. The place holder in the class is the abstract type. This is the Java Client code being performed. HomeAddress homeAddress = new HomeAddress(); homeAddress.setHouseNumber(123 Main Street); Person person = new Person(); person.setAge(12); person.setName(Hello World); person.setAddress(homeAddress); IEmployeeServiceProxy service = new IEmployeeServiceProxy(); admin = service.getAdmin(person); Dave Date: Fri, 2 Mar 2007 09:11:03 -0500 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Subject: Re: Issue with Axis when sending abstract class to .NET webservice David, You cannot send an element of an abstract type. Your choices: - don't send the Address/ element (requires minOccurs=0) - define it as a concrete type Anne On 3/1/07, David Elliott [EMAIL PROTECTED] wrote: I am testing some interoperability between a Java Client using Axis and a .NET ASMX Webservice and am experiencing a problem and was wondering if anyone has an idea of what is going on. If I have a class that contains a data member that is abstract and try to pass a derived class type into the webservice, an XML error is generated. If I receive the same exact structure from the webservice all works as expected. I have a full .NET webservice and java client that will demonstrate the issue if anyone wants the code. I am including the soap messages that are received on the service. The class definition follows the SOAP Messages. Thanks, Dave WebbertSolutions[at]hotmail[dot]com Good Message - don't send address in - receive address == - SoapRequest at 2/27/2007 2:01:41 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:41 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body GetAdminResponse xmlns=urn:emp:service GetAdminResult xsi:type=Admin xmlns=urn:emp:data NameHello World/Name Age12/Age Address xsi:type=HomeAddress HouseNumber234 State Street/HouseNumber /Address HasPasswordtrue/HasPassword /GetAdminResult /GetAdminResponse /soap:Body /soap:Envelope Bad Message - populate HomeAddress - send HomeAddress in == - SoapRequest at 2/27/2007 2:01:13 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age ns1:Address / /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:13 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body soap:Fault faultcodesoap:Client/faultcode faultstringSystem.Web.Services.Protocols.SoapException: Server was unable to read request. --- System.InvalidOperationException: There is an error in XML document (1, 353). --- System.InvalidOperationException: The specified type is abstract: name='Address', namespace='urn:emp:data', at Address xmlns='urn:emp:data'. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read5_Address(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read6_Person(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read7_GetAdmin() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerializationReader reader
RE: Issue with Axis when sending abstract class to .NET webservice
I am sending a concrete type: HomeAddress that is derived from Address. The place holder in the class is the abstract type. This is the Java Client code being performed. HomeAddress homeAddress = new HomeAddress();homeAddress.setHouseNumber(123 Main Street); Person person = new Person();person.setAge(12);person.setName(Hello World);person.setAddress(homeAddress); IEmployeeServiceProxy service = new IEmployeeServiceProxy();admin = service.getAdmin(person); Dave Date: Fri, 2 Mar 2007 09:11:03 -0500 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Subject: Re: Issue with Axis when sending abstract class to .NET webservice David, You cannot send an element of an abstract type. Your choices: - don't send the Address/ element (requires minOccurs=0) - define it as a concrete type Anne On 3/1/07, David Elliott [EMAIL PROTECTED] wrote: I am testing some interoperability between a Java Client using Axis and a .NET ASMX Webservice and am experiencing a problem and was wondering if anyone has an idea of what is going on. If I have a class that contains a data member that is abstract and try to pass a derived class type into the webservice, an XML error is generated. If I receive the same exact structure from the webservice all works as expected. I have a full .NET webservice and java client that will demonstrate the issue if anyone wants the code. I am including the soap messages that are received on the service. The class definition follows the SOAP Messages. Thanks, Dave WebbertSolutions[at]hotmail[dot]comGood Message - don't send address in - receive address == - SoapRequest at 2/27/2007 2:01:41 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:41 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body GetAdminResponse xmlns=urn:emp:service GetAdminResult xsi:type=Admin xmlns=urn:emp:data NameHello World/Name Age12/Age Address xsi:type=HomeAddress HouseNumber234 State Street/HouseNumber /Address HasPasswordtrue/HasPassword /GetAdminResult /GetAdminResponse /soap:Body /soap:Envelope Bad Message - populate HomeAddress - send HomeAddress in ==- SoapRequest at 2/27/2007 2:01:13 PM - soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body GetAdmin xmlns=urn:emp:service ns1:person xmlns:ns1=urn:emp:data ns1:NameHello World/ns1:Name ns1:Age12/ns1:Age ns1:Address / /ns1:person /GetAdmin /soapenv:Body /soapenv:Envelope - SoapResponse at 2/27/2007 2:01:13 PM - soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; soap:Body soap:Fault faultcodesoap:Client/faultcode faultstringSystem.Web.Services.Protocols.SoapException: Server was unable to read request. --- System.InvalidOperationException: There is an error in XML document (1, 353). --- System.InvalidOperationException: The specified type is abstract: name='Address', namespace='urn:emp:data', at Address xmlns='urn:emp:data'. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read5_Address(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read6_Person(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read7_GetAdmin() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() --- End of inner exception stack trace --- at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest