You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Andrew Fyke <af...@pier64.com> on 2001/10/23 17:00:04 UTC

MS .Net/Apache SOAP Interop - Array problem

We are trying to get Microsoft .Net and Apache SOAP to interoperate. To do this 
we have focused on limiting the behavior of each platform to the current w3c 
SOAP draft ( http://www.w3.org/TR/2001/WD-soap12-part2-20011002/#arrays ). One 
problem we have seen is that Apache SOAP does not seem to correctly handle 
array encoding as defined in this model; the array is not correctly decoded 
because it appears that Apache SOAP wants to see a type attribute defined, such 
as xsi:type="ns3:Array".

Below is an example of a response that is not correctly decoded by Apache SOAP 
(although it does work with the .NET tools):

<?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://www.tms.com/arrayTest" 
  xmlns:types="http://www.tms.com/arrayTest/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:synchRequestResponse>
   <synchRequestResult href="#id1"/>
   </tns:synchRequestResponse>
  
   <types:RFCReplyAA id="id1" xsi:type="types:RFCReplyAA">
     <m_originatingRequestId xsi:type="xsd:long">6789</m_originatingRequestId>
     <m_items href="#id2"/>
   </types:RFCReplyAA>
   <soapenc:Array id="id2" soapenc:arrayType="types:RFCitemAA[2]">   <== HERE
        <Item href="#id3"/>
        <Item href="#id4"/>
   </soapenc:Array>
   <types:Sub1RFCitemAA id="id3" xsi:type="types:Sub1RFCitemAA"> 
        <m_item_num xsi:type="xsd:long">1234</m_item_num>
        <m_item_desc xsi:type="xsd:string">Left Door</m_item_desc>
        <m_item_sub1 xsi:type="xsd:long">4321</m_item_sub1>
   </types:Sub1RFCitemAA>
   <types:Sub2RFCitemAA id="id4" xsi:type="types:Sub2RFCitemAA">
        <m_item_num xsi:type="xsd:long">1234</m_item_num>
        <m_item_desc xsi:type="xsd:string">RightDoor</m_item_desc>
        <m_item_sub2 xsi:type="xsd:long">4321</m_item_sub2>
   </types:Sub2RFCitemAA>
  </soap:Body>
</soap:Envelope>

In order to get the code to work I hacked the Apache SOAP source and added the 
following to SoapEncUtils.java

  public static QName getTypeQName(Element el)
    throws IllegalArgumentException
  {
    // Try 1999
    QName typeQName = getAttributeValue(el, Constants.NS_URI_1999_SCHEMA_XSI,
                                        Constants.ATTR_TYPE, null, false);
    if (typeQName != null)
      return typeQName;
    
    // Try 2000
    typeQName = getAttributeValue(el, Constants.NS_URI_2000_SCHEMA_XSI,
                                  Constants.ATTR_TYPE, null, false);
    if (typeQName != null)
      return typeQName;
    
    // Try 2001
    typeQName = getAttributeValue(el, Constants.NS_URI_2001_SCHEMA_XSI,
                                  Constants.ATTR_TYPE, null, false);

    if (typeQName != null)
      return typeQName;

    //
    // hack
    //
    if(el.getTagName().endsWith(":Array") == true)
    {
        typeQName = new QName(Constants.NS_URI_SOAP_ENC , "Array");
    }
    //
   // end hack
   //

    return typeQName;
  }

Obviously this fix is not a production quality solution, but i think that it 
does point out where the problem lays in general. Has anyone else come across 
this? 

Andy Fyke		 
afyke@pier64.com

Re: MS .Net/Apache SOAP Interop - Array problem

Posted by Scott Nichol <sn...@computer.org>.
Andrew,

I have worked with SOAP Toolkit interop, but not .NET.  You will undoubtedly
find interop is decent but certainly far from perfect.  A few things to note
in Apache SOAP 2.2 docs:

1. The introduction states that this is an implementation of SOAP 1.1.  I
believe the URL you refer to is the 1.2 spec.  I'm not certain whether
anything has changed in the areas you are testing, but the 1.1 spec should
be your reference point.

2. There is an Interoperability section of the User's Guide.  By all means
read this.  It covers some problems frequently encountered and has links to
some other resources.

Finally, you should consider whether you wish to continue interop testing
with SOAP 2.2 or switch to Axis, which is the follow on project.  If you
will not be going into production until very late this year or early next
year (there are no exact dates for availability), Axis may be a better
target.

Scott

----- Original Message -----
From: "Andrew Fyke" <af...@pier64.com>
To: <so...@xml.apache.org>
Cc: <af...@pier64.com>; <bi...@pier64.com>
Sent: Tuesday, October 23, 2001 11:00 AM
Subject: MS .Net/Apache SOAP Interop - Array problem


> We are trying to get Microsoft .Net and Apache SOAP to interoperate. To do
this
> we have focused on limiting the behavior of each platform to the current
w3c
> SOAP draft ( http://www.w3.org/TR/2001/WD-soap12-part2-20011002/#arrays ).
One
> problem we have seen is that Apache SOAP does not seem to correctly handle
> array encoding as defined in this model; the array is not correctly
decoded
> because it appears that Apache SOAP wants to see a type attribute defined,
such
> as xsi:type="ns3:Array".
>
> Below is an example of a response that is not correctly decoded by Apache
SOAP
> (although it does work with the .NET tools):
>
> <?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://www.tms.com/arrayTest"
>   xmlns:types="http://www.tms.com/arrayTest/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:synchRequestResponse>
>    <synchRequestResult href="#id1"/>
>    </tns:synchRequestResponse>
>
>    <types:RFCReplyAA id="id1" xsi:type="types:RFCReplyAA">
>      <m_originatingRequestId
xsi:type="xsd:long">6789</m_originatingRequestId>
>      <m_items href="#id2"/>
>    </types:RFCReplyAA>
>    <soapenc:Array id="id2" soapenc:arrayType="types:RFCitemAA[2]">   <==
HERE
>         <Item href="#id3"/>
>         <Item href="#id4"/>
>    </soapenc:Array>
>    <types:Sub1RFCitemAA id="id3" xsi:type="types:Sub1RFCitemAA">
>         <m_item_num xsi:type="xsd:long">1234</m_item_num>
>         <m_item_desc xsi:type="xsd:string">Left Door</m_item_desc>
>         <m_item_sub1 xsi:type="xsd:long">4321</m_item_sub1>
>    </types:Sub1RFCitemAA>
>    <types:Sub2RFCitemAA id="id4" xsi:type="types:Sub2RFCitemAA">
>         <m_item_num xsi:type="xsd:long">1234</m_item_num>
>         <m_item_desc xsi:type="xsd:string">RightDoor</m_item_desc>
>         <m_item_sub2 xsi:type="xsd:long">4321</m_item_sub2>
>    </types:Sub2RFCitemAA>
>   </soap:Body>
> </soap:Envelope>
>
> In order to get the code to work I hacked the Apache SOAP source and added
the
> following to SoapEncUtils.java
>
>   public static QName getTypeQName(Element el)
>     throws IllegalArgumentException
>   {
>     // Try 1999
>     QName typeQName = getAttributeValue(el,
Constants.NS_URI_1999_SCHEMA_XSI,
>                                         Constants.ATTR_TYPE, null, false);
>     if (typeQName != null)
>       return typeQName;
>
>     // Try 2000
>     typeQName = getAttributeValue(el, Constants.NS_URI_2000_SCHEMA_XSI,
>                                   Constants.ATTR_TYPE, null, false);
>     if (typeQName != null)
>       return typeQName;
>
>     // Try 2001
>     typeQName = getAttributeValue(el, Constants.NS_URI_2001_SCHEMA_XSI,
>                                   Constants.ATTR_TYPE, null, false);
>
>     if (typeQName != null)
>       return typeQName;
>
>     //
>     // hack
>     //
>     if(el.getTagName().endsWith(":Array") == true)
>     {
>         typeQName = new QName(Constants.NS_URI_SOAP_ENC , "Array");
>     }
>     //
>    // end hack
>    //
>
>     return typeQName;
>   }
>
> Obviously this fix is not a production quality solution, but i think that
it
> does point out where the problem lays in general. Has anyone else come
across
> this?
>
> Andy Fyke
> afyke@pier64.com
>


Re: MS .Net/Apache SOAP Interop - Array problem

Posted by Scott Nichol <sn...@computer.org>.
Andrew,

I have worked with SOAP Toolkit interop, but not .NET.  You will undoubtedly
find interop is decent but certainly far from perfect.  A few things to note
in Apache SOAP 2.2 docs:

1. The introduction states that this is an implementation of SOAP 1.1.  I
believe the URL you refer to is the 1.2 spec.  I'm not certain whether
anything has changed in the areas you are testing, but the 1.1 spec should
be your reference point.

2. There is an Interoperability section of the User's Guide.  By all means
read this.  It covers some problems frequently encountered and has links to
some other resources.

Finally, you should consider whether you wish to continue interop testing
with SOAP 2.2 or switch to Axis, which is the follow on project.  If you
will not be going into production until very late this year or early next
year (there are no exact dates for availability), Axis may be a better
target.

Scott

----- Original Message -----
From: "Andrew Fyke" <af...@pier64.com>
To: <so...@xml.apache.org>
Cc: <af...@pier64.com>; <bi...@pier64.com>
Sent: Tuesday, October 23, 2001 11:00 AM
Subject: MS .Net/Apache SOAP Interop - Array problem


> We are trying to get Microsoft .Net and Apache SOAP to interoperate. To do
this
> we have focused on limiting the behavior of each platform to the current
w3c
> SOAP draft ( http://www.w3.org/TR/2001/WD-soap12-part2-20011002/#arrays ).
One
> problem we have seen is that Apache SOAP does not seem to correctly handle
> array encoding as defined in this model; the array is not correctly
decoded
> because it appears that Apache SOAP wants to see a type attribute defined,
such
> as xsi:type="ns3:Array".
>
> Below is an example of a response that is not correctly decoded by Apache
SOAP
> (although it does work with the .NET tools):
>
> <?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://www.tms.com/arrayTest"
>   xmlns:types="http://www.tms.com/arrayTest/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:synchRequestResponse>
>    <synchRequestResult href="#id1"/>
>    </tns:synchRequestResponse>
>
>    <types:RFCReplyAA id="id1" xsi:type="types:RFCReplyAA">
>      <m_originatingRequestId
xsi:type="xsd:long">6789</m_originatingRequestId>
>      <m_items href="#id2"/>
>    </types:RFCReplyAA>
>    <soapenc:Array id="id2" soapenc:arrayType="types:RFCitemAA[2]">   <==
HERE
>         <Item href="#id3"/>
>         <Item href="#id4"/>
>    </soapenc:Array>
>    <types:Sub1RFCitemAA id="id3" xsi:type="types:Sub1RFCitemAA">
>         <m_item_num xsi:type="xsd:long">1234</m_item_num>
>         <m_item_desc xsi:type="xsd:string">Left Door</m_item_desc>
>         <m_item_sub1 xsi:type="xsd:long">4321</m_item_sub1>
>    </types:Sub1RFCitemAA>
>    <types:Sub2RFCitemAA id="id4" xsi:type="types:Sub2RFCitemAA">
>         <m_item_num xsi:type="xsd:long">1234</m_item_num>
>         <m_item_desc xsi:type="xsd:string">RightDoor</m_item_desc>
>         <m_item_sub2 xsi:type="xsd:long">4321</m_item_sub2>
>    </types:Sub2RFCitemAA>
>   </soap:Body>
> </soap:Envelope>
>
> In order to get the code to work I hacked the Apache SOAP source and added
the
> following to SoapEncUtils.java
>
>   public static QName getTypeQName(Element el)
>     throws IllegalArgumentException
>   {
>     // Try 1999
>     QName typeQName = getAttributeValue(el,
Constants.NS_URI_1999_SCHEMA_XSI,
>                                         Constants.ATTR_TYPE, null, false);
>     if (typeQName != null)
>       return typeQName;
>
>     // Try 2000
>     typeQName = getAttributeValue(el, Constants.NS_URI_2000_SCHEMA_XSI,
>                                   Constants.ATTR_TYPE, null, false);
>     if (typeQName != null)
>       return typeQName;
>
>     // Try 2001
>     typeQName = getAttributeValue(el, Constants.NS_URI_2001_SCHEMA_XSI,
>                                   Constants.ATTR_TYPE, null, false);
>
>     if (typeQName != null)
>       return typeQName;
>
>     //
>     // hack
>     //
>     if(el.getTagName().endsWith(":Array") == true)
>     {
>         typeQName = new QName(Constants.NS_URI_SOAP_ENC , "Array");
>     }
>     //
>    // end hack
>    //
>
>     return typeQName;
>   }
>
> Obviously this fix is not a production quality solution, but i think that
it
> does point out where the problem lays in general. Has anyone else come
across
> this?
>
> Andy Fyke
> afyke@pier64.com
>