Forum: Ruby Web Services Issue

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chris J. (Guest)
on 2006-06-01 02:17
I am currently working on a simple WS Client and have run across a very
odd and frustrating issue.  My fruitless hours of googling have brought
me here in the hopes someone might help shed light on the situation.

The following code connects to the WSDL listed and attempts to run a
function called getBPList with the last three parameters being left
blank as they are optional.

require 'soap/wsdlDriver'

wsdl_url = "http://usint.skire.com/ws/services/mainservice?WSDL"

soap = SOAP::WSDLDriverFactory.new('skire.wsdl').create_rpc_driver

soap.wiredump_file_base="soapresult"

result = soap.getBPList("one", "two", "three", "four", "five", "six",
"seven")

I have replaced the actual values because they contain private data, but
none the less the issue remains.  The real issue is that the fourth
value as well as the subsequent values are not included in the request
generated by the WSDLDriver.  What follows is the erroneous request:

<?xml version="1.0" encoding="utf-8" ?>
<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:getBPList
xmlns:n1="http://general.service.webservices.messenger.skire.com"
        env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <shortname xsi:type="xsd:string">one</shortname>
      <authcode xsi:type="xsd:string">two</authcode>
      <projectNumber xsi:type="xsd:string">three</projectNumber>
      <BPName xsi:nil="true"></BPName>
      <fieldnames n2:arrayType="xsd:string[0]"
          xmlns:n2="http://schemas.xmlsoap.org/soap/encoding/"
          xsi:type="n2:Array">
      </fieldnames>
      <filterCondition xsi:type="xsd:string"></filterCondition>
      <filterValues xmlns:n3="http://schemas.xmlsoap.org/soap/encoding/"
          xsi:type="n3:Array"
          n3:arrayType="xsd:string[0]">
      </filterValues>
    </n1:getBPList>
  </env:Body>
</env:Envelope>

You see that the line "<BPName xsi:nil="true"></BPName>" contains no
value, even though it is explicitly set in the function call.

I have run myself ragged modifying these values to highlight where this
goes wrong.  I've even run this through the Ruby debugger to no avail.
I simply cannot find where this value as well as the subsequent values
are being ignored.

If anyone has any help I would greatly appreciate it.  Feel free to look
at the WSDL and run the test code as you see fit.  If run from the 'irb'
and you receive an error back from Skire you can simply ignore it.  I've
safely ruled out any issue on their end as the request file proves that
it was not formed correctly.

Thanks,
Chris
unknown (Guest)
on 2006-06-01 07:24
(Received via mailing list)
On May 31, 2006, at 5:17 PM, chris Johansen wrote:

> require 'soap/wsdlDriver'
>
> wsdl_url = "http://usint.skire.com/ws/services/mainservice?WSDL"
>
> soap = SOAP::WSDLDriverFactory.new('skire.wsdl').create_rpc_driver
>
> soap.wiredump_file_base="soapresult"
>
> result = soap.getBPList("one", "two", "three", "four", "five", "six",
> "seven")

Chuck R.
removed_email_address@domain.invalid
www.familyvideovault.com (not yet live!)

I didn't actually run this code, but just eyeballing it I think I see
an error. You are fetching the WSDL and storing it as 'wsdl_url' but
I don't see you using it to create your soap driver. I think the line
ought to be:

soap = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver

Or maybe I'm wrong. Give it a try and see.

cr
Chris Johansen (Guest)
on 2006-06-01 20:53
unknown wrote:
> On May 31, 2006, at 5:17 PM, chris Johansen wrote:
>
>> require 'soap/wsdlDriver'
>>
>> wsdl_url = "http://usint.skire.com/ws/services/mainservice?WSDL"
>>
>> soap = SOAP::WSDLDriverFactory.new('skire.wsdl').create_rpc_driver
>>
>> soap.wiredump_file_base="soapresult"
>>
>> result = soap.getBPList("one", "two", "three", "four", "five", "six",
>> "seven")
>
> Chuck R.
> removed_email_address@domain.invalid
> www.familyvideovault.com (not yet live!)
>
> I didn't actually run this code, but just eyeballing it I think I see
> an error. You are fetching the WSDL and storing it as 'wsdl_url' but
> I don't see you using it to create your soap driver. I think the line
> ought to be:
>
> soap = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
>
> Or maybe I'm wrong. Give it a try and see.
>
> cr

OOPS! No that's a mistake in my not checking it closely enough when I
posted it.  I appologize.  At some point I had made a local copy of the
wsdl to rule out there being any issues on the network.  You are correct
that the line should infact read:

soap = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver

The issue continues regardless of which one I am using (local or from
the site).  Thanks for catching my mistake.  The issue is still exists,
however.

Chris
unknown (Guest)
on 2006-06-01 22:01
(Received via mailing list)
On Jun 1, 2006, at 11:53 AM, Chris Johansen wrote:

>>>
>> I don't see you using it to create your soap driver. I think the line
> the
> wsdl to rule out there being any issues on the network.  You are
> correct
> that the line should infact read:
>
> soap = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
>
> The issue continues regardless of which one I am using (local or from
> the site).  Thanks for catching my mistake.  The issue is still
> exists,
> however.

Chris,

I got it to work. Here's what I did.

I downloaded the wsdl file to a local file and looked at the method
call in detail. I noticed something interesting and out of place.
Look at this definition and take a close look at capitalization:

    <wsdl:message name="getBPListRequest">

       <wsdl:part name="shortname" type="xsd:string"/>

       <wsdl:part name="authcode" type="xsd:string"/>

       <wsdl:part name="projectNumber" type="xsd:string"/>

       <wsdl:part name="BPName" type="xsd:string"/>

       <wsdl:part name="fieldnames" type="impl:ArrayOf_xsd_string"/>

       <wsdl:part name="filterCondition" type="xsd:string"/>

       <wsdl:part name="filterValues" type="impl:ArrayOf_xsd_string"/>

    </wsdl:message>

Please notice that the fourth element, the one that is consistently
screwed up, has a name starting with a cap letter. So what I did was
create an edited version of the wsdl and changed that name from
"BPName" to "bpName" in both places it shows up (for that specific
method definition). I then ran your code again and it produced the
correct soap request as shown below:

<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:getBPList xmlns:n1="http://
general.service.webservices.messenger.skire.com"
         env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
       <shortname xsi:type="xsd:string">one</shortname>
       <authcode xsi:type="xsd:string">two</authcode>
       <projectNumber xsi:type="xsd:string">three</projectNumber>
       <bpName xsi:type="xsd:string">four</bpName>
       <fieldnames n2:arrayType="xsd:string[1]"
           xmlns:n2="http://schemas.xmlsoap.org/soap/encoding/"
           xsi:type="n2:Array">
         <item>five</item>
       </fieldnames>
       <filterCondition xsi:type="xsd:string">six</filterCondition>
       <filterValues xmlns:n3="http://schemas.xmlsoap.org/soap/
encoding/"
           xsi:type="n3:Array"
           n3:arrayType="xsd:string[1]">
         <item>seven</item>
       </filterValues>
     </n1:getBPList>
   </env:Body>
</env:Envelope>

I don't know if the SOAP standard allows for those names to start
with capitals, but for sure the ruby code doesn't handle it correctly.

I imagine the right way to fix this is to check the SOAP standard to
see what it says (or if it's mute on the topic of capitalization) and
then, depending on that answer, modify the SOAP library to downcase
these strings or just the first letter.

Anyway, mystery solved!

cr
Chris J. (Guest)
on 2006-06-01 23:38
>
> Chris,
>
> I got it to work. Here's what I did.
>
> I downloaded the wsdl file to a local file and looked at the method
> call in detail. I noticed something interesting and out of place.
> Look at this definition and take a close look at capitalization:
>
>     <wsdl:message name="getBPListRequest">
>
>        <wsdl:part name="shortname" type="xsd:string"/>
>
>        <wsdl:part name="authcode" type="xsd:string"/>
>
>        <wsdl:part name="projectNumber" type="xsd:string"/>
>
>        <wsdl:part name="BPName" type="xsd:string"/>
>
>        <wsdl:part name="fieldnames" type="impl:ArrayOf_xsd_string"/>
>
>        <wsdl:part name="filterCondition" type="xsd:string"/>
>
>        <wsdl:part name="filterValues" type="impl:ArrayOf_xsd_string"/>
>
>     </wsdl:message>
>
> Please notice that the fourth element, the one that is consistently
> screwed up, has a name starting with a cap letter. So what I did was
> create an edited version of the wsdl and changed that name from
> "BPName" to "bpName" in both places it shows up (for that specific
> method definition). I then ran your code again and it produced the
> correct soap request as shown below:
>
> <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:getBPList xmlns:n1="http://
> general.service.webservices.messenger.skire.com"
>          env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>        <shortname xsi:type="xsd:string">one</shortname>
>        <authcode xsi:type="xsd:string">two</authcode>
>        <projectNumber xsi:type="xsd:string">three</projectNumber>
>        <bpName xsi:type="xsd:string">four</bpName>
>        <fieldnames n2:arrayType="xsd:string[1]"
>            xmlns:n2="http://schemas.xmlsoap.org/soap/encoding/"
>            xsi:type="n2:Array">
>          <item>five</item>
>        </fieldnames>
>        <filterCondition xsi:type="xsd:string">six</filterCondition>
>        <filterValues xmlns:n3="http://schemas.xmlsoap.org/soap/
> encoding/"
>            xsi:type="n3:Array"
>            n3:arrayType="xsd:string[1]">
>          <item>seven</item>
>        </filterValues>
>      </n1:getBPList>
>    </env:Body>
> </env:Envelope>
>
> I don't know if the SOAP standard allows for those names to start
> with capitals, but for sure the ruby code doesn't handle it correctly.
>
> I imagine the right way to fix this is to check the SOAP standard to
> see what it says (or if it's mute on the topic of capitalization) and
> then, depending on that answer, modify the SOAP library to downcase
> these strings or just the first letter.
>
> Anyway, mystery solved!
>
> cr

CR,
  Terrific!  I had briefly wondered if that was causing the issue but
thank you for checking it for me.  I will continue pursue the issue by
verifying the SOAP standard and if it is supposedly case-insensitive
I'll open a ticket with 'soap4r'.

Again thank you very much.

Chris

p.s. Incidentally  I have another solution which I just completed before
checking the forum here.  It simply involves not using the WSDLDriver
and instead just using 'soap/driver' which I believe is the RPC driver.
I've attached that code for completeness.

#!/usr/bin/env ruby

require 'soap/driver'

wsdl_url = "http://usint.skire.com/ws/services/mainservice?WSDL"
namespace = "http://general.service.webservices.messenger.skire.com"

soap = SOAP::Driver.new(nil, nil, namespace, wsdl_url)

soap.wiredump_file_base="soapresult"

soap.addMethodWithSOAPAction('getBPList', namespace, "shortName",
"authCode", "projectNumber", "bpName", "nil", "nil", "nil")

result = soap.getBPList("one", "two", "three", "four", '', '', '')

puts result.xmlcontents
Chris J. (Guest)
on 2006-06-01 23:45
All,
   To finalize and clarify as I followed up on the sensitivity issue I
considered the standard for XML which is case sensitive.  As the SOAP
standard doesn't mention case-sensitivity but is based on the XML
standard we can assume it is transitive.  As such, by section 4.3.3 of
the XML 1.3 standard http://www.w3.org/TR/2004/REC-xml-20040204/ case
sensitivity should be respected.

   It appears that the WSDLDriver is not adhering to this.  I will open
a ticket with 'soap4r'.

Thank you all.
Chris.
NAKAMURA, Hiroshi (Guest)
on 2006-07-17 15:23
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

chris Johansen wrote:
>    To finalize and clarify as I followed up on the sensitivity issue I
> considered the standard for XML which is case sensitive.  As the SOAP
> standard doesn't mention case-sensitivity but is based on the XML
> standard we can assume it is transitive.  As such, by section 4.3.3 of
> the XML 1.3 standard http://www.w3.org/TR/2004/REC-xml-20040204/ case
> sensitivity should be respected.
>
>    It appears that the WSDLDriver is not adhering to this.  I will open
> a ticket with 'soap4r'.

Thanks.  I tried to download WSDL at
http://usint.skire.com/ws/services/mainservice?WSDL but browser
complains.  Can you please send me a WSDL by e-mail?  I want to
reproduce the problem on my side to fix the problem.

Regards,
// NaHi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)

iQEVAwUBRLtyMh9L2jg5EEGlAQKvOAf/XkMNp4lr469uDPCvPLHLbdbEBTzsvEzL
WRHr/FoM3pKtwFCbh7pi5Lpux7bxrPXZHadGOsNwqIeuK7sJjU1JcrPynXOQ7xxY
EAN3Y8gwr2jH20OKlxO1sc+zE19gFPITzuJmY0Xa7ZP/oRIuKAmE6WoJt/5jdKDV
d4GtF/kf2Q59L1QrJGRbmCH9GyFMso7+DlV+dsf+d1chMO1oJOV+a+k5N1THbvqO
X20Xe7lUL8s3Zjti8iJRiXmJ9R0Owe6KrFjtRhUtJ43vk9PH0WzojxShWOyBJLzR
jpPdU65oAr2X7GGakZ2x/FCxxaNtIMvrCTmWRo4EeYs0cQ2L8UAgeA==
=AfCo
-----END PGP SIGNATURE-----
This topic is locked and can not be replied to.