|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40318 SOAP_ENC_OBJECT does not encode object properties with namespace
Submitted: 2007-02-02 06:05 UTC Modified: 2007-03-30 09:37 UTC
From: bink at eezi dot net dot au Assigned: dmitry (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5.2.0 OS: Redhat
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: bink at eezi dot net dot au
New email:
PHP Version: OS:


 [2007-02-02 06:05 UTC] bink at eezi dot net dot au
Possibly a documentation issue
When using a php object to create SOAP request headers, the SoapVAR($obj, SOAP_ENC_OBJECT....) and SoapHeader($namespace, $name, $soapvar) does not set the namespace of the object properties to the same as the object itself.

Reproduce code:
$client = new SOAPClient($wsdl, array('trace' => '1'));

class headers {
function __construct($val1, $val2){
$this->val1 = $val1;
$this->val2 = $val2;

$obj = new headers('val1','val2');

$svval=new SoapVar($obj,SOAP_ENC_OBJECT, NULL, NULL, "", "");

$header = new SoapHeader("",
                           $svval, false);




Expected result:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:ns1="" xmlns:ns2="">

Actual result:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:ns1="" xmlns:ns2="">


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-02 06:31 UTC] bink at eezi dot net dot au
The Namespaces on the Actual result are incorrect, they should match up with the Expected result....
 [2007-02-05 20:38 UTC]
Please try using this CVS snapshot:
For Windows:

 [2007-02-06 00:45 UTC] bink at eezi dot net dot au
I'm not able to test cvs, this is being used on our development and production servers. If there is someone else out there with a server running cvs I coule setup a trial on it to see... Just need shell access on a normal user....
 [2007-02-15 10:51 UTC]
Pleaseprovide the WSDL file.
I am not able to check your example without it.
 [2007-02-16 02:11 UTC] bink at eezi dot net dot au
The WSDL shouldn't affect the encoding, unfortunately due to NDA issues, I can't send it to you...

The error can be replicated with or without wsdl operation, the namespace still isn't set for object properties when the object is encoded with a namespace.
 [2007-03-30 09:37 UTC]
Without WSDL file ext/soap cannot know that "val1" element must be namespace qualified and it cannot guess which namespace to use.

WSDL file may specify the encoding rules for the soap header, but without WSDL we must not add any namespace.

If you really need namespace qualification, but don't declare SOAP header in WSDL file, you can add namespaces manually using SoapVar.
Replace header constructor with the following code and you will get that you like (or write proper WSDL).

class headers {
  function __construct($val1, $val2){
    $this->val1 = new SoapVar($val1, XSD_STRING, NULL, NULL,
                              "val1", "");
    $this->val2 = new SoapVar($val2, XSD_STRING, NULL, NULL,
                              "val1", "");
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 11:01:24 2019 UTC