SOAP4R and WSDL

Discussion in 'Ruby' started by Ian Macdonald, Jan 17, 2004.

  1. Hello,

    I'm using SOAP4R and trying to parse a WSDL file. However, I get this
    error:

    [ianmacd@sagan]$ ./test3
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    /usr/lib/ruby/1.8/wsdl/soap/operation.rb:107:in `param_info': soap:body parts (NotImplementedError)

    There seems to be something in the WSDL that SOAP4R doesn't like. AFAIK,
    the same file works fine with other languages' WSDL parsers.

    Is there a way around this kind of thing?

    Ian
    --
    Ian Macdonald | I try to keep an open mind, but not so open
    System Administrator | that my brains fall out. -- Judge Harold
    | T. Stone
    http://www.caliban.org |
    |
     
    Ian Macdonald, Jan 17, 2004
    #1
    1. Advertising

  2. Hi,

    > From: "Ian Macdonald" <>
    > Sent: Saturday, January 17, 2004 6:02 PM


    > I'm using SOAP4R and trying to parse a WSDL file. However, I get this
    > error:
    >
    > [ianmacd@sagan]$ ./test3
    > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > /usr/lib/ruby/1.8/wsdl/soap/operation.rb:107:in `param_info': soap:body parts (NotImplementedError)


    Can I see the WSDL?

    > Is there a way around this kind of thing?


    Could be. If "part" attribute of soap:body element lists all parts
    of the message defined, it can be ignored...

    Regards,
    // NaHi
     
    NAKAMURA, Hiroshi, Jan 17, 2004
    #2
    1. Advertising

  3. On Sat 17 Jan 2004 at 21:26:35 +0900, NAKAMURA, Hiroshi wrote:

    > > From: "Ian Macdonald" <>
    > > Sent: Saturday, January 17, 2004 6:02 PM

    >
    > > I'm using SOAP4R and trying to parse a WSDL file. However, I get this
    > > error:
    > >
    > > [ianmacd@sagan]$ ./test3
    > > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    > > /usr/lib/ruby/1.8/wsdl/soap/operation.rb:107:in `param_info': soap:body parts (NotImplementedError)

    >
    > Can I see the WSDL?


    I've sent it to you privately, as it's too big for the mailing list.

    > > Is there a way around this kind of thing?

    >
    > Could be. If "part" attribute of soap:body element lists all parts
    > of the message defined, it can be ignored...


    I'm anything but an expert when it comes to SOAP, so, if after looking
    at the WSDL you think this can be done, can you give me a clue how to
    do it?

    Thank you.

    Ian
    --
    Ian Macdonald | QOTD: "Our parents were never our age."
    System Administrator |
    |
    http://www.caliban.org |
    |
     
    Ian Macdonald, Jan 17, 2004
    #3
  4. ------=_NextPart_000_02D8_01C3DE1A.BD1C4B90
    Content-Type: text/plain;
    charset="ISO-8859-1"
    Content-Transfer-Encoding: 7bit

    Hi,

    > From: "Ian Macdonald" <>
    > Sent: Sunday, January 18, 2004 4:14 AM


    > > Can I see the WSDL?

    >
    > I've sent it to you privately, as it's too big for the mailing list.


    Thanks. I implemented this feature.

    I've commited the change. Main trunk (1.9) of the CVS of ruby and
    the CVS of soap4r are updated. Attached patch should be able to
    applied to ruby_1_8 branch of the CVS of ruby and released 1.8.1.

    By the way, the WSDL you sent includes soap:header definition
    for session management. Soap4r now only offers very low level API
    for SOAP header handling. The developing code of high level API
    for easy use is in the CVS of soap4r (not in the CVS of ruby).
    I'll be able to post a sample usage of this API within this week.

    Regards,
    // NaHi
    ------=_NextPart_000_02D8_01C3DE1A.BD1C4B90
    Content-Type: text/plain;
    name="parts.diff.txt"
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: attachment;
    filename="parts.diff.txt"

    Index: lib/soap/wsdlDriver.rb=0A=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
    RCS file: /src/ruby/lib/soap/wsdlDriver.rb,v=0A=
    retrieving revision 1.6=0A=
    diff -u -2 -p -r1.6 wsdlDriver.rb=0A=
    --- lib/soap/wsdlDriver.rb 6 Jan 2004 02:20:50 -0000 1.6=0A=
    +++ lib/soap/wsdlDriver.rb 18 Jan 2004 10:59:46 -0000=0A=
    @@ -207,9 +207,5 @@ class WSDLDriver=0A=
    =0A=
    op_info =3D @operations[method_name]=0A=
    - parts_names =3D op_info.bodyparts.collect { |part| part.name }=0A=
    - obj =3D create_method_obj(parts_names, params)=0A=
    - method =3D Mapping.obj2soap(obj, @wsdl_mapping_registry, =
    op_info.optype_name)=0A=
    - method.elename =3D op_info.op_name=0A=
    - method.type =3D XSD::QName.new # Request should not be typed.=0A=
    + method =3D create_method_struct(op_info, params)=0A=
    req_header =3D nil=0A=
    req_body =3D SOAPBody.new(method)=0A=
    @@ -264,4 +260,22 @@ class WSDLDriver=0A=
    =0A=
    private=0A=
    +=0A=
    + def create_method_struct(op_info, params)=0A=
    + parts_names =3D op_info.bodyparts.collect { |part| part.name }=0A=
    + obj =3D create_method_obj(parts_names, params)=0A=
    + method =3D Mapping.obj2soap(obj, @wsdl_mapping_registry, =
    op_info.optype_name)=0A=
    + if method.members.size !=3D parts_names.size=0A=
    + new_method =3D SOAPStruct.new=0A=
    + method.each do |key, value|=0A=
    + if parts_names.include?(key)=0A=
    + new_method.add(key, value)=0A=
    + end=0A=
    + end=0A=
    + method =3D new_method=0A=
    + end=0A=
    + method.elename =3D op_info.op_name=0A=
    + method.type =3D XSD::QName.new # Request should not be typed.=0A=
    + method=0A=
    + end=0A=
    =0A=
    def create_method_obj(names, params)=0A=
    Index: lib/wsdl/soap/operation.rb=0A=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
    RCS file: /src/ruby/lib/wsdl/soap/operation.rb,v=0A=
    retrieving revision 1.2=0A=
    diff -u -2 -p -r1.2 operation.rb=0A=
    --- lib/wsdl/soap/operation.rb 25 Nov 2003 07:31:30 -0000 1.2=0A=
    +++ lib/wsdl/soap/operation.rb 18 Jan 2004 10:59:46 -0000=0A=
    @@ -105,5 +105,8 @@ private=0A=
    end=0A=
    if soapbody.parts=0A=
    - raise NotImplementedError.new("soap:body parts")=0A=
    + target =3D soapbody.parts.split(/\s+/)=0A=
    + bodyparts =3D name_info.parts.find_all { |part|=0A=
    + target.include?(part.name)=0A=
    + }=0A=
    else=0A=
    bodyparts =3D name_info.parts=0A=
    Index: lib/wsdl/xmlSchema/schema.rb=0A=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
    RCS file: /src/ruby/lib/wsdl/xmlSchema/schema.rb,v=0A=
    retrieving revision 1.2=0A=
    diff -u -2 -p -r1.2 schema.rb=0A=
    --- lib/wsdl/xmlSchema/schema.rb 25 Nov 2003 07:31:31 -0000 1.2=0A=
    +++ lib/wsdl/xmlSchema/schema.rb 18 Jan 2004 10:59:46 -0000=0A=
    @@ -44,4 +44,7 @@ class Schema < Info=0A=
    @complextypes << o=0A=
    o=0A=
    + when SimpleTypeName=0A=
    + STDERR.puts("Restriction of basetype with simpleType definition =
    is ignored for now.")=0A=
    + nil=0A=
    when ElementName=0A=
    o =3D Element.new=0A=

    ------=_NextPart_000_02D8_01C3DE1A.BD1C4B90--
     
    NAKAMURA, Hiroshi, Jan 18, 2004
    #4
  5. On Sun 18 Jan 2004 at 23:28:22 +0900, NAKAMURA, Hiroshi wrote:

    > > From: "Ian Macdonald" <>
    > > Sent: Sunday, January 18, 2004 4:14 AM

    >
    > > > Can I see the WSDL?

    > >
    > > I've sent it to you privately, as it's too big for the mailing list.

    >
    > Thanks. I implemented this feature.


    Thank you.

    > I've commited the change. Main trunk (1.9) of the CVS of ruby and
    > the CVS of soap4r are updated. Attached patch should be able to
    > applied to ruby_1_8 branch of the CVS of ruby and released 1.8.1.


    I've applied it to the latest stable snapshot of 1.8.1.

    > By the way, the WSDL you sent includes soap:header definition
    > for session management. Soap4r now only offers very low level API
    > for SOAP header handling. The developing code of high level API
    > for easy use is in the CVS of soap4r (not in the CVS of ruby).
    > I'll be able to post a sample usage of this API within this week.


    OK, but I'm not sure exactly how this applies to me.

    If I try to run my test script with the patched SOAP4R, I now get this:

    [ianmacd@sagan]$ ./test3
    Restriction of basetype with simpleType definition is ignored for now.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Restriction of basetype with simpleType definition is ignored for now.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Restriction of basetype with simpleType definition is ignored for now.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Restriction of basetype with simpleType definition is ignored for now.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Restriction of basetype with simpleType definition is ignored for now.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    Restriction of basetype with simpleType definition is ignored for now.
    Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.

    Is that the same thing you're talking about? Is there any way I can
    modify the WSDL file to work around this issue?

    Ian
    --
    Ian Macdonald | The doctrine of human equality reposes on
    System Administrator | this: that there is no man really clever
    | who has not found that he is stupid. --
    http://www.caliban.org | Gilbert K. Chesterson
    |
     
    Ian Macdonald, Jan 19, 2004
    #5
  6. Hi,

    > From: "Ian Macdonald" <>
    > Sent: Monday, January 19, 2004 9:44 AM


    > If I try to run my test script with the patched SOAP4R, I now get this:
    >
    > [ianmacd@sagan]$ ./test3
    > Restriction of basetype with simpleType definition is ignored for now.
    > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.

    [snip]
    > Restriction of basetype with simpleType definition is ignored for now.
    > Unknown element {http://www.w3.org/2001/XMLSchema}simpleType.
    >
    > Is that the same thing you're talking about?


    No. Sorry for the unclear explanation. Above messages warns that
    wsdl4r just ignored "simpleType" definition in the WSDL. Just
    ignore these warning for now...

    For example, "simpleType" is for restricting lexical space of the
    user-defined type.

    <?xml version="1.0"?>
    <definitions name="rotr"
    targetNamespace="urn:www.example.com:rotr"
    xmlns:tns="urn:www.example.com:rotr"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="urn:www.example.com:rotr">
    <simpleType name="OrderItem">
    <restriction base="xsd:string">
    <enumeration value="fotr"/>
    <enumeration value="ttt"/>
    <enumeration value="rotk"/>
    </restriction>
    </simpleType>
    <complexType name="Order">
    <sequence>
    <element name="item" type="tns:OrderItem"/>
    <element name="quantity" type="xsd:int"/>
    </sequence>
    </complexType>
    </schema>
    </types>
    </definitions>

    With this WSDL, bin/wsdl2ruby.rb generates following class
    definition.

    # urn:www.example.com:rotr
    class Order
    @@schema_type = "Order"
    @@schema_ns = "urn:www.example.com:rotr"

    def item
    @item
    end

    def item=(value)
    @item = value
    end

    def quantity
    @quantity
    end

    def quantity=(value)
    @quantity = value
    end

    def initialize(item = nil,
    quantity = nil)
    @item = item
    @quantity = quantity
    end
    end

    But item value should be restricted that it is one of "fotr",
    "ttt", and "rotk" in the future.

    OT: The 3rd movie is screened from Feb. 14 in Japan.

    Regards,
    // NaHi
     
    NAKAMURA, Hiroshi, Jan 19, 2004
    #6
  7. On Mon 19 Jan 2004 at 10:27:48 +0900, NAKAMURA, Hiroshi wrote:

    > > From: "Ian Macdonald" <>
    > >
    > > Is that the same thing you're talking about?

    >
    > No. Sorry for the unclear explanation. Above messages warns that
    > wsdl4r just ignored "simpleType" definition in the WSDL. Just
    > ignore these warning for now...


    OK. I now understand that it's just for enumeration types.

    Well, it seems that the WSDL now parses correctly. However, with this
    code:

    wsdl = 'partner.wsdl'
    soap = SOAP::WSDLDriverFactory.new(wsdl).createDriver

    username = ""
    password = "xxxxxx"

    soap = soap.login(username, password)

    I now get this:

    /usr/lib/ruby/1.8/soap/wsdlDriver.rb:307:in `header_from_obj': No header definition in schema. (RuntimeError)
    from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:246:in `document_send'
    from (eval):2:in `login'
    from ./test3:15

    Sorry to keep bugging you about this stuff. Any ideas?

    Ian
    --
    Ian Macdonald | You can't start worrying about what's going
    System Administrator | to happen. You get spastic enough worrying
    | about what's happening now. -- Lauren
    http://www.caliban.org | Bacall
    |
     
    Ian Macdonald, Jan 19, 2004
    #7
  8. Hi,

    > From: "Ian Macdonald" <>
    > Sent: Monday, January 19, 2004 11:04 AM


    > /usr/lib/ruby/1.8/soap/wsdlDriver.rb:307:in `header_from_obj': No header definition in schema. (RuntimeError)
    > from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:246:in `document_send'
    > from (eval):2:in `login'
    > from ./test3:15


    It's the bug and the notimplemented feature I wrote...
    I hope it will work in this week. Please wait.

    Sorry for your inconvenience. WSDL4R is still not tested
    via various WSDL files.

    Regards,
    // NaHi
     
    NAKAMURA, Hiroshi, Jan 19, 2004
    #8
  9. On Mon 19 Jan 2004 at 11:11:01 +0900, NAKAMURA, Hiroshi wrote:

    > > From: "Ian Macdonald" <>
    > > Sent: Monday, January 19, 2004 11:04 AM

    >
    > > /usr/lib/ruby/1.8/soap/wsdlDriver.rb:307:in `header_from_obj': No header definition in schema. (RuntimeError)
    > > from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:246:in `document_send'
    > > from (eval):2:in `login'
    > > from ./test3:15

    >
    > It's the bug and the notimplemented feature I wrote...
    > I hope it will work in this week. Please wait.


    OK. Thank you very much for your fixes and help so far.

    > Sorry for your inconvenience. WSDL4R is still not tested
    > via various WSDL files.


    No problem. I appreciate your hard work and patience with my questions.

    Ian
    --
    Ian Macdonald | SIMM crosstalk.
    System Administrator |
    |
    http://www.caliban.org |
    |
     
    Ian Macdonald, Jan 19, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Marick
    Replies:
    1
    Views:
    164
    NAKAMURA, Hiroshi
    Nov 7, 2003
  2. Jim Menard

    SOAP4R WSDL response

    Jim Menard, May 29, 2004, in forum: Ruby
    Replies:
    1
    Views:
    278
    Jim Menard
    May 29, 2004
  3. Lennon Day-Reynolds

    SOAP4R+WSDL+HTTP proxies?

    Lennon Day-Reynolds, Aug 13, 2004, in forum: Ruby
    Replies:
    2
    Views:
    343
    Lennon Day-Reynolds
    Aug 14, 2004
  4. Michael Gebhart

    Soap4r and wsdl

    Michael Gebhart, May 11, 2005, in forum: Ruby
    Replies:
    1
    Views:
    124
    Michael Gebhart
    May 11, 2005
  5. Ian Neubert
    Replies:
    1
    Views:
    133
    Payal Patel
    Dec 8, 2010
Loading...

Share This Page