Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

soap4r and ASP.NET problems

10 views
Skip to first unread message

Pete Elmore

unread,
Sep 7, 2005, 8:46:50 PM9/7/05
to
Hello,

I'm having some difficulty getting Ruby to be able to successfully talk
to an ASP.NET application. (The answer to this question may be totally
obvious to someone familiar with XML, SOAP, etc.; sorry if my question
is a bit naive.) I was hoping someone might be able to help.

I'm getting a SOAP::FaultError trying to send a simple request to the
ASP.NET application. My test code looks like this:

require 'soap/rpc/driver'
sd = SOAP::RPC::Driver.new serv_url, namespace
sd.add_method_with_soapaction_as('get_venues', 'GetVenues',
'http://tickettechnology/GetVenues", 'UserName', 'Password',
'DomainName', 'bVerbose')
sd.default_encodingstyle =
SOAP::EncodingStyle::ASPDotNetHandler::Namespace
sd.generate_explicit_type = false
sd.get_venues username, password, domain_name, false

which yields:
SOAP::FaultError: Server was unable to process request. --> Validating
User Name: the submitted user name contains forbidden characters: null
string

The data the server expects looks like this:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetVenues xmlns="http://tickettechnology/">
<UserName>string</UserName>
<Password>string</Password>
<DomainName>string</DomainName>
<bVerbose>boolean</bVerbose>
</GetVenues>
</soap:Body>
</soap:Envelope>

But my code is generating this:
<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<n1:GetVenues xmlns:n1="http://tickettechnology/">
<UserName>username</UserName>
<Password>password</Password>
<DomainName>domainname</DomainName>
<bVerbose>false</bVerbose>
</n1:GetVenues>
</env:Body>
</env:Envelope>

(Of course, I cut out the actual username and password.)

It looked to me as if it was not finding the username string, since it
was definitely not null. Having very little knowledge of XML/SOAP, my
guess was that the problem was the 'n1:' bit, and so I spent the better
part of today trying to figure out how to get rid of it, with no
success. Any help at all would be greatly appreciated.

Thanks,
Pete


Ben Myles

unread,
Sep 7, 2005, 10:14:27 PM9/7/05
to
I had some problems with soap4r and asp.net too. Try the latest
snapshot: http://dev.ctor.org/download/soap4r-20050722.tar.gz

Roland Schmitt

unread,
Sep 8, 2005, 3:56:22 AM9/8/05
to
Hi,

i had problems with the namespace declarations too when using soap4r
version 1.5.4 and Suns JWSDP web services, but ASP.NET works.
With 1.5.4 there are no namespaces "n1:" in the soap body, so i think
you can try this version.

Regards,
Roland

Pete Elmore schrieb:

Pete Elmore

unread,
Sep 8, 2005, 1:52:52 PM9/8/05
to
Ben Myles wrote:
> I had some problems with soap4r and asp.net too. Try the latest
> snapshot: http://dev.ctor.org/download/soap4r-20050722.tar.gz

Roland Schmitt wrote:
> Hi,
>
> i had problems with the namespace declarations too when using soap4r
> version 1.5.4 and Suns JWSDP web services, but ASP.NET works.
> With 1.5.4 there are no namespaces "n1:" in the soap body, so i think
> you can try this version.

Thanks for your responses! Unfortunately, the 'n1:' still appears and
the request still fails. I've tried it both under 1.8.2 and 1.8.3
preview 2, with the newest version of soap4r (on three separate OSs),
with identical results. A few of the samples in the source tree (icd
was the one I looked at most closely, since it seems closest to what I'm
trying to do) appear broken, too. :(


Roland Schmitt

unread,
Sep 9, 2005, 3:29:33 AM9/9/05
to
Pete Elmore schrieb:

Hi,
sorry, you are right. I've tested a ASP.NET service with both soap4r
1.5.4 and the version that ships with ruby 1.8.2 (i think soap4r 1.5.3).
With 1.5.3 all env:Body elements have the namespace n1, with 1.5.4 not.
As a result, the ASP.NET service did not find the parameters, because of
the missing namespace, and sets the parametera to "null". So, with 1.5.3
the return value of ASP.NET in this example is "Hello, Mike", with 1.5.4
it return only "Hello,".

Here are the results.

With 1.5.4:

<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"

<n1:SayHello xmlns:n1="http://localhost/WebService/"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<name xsi:type="xsd:string">Mike</name>
</n1:SayHello>
</env:Body>
</env:Envelope>


And with 1.5.3:

<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"

<n1:SayHello xmlns:n1="http://localhost/WebService/">
<n1:name>Mike</n1:name>
</n1:SayHello>
</env:Body>
</env:Envelope>

The code is:

require "soap/rpc/driver"
include SOAP::RPC

class Test
def initialize()
@driver =
Driver.new('http://127.0.0.1:80/WebService/Service1.asmx','http://localhost/WebService/')
@driver.default_encodingstyle =
SOAP::EncodingStyle::ASPDotNetHandler::Namespace
@driver.add_method_with_soapaction
('SayHello','http://localhost/WebService/SayHello','name')
puts("Ergebnis: " + @driver.SayHello("Mike"))
end
end

Test.new()


Pete Elmore

unread,
Sep 9, 2005, 1:35:28 PM9/9/05
to
Roland Schmitt wrote:
> Hi,
> sorry, you are right. I've tested a ASP.NET service with both soap4r
> 1.5.4 and the version that ships with ruby 1.8.2 (i think soap4r 1.5.3).
> With 1.5.3 all env:Body elements have the namespace n1, with 1.5.4 not.
> As a result, the ASP.NET service did not find the parameters, because of
> the missing namespace, and sets the parametera to "null". So, with 1.5.3
> the return value of ASP.NET in this example is "Hello, Mike", with 1.5.4
> it return only "Hello,".
Thanks! Downgrading soap4r seems to have fixed the problem, and I'm happily
sending remote procedure calls left and right.


Roland Schmitt

unread,
Sep 12, 2005, 8:26:25 AM9/12/05
to
Hi,

Or look at http://groups.google.com/group/soap4r/. NaHi has build a new
snapshot (http://dev.ctor.org/download/soap4r-20050911.tar.gz) which
works for me after installing http-access2.

Thanks again, NaHi.

Regards,
Roland


0 new messages