You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/10/07 11:00:37 UTC

DO NOT REPLY [Bug 13355] New: - Type info in body is validated even if use=literal

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13355>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13355

Type info in body is validated even if use=literal

           Summary: Type info in body is validated even if use=literal
           Product: Axis
           Version: 1.0-rc2
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: daniel.hagg@factum.se


Axis 1.0 RC2 interprets type information in the soap body event if the
WSDL specifies use="literal". I don't think Axis should do that.
I think Axis should use the schema in the WSDL and ignore the
type information in the soap body. Anyway, that is what .NET does.

Here is an example.

My SOAP server takes a request like this:

<?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>
  <RequestAllConfigurations xmlns="my.namespace.se"/>
 </soapenv:Body>
</soapenv:Envelope>

And generates a response like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<SOAP-ENV:Envelope xmlns="my.namespace.se" xmlns:DAB="my.namespace.se"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
 <SOAP-ENV:Header/>
 <SOAP-ENV:Body xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <AllConfigurationsResponse>
   <ConfigurationArray xsi:type="SOAP-ENC:arrayType"
    SOAP-ENC:arrayType="xsd:string[2]">
    <configuration xsi:type="xsd:string">
      <![CDATA[Configuration 1]]>
    </configuration>
    <configuration xsi:type="xsd:string">
      <![CDATA[Configuration 2]]>
    </configuration>
   </ConfigurationArray>
  </AllConfigurationsResponse>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Axis cannot interpret the response if the soap body contains type info (xsi:type
= ???). A "Bad Types" SAXException is throwed.
But if the type info is removed, Axis can interpret the response.
The following WSDL is used to generate the Axis code (note use="literal"):

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:s="http://www.w3.org/2001/XMLSchema"
             xmlns:s0="my.namespace.se"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
             targetNamespace="my.namespace.se"
             xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <s:schema elementFormDefault="qualified" targetNamespace="factum.se/dab">
      <s:element name="RequestAllConfigurations">
        <s:complexType />
      </s:element>
      <s:element name="AllConfigurationsResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="ConfigurationArray"
type="s0:ArrayOfConfigurations" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="ArrayOfConfigurations">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="configuration"
nillable="true" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:element name="ArrayOfConfigurations" nillable="true"
type="s0:ArrayOfConfigurations" />
    </s:schema>
  </types>

  <message name="InAllConfigurations">
    <part name="parameters" element="s0:RequestAllConfigurations" />
  </message>
  <message name="OutAllConfigurations">
    <part name="parameters" element="s0:AllConfigurationsResponse" />
  </message>

  <portType name="ApiPort">
    <operation name="RequestAllConfigurations">
      <input name="InAllConfigurations" message="s0:InAllConfigurations" />
      <output name="OutAllConfigurations" message="s0:OutAllConfigurations" />
    </operation>
  </portType>

  <binding name="ApiBinding" type="s0:ApiPort">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
    <operation name="RequestAllConfigurations">
      <soap:operation soapAction="/DabCtrlApi" style="document" />
      <input name="InAllConfigurations">
        <soap:body use="literal" />
      </input>
      <output name="OutAllConfigurations">
        <soap:body use="literal" />
      </output>
    </operation>
  </binding>

  <service name="DabCtrlApi">
    <port name="ApiPort" binding="s0:ApiBinding">
      <soap:address location="http://localhost/" />
    </port>
  </service>
</definitions>