php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34449 ext/soap: XSD_ANYXML functionality not exposed
Submitted: 2005-09-09 21:19 UTC Modified: 2005-09-12 10:26 UTC
From: trsnoozy at avstgroup dot com Assigned: dmitry (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 5.1.0RC1 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: trsnoozy at avstgroup dot com
New email:
PHP Version: OS:

 

 [2005-09-09 21:19 UTC] trsnoozy at avstgroup dot com
Description:
------------
To the best of my knowledge, I should be able to pass a raw XML document (fragment) into the SOAP payload (i.e., XML Schema's anyXml). SoapVar -can- do this, however, the constant that activates this functionality (XSD_ANYXML) is not exported by the extension, nor is it documented in the help.

Reproduce code:
---------------
<?php
  $location = "http://www.example.org/example_service";
  $uri = "http://www.example.org/schemas/example_service";
  $my_xml = "<array><item/><item/><item/></array>";
  $client = new SoapClient(null, array('location' => $location, 'uri' => $uri);
  $var = new SoapVar($my_xml, XSD_ANYXML);
  $param = new SoapParam($var, "XMLData");
  $client->AnyFunction($param);
?>

Expected result:
----------------
The SOAP call should contain the non-escaped, literal text of $my_xml.

This behavior will occur if XSD_ANYXML is define()'d to 147. If you have netcat, you can set the $location value appropriately to point at a port (like http://localhost:1234) then set up netcat to listen on that port (nc -l -p 1234). This will show that the literal XML is, in fact, passed through as it should be.


Actual result:
--------------
The script will blow up with an warning about XSD_ANYXML being undefined, followed by an error stating that it's an invalid value for SoapVar.

The problem is easily solved by registering the XSD_ANYXML #define as a PHP constant in the ext/soap/soap.c file. Naturally, adding this constant to the help files would be nice, too :).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-12 10:26 UTC] dmitry@php.net
Fixed in CVS HEAD, PHP_5_1 and PHP_5_0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC