This note is a continuation of "Issue with Axis when sending abstract class to 
.NET webservice"
I have change my .NET Web Service and no longer has any abstracts.  It looks 
like

public class Person{   public string name;   public Address address;}
 
public class Address{
}
 
public class HomeAddress : Address{   public string houseNumber;}
I let Axis generate the Java proxy class and I call the .NET service in the 
Java client as such:

IEmployeeServiceProxy service = new IEmployeeServiceProxy();
HomeAddress homeAddress = new HomeAddress();homeAddress.setHouseNumber("456 
Long and Winding Road");
 
person = new Person();person.setName( "Bob the Builder" 
);person.setAddress(homeAddress);
 
newPerson = service.getPerson( person );
For all 3 tests below, NO CHANGES were made to the .NET Webservice.
Test 1: Run as isIf I examine the SOAP Request Message I see <ns1:Address /> 
with no data.
 
----- SoapRequest at 3/6/2007 2:35: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>    
<GetPerson xmlns="urn:emp:service">      <ns1:person xmlns:ns1="urn:emp:data">  
      <ns1:Name>Bob the Builder</ns1:Name>        <ns1:Address />      
</ns1:person>    </GetPerson>  </soapenv:Body></soapenv:Envelope>
 
Test 2: If I open the Java Proxy Class Person.java and change    public 
data.emp.Address getAddress() {        return address;    }to    public 
data.emp.HomeAddress getAddress() {        return (HomeAddress)address;    }
then this goes into the service        <ns1:Address xsi:type="ns1:HomeAddress"> 
         <ns1:HouseNumber>456 Long and Winding Road</ns1:HouseNumber>        
</ns1:Address>and this comes out
        <Address xsi:type="HomeAddress">          <HouseNumber>456 Long and 
Winding Road</HouseNumber>        </Address>however the getAddress() method now 
returns null when trying to print in the Java client
Test 3:Put getAddress() back to original code and 

Change all instances from    data.emp.Addressto    data.emp.HomeAddress
The correct data structure is passed in
        <ns1:Address xsi:type="ns1:HomeAddress">          <ns1:HouseNumber>456 
Long and Winding Road</ns1:HouseNumber>        </ns1:Address>
recieved 
        <Address xsi:type="HomeAddress">          <HouseNumber>456 Long and 
Winding Road</HouseNumber>        </Address>
and printed out successfully.
        Printing Returned Data...

        Name: Bob the Builder
        Addr: 456 Long and Winding Road
 
Any thoughts are welcomed.
Dave
 
 
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy! 
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us

Reply via email to