SOAP problems

B

barjunk

Here is my irb session:

irb -r soap/wsdlDriver
irb(main):001:0> end_point = "http://my.endpoint.com/cgi-bin/ipc-
SOAP/"
=> "http://my.endpoint.com/cgi-bin/ipc-SOAP/"
irb(main):002:0> soap =
SOAP::WSDLDriverFactory.new(end_point).create_rpc_driver
WSDL::XMLSchema::parser::UnknownElementError: unknown element: {}html
from /usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:116:in
`decode_tag'
from /usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:82:in
`start_element'
from /usr/lib/ruby/1.8/xsd/xmlparser/parser.rb:67:in
`start_element'
from /usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:34:in
`tag_start'
from /usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:24:in
`parse'
from /usr/lib/ruby/1.8/rexml/document.rb:173:in `parse_stream'
from /usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:27:in
`do_parse'
from /usr/lib/ruby/1.8/wsdl/xmlSchema/parser.rb:63:in `parse'
from /usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:42:in
`parse'
from /usr/lib/ruby/1.8/wsdl/importer.rb:31:in `parse'
from /usr/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:30:in
`import'
from /usr/lib/ruby/1.8/wsdl/importer.rb:18:in `import'
from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:124:in `import'
from /usr/lib/ruby/1.8/soap/wsdlDriver.rb:28:in `initialize'
from (irb):2
from :0
irb(main):003:0>

This works with some perl code I have, so I know the server is working
as it should.

Google was unhelpful.

Is it possible I am missing that the soap4r package needs, but isn't a
dependency?

Mike B.
 
P

Philipp Taprogge

Hi!

Thus spake barjunk on 04/26/2007 07:18 PM:
Here is my irb session:

irb -r soap/wsdlDriver
irb(main):001:0> end_point = "http://my.endpoint.com/cgi-bin/ipc-
SOAP/"
=> "http://my.endpoint.com/cgi-bin/ipc-SOAP/"
irb(main):002:0> soap =
SOAP::WSDLDriverFactory.new(end_point).create_rpc_driver
WSDL::XMLSchema::parser::UnknownElementError: unknown element: {}html
Is it possible I am missing that the soap4r package needs, but isn't a
dependency?

Unlikely. The error is pretty obvious: the XML parser encountered an
element it did not expect in the server's response: <html>.

This suggests that the server is not returning an XML document at
all but rather a normal web page. Perhaps this is a 404 or 500 error
page?
In any case, the create_rpc_driver method experts to find a WSDL
file which the server must provide.
Perhaps your perl code is not using a wsdl driver?

HTH,

Phil
 
B

barjunk

On Apr 26, 10:46 am, Philipp Taprogge <[email protected]>
wrote:
Unlikely. The error is pretty obvious: the XML parser encountered an
element it did not expect in the server's response: <html>.

This suggests that the server is not returning an XML document at
all but rather a normal web page. Perhaps this is a 404 or 500 error
page?
In any case, the create_rpc_driver method experts to find a WSDL
file which the server must provide.
Perhaps your perl code is not using a wsdl driver?

HTH,

Phil

Phil,

Turns out that you are right, I type-od the url...shoulda been https.

That was self-inflicted wound.

Now all I have to do is figure out how to pass some arguments to the
soap call and I'll be moving along.

The perl is:

my $login_result = $soap->call('login' => ('username', 'pass'))-

but I haven't figured out to do it with ruby. I have tried:

irb(main):170:0> p soap.call("login")
"No username passed"
=> nil

Which makes sense, but have no idea how to pass the username and
password. But I'll keep digging!

Mike B.
 
B

barjunk

On Apr 26, 10:46 am, Philipp Taprogge <[email protected]>
wrote:
<snip previous stuff>





Phil,

Turns out that you are right, I type-od the url...shoulda been https.

That was self-inflicted wound.

Now all I have to do is figure out how to pass some arguments to the
soap call and I'll be moving along.

The perl is:

my $login_result = $soap->call('login' => ('username', 'pass'))-


but I haven't figured out to do it with ruby. I have tried:

irb(main):170:0> p soap.call("login")
"No username passed"
=> nil

Which makes sense, but have no idea how to pass the username and
password. But I'll keep digging!

Mike B.


OK...so here it is.

end_point = "https://my.endpoint.com/cgi-bin/ipc-SOAP/"
soap = SOAP::RPC::Driver.new(end_point,"urn:/myurn")
soap.options['protocol.http.ssl_config.verify_mode'] =
OpenSSL::SSL::VERIFY_NONE
soap.add_method_with_soapaction('login', 'login', "defaultusername",
"defaultpassword")
soap.login("realuser","realpass")

In my case if use a valid username/pass pair I get a 1, if not, a nil.

I'm not really sure what the purpose of putting defaultusername and
defaultpassword in the add_method statement above, but I tried "" and
" ", neither worked. I had to actuall put string values.

For example:

soap.add_method_with_soapaction('login', 'login', "a", "b")

still worked, but :

soap.add_method_with_soapaction('login', 'login', "", "")

and

soap.add_method_with_soapaction('login', 'login', " ", " ")

didn't.

Thanks for the feedback. Sure would be great if there was more
documentation with the soap4r stuff...where can I submit some?

Mike B.
 
B

barjunk

On Apr 26, 10:46 am, Philipp Taprogge <[email protected]>
wrote:
<snip previous stuff>

Turns out that you are right, I type-od the url...shoulda been https.
That was self-inflicted wound.
Now all I have to do is figure out how to pass some arguments to the
soapcall and I'll be moving along.
The perl is:
my $login_result = $soap->call('login' => ('username', 'pass'))-

but I haven't figured out to do it with ruby. I have tried:
irb(main):170:0> psoap.call("login")
"No username passed"
=> nil
Which makes sense, but have no idea how to pass the username and
password. But I'll keep digging!

OK...so here it is.

end_point = "https://my.endpoint.com/cgi-bin/ipc-SOAP/"soap=SOAP::RPC::Driver.new(end_point,"urn:/myurn")soap.options['protocol.http.ssl_config.verify_mode'] =
OpenSSL::SSL::VERIFY_NONEsoap.add_method_with_soapaction('login', 'login', "defaultusername",
"defaultpassword")soap.login("realuser","realpass")

In my case if use a valid username/pass pair I get a 1, if not, a nil.

I'm not really sure what the purpose of putting defaultusername and
defaultpassword in the add_method statement above, but I tried "" and
" ", neither worked. I had to actuall put string values.

For example:

soap.add_method_with_soapaction('login', 'login', "a", "b")

still worked, but :

soap.add_method_with_soapaction('login', 'login', "", "")

and

soap.add_method_with_soapaction('login', 'login', " ", " ")

didn't.

Thanks for the feedback. Sure would be great if there was more
documentation with the soap4r stuff...where can I submit some?

Mike B.

Further study gives more information, the two fields are the 'names'
that the soap action will use.

Example:

username="defaultuser"
password="defaultuser"
soap.add_method_with_soapaction('login','login',username, password)


soap.login("actualuser","actualpass") will fail because the
'actualuser' value will be passed to both arguments because of the
initial setting above of defaultuser to both the username and
password.

To solve this, password would have to be set to 'defaultpass' or some
other different value.

I guess it is using the value passed in the add_method as the variable
name it uses in the action.

Someone with more knowledge might want to expand on this, but I
thought I would share what I found out.

Mike B.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,063
Latest member
StormyShuf

Latest Threads

Top