Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #260 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

'form="unqualified"'

Reported by: nahi Assigned to: nahi
Priority: high Milestone: 1.5.6
Component: wsdl4r Version: 1.5
Keywords: Cc:

Description (Last modified by nahi)

from ruby-talk

 When using the SOAP::WSDLDriverFactory to talk to webservices the form tag
 of some elements is not honored. If you look at the wsdl below you will
 see that the schemas 'elementFormDefault="qualified"' but the complexType
 sequence elements have a 'form="unqualified"' tag. The generated soap
 request is not correct. It adds the namespace for the sequence elements of
 the complexType anyway. This also happens with the classes generated using
 the WSDL2Ruby class to generate classdef's. I was able to get around it by
 generating a driver with WSDL2Ruby and setting the flag on the in
 parameters to false and then modifying the classdef generated file for the
 complexType to have nil namespaces in the @@schema_element. Also it seems
 wrong for the response that I do not have to set the flag on the out
 parameters of the generated driver class to false or change the
 @@schema_element in the classdef generated file and it still properly
 handlers the response xml that does not have the namespace on its complex 
type sequence elements.


GENERATED REQUEST:
<?xml version="1.0" encoding="us-ascii" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Body>
    <n1:TestTransaction xmlns:n1="http://TEST/TestTransaction">
      <n1:Request>
        <n1:FirstName>testfirst</n1:FirstName>
        <n1:LastName>testlast</n1:LastName>
        <n1:Street>teststreet</n1:Street>
        <n1:City>testcity</n1:City>
        <n1:State>teststate</n1:State>
        <n1:Zip>testzip</n1:Zip>
      </n1:Request>
    </n1:TestTransaction>
  </env:Body>
</env:Envelope>

PROPER REQUEST (What it should look like):
<?xml version="1.0" encoding="us-ascii" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Body>
    <n1:TestTransaction xmlns:n1="http://TEST/TestTransaction">
      <n1:Request>
        <FirstName>testfirst</FirstName>
        <LastName>testlast</LastName>
        <Street>teststreet</Street>
        <City>testcity</City>
        <State>teststate</State>
        <Zip>testzip</Zip>
      </n1:Request>
    </n1:TestTransaction>
  </env:Body>
</env:Envelope>


WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl: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:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://TEST/TestTransaction" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://TEST/TestTransaction" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://TEST/TestTransaction">
      <s:element name="TestTransaction">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="Request" type="tns:TransactionRequest" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="TransactionRequest">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="FirstName" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="LastName" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="Street" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="City" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="State" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="Zip" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:element name="TestTransactionResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="Response" type="tns:TransactionResponse" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="TransactionResponse">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="TransactionStatus" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="TransactionID" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" form="unqualified" name="Message" type="s:string" />
        </s:sequence>
      </s:complexType>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="TestTransactionSoapIn">
    <wsdl:part name="parameters" element="tns:TestTransaction" />
  </wsdl:message>
  <wsdl:message name="TestTransactionSoapOut">
    <wsdl:part name="parameters" element="tns:TestTransactionResponse" />
  </wsdl:message>
  <wsdl:portType name="PerformTestTransactionSoap">
    <wsdl:operation name="TestTransaction">
      <wsdl:input message="tns:TestTransactionSoapIn" />
      <wsdl:output message="tns:TestTransactionSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="PerformTestTransactionSoap" type="tns:PerformTestTransactionSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
    <wsdl:operation name="TestTransaction">
      <soap:operation soapAction="http://TEST/TestTransaction/TestTransaction" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="PerformTestTransaction">
    <wsdl:port name="PerformTestTransactionSoap" binding="tns:PerformTestTransactionSoap">
      <soap:address location="http://localhost:3000/testwebservice/action" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Change History

09/20/06 23:07:07 changed by nahi

  • description changed.

09/24/06 21:02:40 changed by nahi

  • status changed from new to closed.
  • resolution set to fixed.

(In [1724]) more aggressive xml 'qualified' control. closes #260.