You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Robert Herold <he...@cotagesoft.com> on 2002/09/19 01:42:26 UTC

Dot-net interop problem w/embedded array

One of our service methods takes a bean type with an embedded array of a
second bean type. We use Java2wsdl to generate the WSDL, and wsdl2java to
generate a java client.  The java client works fine.  When using a dot-net
client from the WSDL file, however, the Axis server cannot deserialize the
embedded array of beans.

Could this be a bug in the Axis deserializer?

Looking at the messages themselves, dot-net encodes the array very
differently than Axis (see below).  It appears Axis cannot handle this.

The beans are:

public class XAgentRegBean
{
  private String agentName;
  private ParamBean[] agentParams;

  public XAgentRegBean() { }
  public String getAgentName() { return this.agentName; }
  public void setAgentName(String agentName){ this.agentName = agentName; }
  public ParamBean[] getAgentParams() { return this.agentParams; }
  public void setAgentParams(ParamBean[] agentParams){
    this.agentParams = agentParams;
  }
}

public class ParamBean
{
  private String _paramName;
  private String _paramValue;

  public ParamBean() { }
  public String getParamName() { return _paramName; }
  public void setParamName(String paramName) { _paramName = paramName; }
  public String getParamValue() { return _paramValue; }
  public void setParamValue(String paramValue) { _paramValue = paramValue; }
}

When receiving messages from the dot-net client, the Axis server outputs the
error messages:

2002-09-18 09:30:46,543 [HttpProcessor[8081][4]] DEBUG
xis.utils.JavaUtils  - Trying to convert
org.apache.axis.encoding.ser.ArrayDeserializer$ArrayListExtension to
[Lcom.cotagesoft.common.ParamBean;

2002-09-18 09:30:46,553 [HttpProcessor[8081][4]] DEBUG
xis.utils.JavaUtils  - Trying to convert [Lcom.cotagesoft.common.ParamBean;
to com.cotagesoft.common.ParamBean

2002-09-18 09:30:46,553 [HttpProcessor[8081][4]] ERROR
encoding.ser.BeanPropertyTarget  - could not convert
[Lcom.cotagesoft.common.ParamBean; to bean field 'agentParams[0]', type
com.cotagesoft.common.ParamBean

If you are still reading, good for you!  You may be interested in the
following snapshots of the message sent by the dot-net client, and the
message sent by the Axis client.  Note the way the arrays are encoded
differently.  Dot-net explicitly sets up an array (id="id2" element)which in
turn refers to the elements of the array, while Axis puts the elements of
the array in-line (id="id0" element).

The dot-net message is:

<?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://xhub.cotagesoft.com"
  xmlns:types="http://xhub.cotagesoft.com/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:registerXAgent>
    <in0 href="#id1" />
  </tns:registerXAgent>
  <tns:XAgentRegBean id="id1" xsi:type="tns:XAgentRegBean">
    <agentName xsi:type="xsd:string">DotNetXAgent</agentName>
    <agentParams href="#id2" />
  </tns:XAgentRegBean>
  <soapenc:Array id="id2"
      xmlns:q1="http://common.cotagesoft.com"
      soapenc:arrayType="q1:ParamBean[4]">
    <Item href="#id3" />
    <Item href="#id4" />
    <Item href="#id5" />
    <Item href="#id6" />
   </soapenc:Array>
    <q2:ParamBean id="id3"
        xsi:type="q2:ParamBean"
        xmlns:q2="http://common.cotagesoft.com">
      <paramName xsi:type="xsd:string">XAgentType</paramName>
      <paramValue xsi:type="xsd:string">XAgentDotNetFilter</paramValue>
    </q2:ParamBean>
    <q3:ParamBean id="id4"
        xsi:type="q3:ParamBean"
        xmlns:q3="http://common.cotagesoft.com">
      <paramName xsi:type="xsd:string">ServerInfo</paramName>
      <paramValue xsi:type="xsd:string">Microsoft Windows NT
5.1.2600.0</paramValue>
    </q3:ParamBean>
    <q4:ParamBean id="id5"
        xsi:type="q4:ParamBean"
        xmlns:q4="http://common.cotagesoft.com">
      <paramName xsi:type="xsd:string">HostName</paramName>
      <paramValue xsi:type="xsd:string">HQ-ANDYM</paramValue>
    </q4:ParamBean>
    <q5:ParamBean id="id6"
        xsi:type="q5:ParamBean"
        xmlns:q5="http://common.cotagesoft.com">
      <paramName xsi:type="xsd:string">HostAddr</paramName>
      <paramValue xsi:type="xsd:string">65.56.50.48</paramValue>
    </q5:ParamBean>
  </soap:Body>
</soap:Envelope>

And the Axis message is:

<?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:registerXAgent
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:ns1="http://xhub.cotagesoft.com">
   <in0 href="#id0"/>
  </ns1:registerXAgent>
  <multiRef id="id0"
      soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns2:XAgentRegBean"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:ns2="http://xhub.cotagesoft.com">
   <agentName xsi:type="xsd:string">ServletFilterPOServiceJAXM</agentName>
   <agentParams href="#id1"/>
   <agentParams href="#id2"/>
   <agentParams href="#id3"/>
   <agentParams href="#id4"/>
   <agentParams href="#id5"/>
  </multiRef>
  <multiRef id="id5" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:ParamBean" xmlns:ns3="http://common.cotagesoft.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <paramName xsi:type="xsd:string">HostAddr</paramName>
   <paramValue xsi:type="xsd:string">65.56.50.48</paramValue>
  </multiRef>
  <multiRef id="id2" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns4:ParamBean" xmlns:ns4="http://common.cotagesoft.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <paramName xsi:type="xsd:string">ServletName</paramName>
   <paramValue xsi:type="xsd:string" xsi:nil="true"/>
  </multiRef>
  <multiRef id="id1" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns5:ParamBean" xmlns:ns5="http://common.cotagesoft.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <paramName xsi:type="xsd:string">XAgentType</paramName>
   <paramValue xsi:type="xsd:string">XAgentServletFilter</paramValue>
  </multiRef>
  <multiRef id="id3" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns6:ParamBean" xmlns:ns6="http://common.cotagesoft.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <paramName xsi:type="xsd:string">ServerInfo</paramName>
   <paramValue xsi:type="xsd:string">Apache Tomcat/4.0.4</paramValue>
  </multiRef>
  <multiRef id="id4" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns7:ParamBean" xmlns:ns7="http://common.cotagesoft.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <paramName xsi:type="xsd:string">HostName</paramName>
   <paramValue xsi:type="xsd:string">HQ-ANDYM</paramValue>
  </multiRef>
 </soapenv:Body>
</soapenv:Envelope>

----------
Robert Herold
Cotagesoft, Inc.
650 474 9013 x808