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 8108229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:02:40+00:00 2026-06-06T01:02:40+00:00

I have a client server scenario where the type conversion did by the SoapClient

  • 0

I have a client server scenario where the type conversion did by the SoapClient class in PHP, cannot tell wether an empty array is associative or numeric, and so defaults to numeric.

All exposed functions use basic types, no classes.

An associative array such as array("something"=>123) gets converted to a map data type. However, when the same array is empty, such as array(), it gets converted to an array on the Ruby side. Type casting to object (object)array() will result in a struct data type on the Ruby side.

The argument is a bit more complex, not as simple as above:

array(
    "options"=>array(
        "plans"=>array(
            0=>array(
                "name"=>"abc",
                "product_options"=>array(
                    "optional_key_determines_associative_array_data_type"=>0,
                ),
            ),
        ),
    ),
);

If the array under "product_options" is empty, it gets converted to an array in Ruby, instead of a map. Once again, type casting to object in PHP results in a struct in Ruby.

What can I do on the PHP side to make empty “associative” arrays end up as maps on the Ruby side?

PHP 5.3.3, using SoapClient.
Ruby 1.8.7, Rails 2.3.2 using Action Web Service.

  • 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-06T01:02:42+00:00Added an answer on June 6, 2026 at 1:02 am

    You can wrap your array in a SoapVar class with APACHE_MAP as encoding parameter. Like This:

    array(
        "options"=>array(
            "plans"=>array(
                0=>array(
                    "name"=>"abc",
                    "product_options"=> new SoapVar(array(), APACHE_MAP),
                ),
            ),
        ),
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a simple client/server scenario with one method: // client code $client
Hi I have code which sets up a basic client to server scenario and
My scenario is as follows: I have a client-server application. The client is deployed
Scenario. I have a client with two network connections to a server. One connection
I have a client/server type application setup, similar to a bittorrent downloading program. However,
I have the following scenario: Server: Jetty (with configured JAAS) Client: Jersey invoked via
I have a Client and Server scenario, where a service is installed on the
I'm setting up a client/server test scenario on my local machine - I have
Here's the scenario: I have a client-server-application where the client sends encrypted data to
we have this scenario: A server which contains needed data and client component which

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.