Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8246633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:34:11+00:00 2026-06-07T22:34:11+00:00

Server: import soaplib from soaplib.core.service import rpc, DefinitionBase from soaplib.core.model.primitive import String, Integer from

  • 0

Server:

import soaplib
from soaplib.core.service import rpc, DefinitionBase
from soaplib.core.model.primitive import String, Integer
from soaplib.core.server import wsgi
from soaplib.core.model.clazz import Array


class HelloWorldService(DefinitionBase):
   @soap(String,Integer,_returns=Array(String))
   def say_hello(self,name,times):
      results = []
      for i in range(0,times):
         results.append('Hello, %s'%name)
      return results

if __name__=='__main__':
   try:
        from wsgiref.simple_server import make_server
        soap_application = soaplib.core.Application([HelloWorldService], 'tns')
        wsgi_application = wsgi.Application(soap_application)
        server = make_server('173.252.236.136', 7789, wsgi_application)
        server.serve_forever()
   except ImportError:
        print "Error: example server code requires Python >= 2.5"

PHP:

$client=new SoapClient("http://173.252.236.136:7789/?wsdl");
try{
ini_set('default_socket_timeout', 5);
var_dump($client->say_hello("Dave", 5));
echo("<br />");
//print_r($client->add(1,2));
}catch(Exception $e){
 echo $e->__toString();
 ini_restore('default_socket_timeout');
}

When I run my PHP code, it reports the information below:

SoapFault exception: [senv:Server] range() integer end argument expected, got NoneType.     in E:\web\webservice\client.php:6 Stack trace: #0 E:\web\webservice\client.php(6): SoapClient->__call('say_hello', Array) #1 E:\web\webservice\client.php(6): SoapClient->say_hello('Dave', 5) #2 {main}

But it works using Python’s client:

from suds.client import Client
hello_client = Client('http://173.252.236.136:7789/?wsdl')
result = hello_client.service.say_hello("Dave", 5)
print result

I found I can’t send the parameters name and times to the Python server using the PHP client.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:34:13+00:00Added an answer on June 7, 2026 at 10:34 pm

    I guess the problem is, that the soaplib wraps the parameters and the return values in Soap-structs. You can see that if you look at the output of:

     var_dump($client->__getFunctions());
     var_dump($client->__getTypes());
    

    So the solution is to just provide the structure:

    class SayHelloStruct {
        function __construct($name, $times) {
            $this->name = $name;
            $this->times = $times;
        }
    }
    
    $struct = new SayHelloStruct("Dave", 5);
    // here "say_hello" is not the method name but the name of the struct
    $soapstruct = new SoapVar($struct, SOAP_ENC_OBJECT, "say_hello");
    $param = new SoapParam($soapstruct, "say_hello");
    
    var_dump($client->say_hello($param));
    

    You can shorten that a bit by casting a hash-array to an object:

    $struct = (object)array("name" => "Dave", "times" => 5);
    // here "say_hello" is not the method name but the name of the struct
    $soapstruct = new SoapVar($struct, SOAP_ENC_OBJECT, "say_hello");
    $param = new SoapParam($soapstruct, "say_hello");
    
    var_dump($client->say_hello($param));
    

    The SoapParam-thing is not ultimately required. You can omit that without breaking it.

    Well I honestly don’t know if there is a better solution, like some kind of flag on the server or client side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to run the soaplib Hello World program: import soaplib from soaplib.core.service import
I am trying to import SQL Server's CONTAINS() function in my Entity Framework model
I import data from a TSV file with SQL Server 2008. null is replaced
I have one SQL server database which was created using Import/Export Wizard from an
it is possible to import the css file from another server? let's say i
I use SQL Server Import and Export Wizard to transfer data from a remote
I have one simple program of wsgi. from wsgiref.simple_server import make_server import time def
I create a Python webservice on Linux machine (ubuntu): import soaplib import os from
I'm using those 2 pieces of code from http://wiki.python.org/moin/UdpCommunication The server: import socket UDP_IP=127.0.0.1
I am trying to import data from excel to Sql Server using Import wizard.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.