Using .Net SOAP service

Discussion in 'Ruby' started by Hasham, Aug 1, 2007.

  1. Hasham

    Hasham Guest

    Hi,

    I am getting this error while trying to access .NET based SOAP Web
    service

    #<SOAP::Mapping::Object:0xb7c86218>:
    System.Web.Services.Protocols.SoapException: Server was unable to
    process request. ---> System.NullReferenceException: Object reference
    not set to an instance of an object. (SOAP::FaultError)

    My code to access this service is:

    require 'soap/wsdlDriver'
    wsdl = 'http://www.dotnetsite.com/MyService/Service.asmx?WSDL
    driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
    puts driver.GetVals('136')

    I have tried many things but still i am not able to get this code
    working. Please tell what should i do to get this working
    Hasham, Aug 1, 2007
    #1
    1. Advertising

  2. Hasham

    Ben Burkert Guest

    Try putting the '136' in a SOAP::SOAPString or SOAP::SOAPInt:

    p driver.GetVals(SOAP::SOAPString.new("136"))
    or
    p driver.GetVals(SOAP::SOAPInt.new(136))

    If that doesn't work, i try using the wsdl2ruby generator to create
    the class stubs. It will create a class for each parameter. In your
    case, it will be something like:

    p driver.GetVals( GetVals.new(SOAPString.new("136")))

    -Ben

    On Aug 1, 2007, at 12:00 AM, Hasham wrote:

    > Hi,
    >
    > I am getting this error while trying to access .NET based SOAP Web
    > service
    >
    > #<SOAP::Mapping::Object:0xb7c86218>:
    > System.Web.Services.Protocols.SoapException: Server was unable to
    > process request. ---> System.NullReferenceException: Object reference
    > not set to an instance of an object. (SOAP::FaultError)
    >
    > My code to access this service is:
    >
    > require 'soap/wsdlDriver'
    > wsdl = 'http://www.dotnetsite.com/MyService/Service.asmx?WSDL
    > driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
    > puts driver.GetVals('136')
    >
    > I have tried many things but still i am not able to get this code
    > working. Please tell what should i do to get this working
    >
    >
    Ben Burkert, Aug 1, 2007
    #2
    1. Advertising

  3. Hasham

    Hasham Guest

    Thanks Ben,

    I finally figured out the problem i had to pass arguments as hash like
    this:

    puts driver.GetVals:)parameter => "136")


    On Aug 1, 10:25 am, Ben Burkert <> wrote:
    > Try putting the '136' in a SOAP::SOAPString or SOAP::SOAPInt:
    >
    > p driver.GetVals(SOAP::SOAPString.new("136"))
    > or
    > p driver.GetVals(SOAP::SOAPInt.new(136))
    >
    > If that doesn't work, i try using the wsdl2ruby generator to create
    > the class stubs. It will create a class for each parameter. In your
    > case, it will be something like:
    >
    > p driver.GetVals( GetVals.new(SOAPString.new("136")))
    >
    > -Ben
    >
    > On Aug 1, 2007, at 12:00 AM, Hasham wrote:
    >
    > > Hi,

    >
    > > I am getting this error while trying to access .NET based SOAP Web
    > > service

    >
    > > #<SOAP::Mapping::Object:0xb7c86218>:
    > > System.Web.Services.Protocols.SoapException: Server was unable to
    > > process request. ---> System.NullReferenceException: Object reference
    > > not set to an instance of an object. (SOAP::FaultError)

    >
    > > My code to access this service is:

    >
    > > require 'soap/wsdlDriver'
    > > wsdl = 'http://www.dotnetsite.com/MyService/Service.asmx?WSDL
    > > driver = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
    > > puts driver.GetVals('136')

    >
    > > I have tried many things but still i am not able to get this code
    > > working. Please tell what should i do to get this working
    Hasham, Aug 1, 2007
    #3
  4. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi,

    Thanks Ben for answering.

    Hasham wrote:
    > I finally figured out the problem i had to pass arguments as hash like
    > this:
    >
    > puts driver.GetVals:)parameter => "136")


    FYI: Generating stub files with wsdl2ruby.rb against a WSDL could help
    to understand what arguments you should pass.

    % wsdl2ruby.rb --wsdl Foo.wsdl --type client --force

    Regards,
    // NaHi

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

    iQEVAwUBRrExqR9L2jg5EEGlAQJD5wf/RLB3kaPq115QqrkXGA/UoQy+0tF3s0u6
    BaWDjyhOomXHwpbG01Xap4Hrn4Lj76RH5IM7gsnghAIdnmVUOarkIESiRMroGHnn
    SLYivk18+BP9E5aC4/P9HhqgY2ENDyLbtEuZdwT03eeC8Ud9DcUUiyDwQJpCT+ot
    M10KcWddGKZqutS2BBaoCfsVVPwm7ro8DybxHTu12Np9JDw8+/bs4dDNiWbElXH1
    7R+clOEHHhx9mb03IWzo34tsVwFffWdEbl/Eo3XM57892wiTfZfRUvFvchqSLugo
    7QOHMzN8TpSsd0b5JkhqcPl0wXn61p2waYFB7C4k78ubUj5V8jZudQ==
    =7UJV
    -----END PGP SIGNATURE-----
    NAKAMURA, Hiroshi, Aug 2, 2007
    #4
    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. Sham Ramakrishnan
    Replies:
    2
    Views:
    8,332
    Sham Ramakrishnan
    Jul 1, 2003
  2. Mullin Yu
    Replies:
    0
    Views:
    203
    Mullin Yu
    Oct 8, 2003
  3. Prabhu

    .net SOAP toolkit performance for SOAP deserialization

    Prabhu, Nov 12, 2004, in forum: ASP .Net Web Services
    Replies:
    5
    Views:
    271
    Dan Rogers
    Nov 18, 2004
  4. B. Deepak

    soap using remoting vs soap using web services

    B. Deepak, Jun 20, 2006, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    184
  5. Curt K
    Replies:
    3
    Views:
    440
    John Saunders [MVP]
    Jun 15, 2007
Loading...

Share This Page