The problem:
We have an interface (EnumInterface), an enumeration container
(EnumContainer) and an enumeration type (TheEnum). We can set the
EnumContainer through the EnumInterface. However when we retrieve the
EnumContainer from the EnumInterface, the TheEnum within the EnumContainer is
null (Assert.IsNotNull(enumService.getEnumContainer().a nEnum); throws an
exception).
Any reason why C# can't retrieve the enum value ?
The setup:
The server is implemented using Axis 1.4.
The client C# on .Net 2.0
Note 1: we must have an rpc-encoded server.
Note 2: The previous C# client in with .Net 1.1 had no problem with this
scenario. The problem was introduced when we made the switch to .Net 2.0
The WSDL:
http://www.javamart.ca/enumProblem/wsdl/ep.wsdl
The Client code:
EnumInterfaceService enumService = new EnumInterfaceService();
EnumContainer enumContainer = new EnumContainer();
enumContainer.name = "blabla";
enumContainer.anEnum = TheEnum.Foo;
enumService.setEnumContainer(enumContainer);
Assert.IsNotNull(enumService.getEnumContainer().an Enum); //Fails here !!
Assert.AreEqual(enumService.getEnumContainer().anE num, TheEnum.Foo);
SOAP setEnumContainer:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://enumproblem.javamart.ca"
xmlns:types="http://enumproblem.javamart.ca/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<tns:setEnumContainer>
<enumContainer href="#id1"/>
</tns:setEnumContainer>
<tns:EnumContainer id="id1" xsi:type="tns:EnumContainer">
<anEnum xsi:type="tns:TheEnum">Foo</anEnum>
<name xsi:type="xsd:string">blabla</name>
</tns:EnumContainer>
</soap:Body>
</soap:Envelope>
SOAP getEnumContainer:
<?xml version="1.0" encoding="utf-8"?>
<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>
<ns1:getEnumContainerResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://enumproblem.javamart.ca">
<getEnumContainerReturn href="#id0"/>
</ns1:getEnumContainerResponse>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:EnumContainer"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://enumproblem.javamart.ca">
<anEnum href="#id1"/>
<name xsi:type="soapenc:string">blabla</name>
</multiRef>
<multiRef id="id1" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:TheEnum" xmlns:ns3="http://enumproblem.javamart.ca"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">Foo</multiRef>
</soapenv:Body>
</soapenv:Envelope>