Problem with generated soap requests using the WSDLDriverFactory?

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/"](http://schemas.xmlsoap.org/soap/envelope/)

xmlns:xsi=["http://www.w3.org/2001/XMLSchema-instance"](http://www.w3.org/2001/XMLSchema-instance)>

env:Body

<n1:TestTransaction xmlns:n1=["http://TEST/TestTransaction"](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/"](http://schemas.xmlsoap.org/soap/envelope/)

xmlns:xsi=["http://www.w3.org/2001/XMLSchema-instance"](http://www.w3.org/2001/XMLSchema-instance)>

env:Body

<n1:TestTransaction xmlns:n1=["http://TEST/TestTransaction"](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"](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>

Hi,

David Sledge wrote:

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.

You are right. I filed this as a ticket:
http://dev.ctor.org/soap4r/ticket/260 . I'll look into this.

Regards,
// NaHi

NAKAMURA, Hiroshi wrote:

You are right. I filed this as a ticket:
http://dev.ctor.org/soap4r/ticket/260 . I'll look into this.

Thank you :slight_smile: , I had filed a bug on rubyforge ( http://rubyforge.org/tracker/index.php?func=detail&aid=5763&group_id=426&atid=1698 ) that includes a test app with a test wsdl to recreate the problem. I thought that was the right place to report it because I was using the wsdl classes included in the ruby standard library. I will update that bug report with a link to the ticket you have created.

Hi,

David Sledge wrote:

Thank you :slight_smile: , I had filed a bug on rubyforge (
http://rubyforge.org/tracker/index.php?func=detail&aid=5763&group_id=426&atid=1698
) that includes a test app with a test wsdl to recreate the problem. I
thought that was the right place to report it because I was using the
wsdl classes included in the ruby standard library. I will update that
bug report with a link to the ticket you have created.

Thank you. I fixed the problem in the changeset 1724
(http://dev.ctor.org/soap4r/changeset/1724\) and confirmed that main.rb
in WSDLTest.zip generated the following request.

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot;
    xmlns:env="Error;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <env:Body>
    <n1:TestTransaction xmlns:n1="http://TEST/TestTransaction&quot;&gt;
      <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>

Regards,
// NaHi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

David Sledge wrote:

Thank you :slight_smile: , I had filed a bug on rubyforge (
http://rubyforge.org/tracker/index.php?func=detail&aid=5763&group_id=426&atid=1698
) that includes a test app with a test wsdl to recreate the problem. I
thought that was the right place to report it because I was using the
wsdl classes included in the ruby standard library. I will update that
bug report with a link to the ticket you have created.

Thank you. I fixed the problem in the changeset 1724
(http://dev.ctor.org/soap4r/changeset/1724\) and confirmed that main.rb
in WSDLTest.zip generated the following request.

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot;
    xmlns:env="Error;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <env:Body>
    <n1:TestTransaction xmlns:n1="http://TEST/TestTransaction&quot;&gt;
      <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>

Regards,
// NaHi

Thank you :slight_smile:

···

-----Original Message-----
From: NAKAMURA, Hiroshi [mailto:nakahiro@sarion.co.jp]
Sent: Sun 9/24/2006 10:30 AM
To: ruby-talk ML
Subject: Re: Problem with generated soap requests using the WSDLDriverFactory?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

David Sledge wrote:

Thank you :slight_smile: , I had filed a bug on rubyforge (
http://rubyforge.org/tracker/index.php?func=detail&aid=5763&group_id=426&atid=1698
) that includes a test app with a test wsdl to recreate the problem. I
thought that was the right place to report it because I was using the
wsdl classes included in the ruby standard library. I will update that
bug report with a link to the ticket you have created.

Thank you. I fixed the problem in the changeset 1724
(http://dev.ctor.org/soap4r/changeset/1724\) and confirmed that main.rb
in WSDLTest.zip generated the following request.

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot;
    xmlns:env="Error;
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <env:Body>
    <n1:TestTransaction xmlns:n1="http://TEST/TestTransaction&quot;&gt;
      <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>

Regards,
// NaHi

I updated the ticket on rubyforge, again thank you for fixing this so quickly. Great support!!!

···

-----Original Message-----
From: NAKAMURA, Hiroshi [mailto:nakahiro@sarion.co.jp]
Sent: Sun 9/24/2006 10:30 AM
To: ruby-talk ML
Subject: Re: Problem with generated soap requests using the WSDLDriverFactory?