Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > SOAP4R and WSDL

Reply
Thread Tools

SOAP4R and WSDL

 
 
Ian Macdonald
Guest
Posts: n/a
 
      01-17-2004
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
http://www.velocityreviews.com/forums/(E-Mail Removed) | T. Stone
http://www.caliban.org |
|


 
Reply With Quote
 
 
 
 
NAKAMURA, Hiroshi
Guest
Posts: n/a
 
      01-17-2004
Hi,

> From: "Ian Macdonald" <(E-Mail Removed)>
> 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


 
Reply With Quote
 
 
 
 
Ian Macdonald
Guest
Posts: n/a
 
      01-17-2004
On Sat 17 Jan 2004 at 21:26:35 +0900, NAKAMURA, Hiroshi wrote:

> > From: "Ian Macdonald" <(E-Mail Removed)>
> > 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 |
(E-Mail Removed) |
http://www.caliban.org |
|


 
Reply With Quote
 
NAKAMURA, Hiroshi
Guest
Posts: n/a
 
      01-18-2004
------=_NextPart_000_02D8_01C3DE1A.BD1C4B90
Content-Type: text/plain;
charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

Hi,

> From: "Ian Macdonald" <(E-Mail Removed)>
> 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=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=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=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=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=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=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--


 
Reply With Quote
 
Ian Macdonald
Guest
Posts: n/a
 
      01-19-2004
On Sun 18 Jan 2004 at 23:28:22 +0900, NAKAMURA, Hiroshi wrote:

> > From: "Ian Macdonald" <(E-Mail Removed)>
> > 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
(E-Mail Removed) | who has not found that he is stupid. --
http://www.caliban.org | Gilbert K. Chesterson
|

 
Reply With Quote
 
NAKAMURA, Hiroshi
Guest
Posts: n/a
 
      01-19-2004
Hi,

> From: "Ian Macdonald" <(E-Mail Removed)>
> 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/"
xmlnssd="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


 
Reply With Quote
 
Ian Macdonald
Guest
Posts: n/a
 
      01-19-2004
On Mon 19 Jan 2004 at 10:27:48 +0900, NAKAMURA, Hiroshi wrote:

> > From: "Ian Macdonald" <(E-Mail Removed)>
> >
> > 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 = "(E-Mail Removed)"
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
(E-Mail Removed) | about what's happening now. -- Lauren
http://www.caliban.org | Bacall
|


 
Reply With Quote
 
NAKAMURA, Hiroshi
Guest
Posts: n/a
 
      01-19-2004
Hi,

> From: "Ian Macdonald" <(E-Mail Removed)>
> 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


 
Reply With Quote
 
Ian Macdonald
Guest
Posts: n/a
 
      01-19-2004
On Mon 19 Jan 2004 at 11:11:01 +0900, NAKAMURA, Hiroshi wrote:

> > From: "Ian Macdonald" <(E-Mail Removed)>
> > 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 |
(E-Mail Removed) |
http://www.caliban.org |
|


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
soap4r and capitalized wsdl:part names Ian Neubert Ruby 1 12-08-2010 08:09 PM
soap4r and WSDL Wouter de Bie Ruby 1 05-15-2009 11:12 AM
Soap4r and wsdl Michael Gebhart Ruby 1 05-11-2005 08:59 PM
SOAP4R WSDL response Jim Menard Ruby 1 05-29-2004 10:14 PM
WSDL parse failure (ruby 1.8.1-preview2, soap4r-1_5_1) Brian Marick Ruby 1 11-07-2003 01:42 AM



Advertisments