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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:43:22+00:00 2026-06-11T23:43:22+00:00

I am creating a web service, I have added an operation which receive an

  • 0

I am creating a web service, I have added an operation which receive an object but my soap client doesn’t recognize its attributes

<?php
class Application_Model_Contact {

    private $id;
    private $name;
    private $phone;

    /**
     * 
     * @param String $nome
     * @param String $phone
     */
    public function __construct($nome = null, $phone = null) {
    ....    
    }

}

…

class Application_Model_WebServices
{    
    /**
     * 
     * @param Application_Model_Contact $contact
     * @return boolean
     */
    public function adicionar(Application_Model_Contact $contact){
        return true;
    }

}

….

if (isset($_GET['wsdl'])) {
    $autodiscover = new Zend_Soap_AutoDiscover();
    $autodiscover->setClass('Application_Model_WebServices');
    $autodiscover->handle();
} else {
    $server = new Zend_Soap_Server();
    $server->setOptions(array(
        'soap_version' => SOAP_1_2,
        'actor' => 'http://localhost/AgendaTelefonicaPHPSOAP/public/webservice.php',
        'encoding' => 'UTF-8'
    ));
    $server->setWsdl('http://localhost/AgendaTelefonicaPHPSOAP/public/webservice.php?wsdl');
    $server->setClass('Application_Model_WebServices');
    $server->handle();
}

Using soapUI, I get the following xml to add this object

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://localhost/AgendaTelefonicaPHPSOAP/public/webservice.php">
   <soapenv:Header/>
   <soapenv:Body>
      <web:adicionar soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <contact xsi:type="web:Application_Model_Contact"/>
      </web:adicionar>
   </soapenv:Body>
</soapenv:Envelope>

Why my class attributes aren’t being recognized?

  • 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-11T23:43:24+00:00Added an answer on June 11, 2026 at 11:43 pm

    In order for Zend_Soap_Autodiscover to add complex types to the WSDL, it needs to be able to see the attributes using reflection and it needs docblocks to inform it as to the type of each attribute.

    So in order for your WSDL to include these complex types, which will then allow your client to pass those types in the SOAP request, you’ll need to adjust the Applicaton_Model_Contact class as follows:

    class Application_Model_Contact {
    
        /** @var string */
        public $id;
        /** @var string */
        public $name;
        /** @var string */
        public $phone;
    
        /**
         * 
         * @param String $nome
         * @param String $phone
         */
        public function __construct($nome = null, $phone = null) {
        ....    
        }
    
    }
    

    I ran your code before and after this modification and can confirm that after this modification the attributes of the contact record were successfully passed into the adicionar() method.

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

Sidebar

Related Questions

I'm creating a web service, which run in GlassFish, and I want to have
I am creating a web service for end users which will have a front-end
I am creating an application which involves so many web-service calls. I am using
I am creating an application in which I want to access a web service
I'm creating a web-service client. I used a WSDL file to generate the client
I have some web services and I am creating a web client using ws-import.
I have hard times using maven to generate my web service client. So please
i have the WCF web service within my solution. service has interface which implemeted
i'm creating asmx web service and have to create thread to do background IO
This relates somewhat to: InvalidOperationException while creating wcf web service instance I have a

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.