Home » Web Services » SOAP » Bug #7493
Error from incorrect char in element name (WSDL)
Details
| Submitted | 2006-04-26 13:56 UTC |
|---|---|
| From | karsten dot kuehnel at akb-net dot de |
| Assigned | yunosh |
| Status | Closed |
| Package | SOAP |
| PHP Version | 4.4.0 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2006-04-26 13:56 UTC] karsten dot kuehnel at akb-net dot de
Description:
------------
element name with ':' generate error:
Parse error: parse error, unexpected ':', expecting ')' in /usr/lib/php/SOAP/WSDL.php(730) : eval()'d code on line 7
Example from wsdl output:
...
<element name="tns1:benutzer" type="xsd:string"/>
...
my temp fix in WSDL.php:
add ':' in preg_replace functions and add two new lines to replace characters in element names.
here the diff -u output:
--- /usr/lib/php/SOAP/WSDL.php 2006-04-26 15:44:38.000000000 +0200
+++ WSDL.php 2006-04-26 15:43:16.000000000 +0200
@@ -542,7 +542,7 @@
} else {
$classname = 'WebService_' . $this->service;
}
- $classname = preg_replace('/[ .\-\(\)]+/', '_', $classname);
+ $classname = preg_replace('/[ :.\-\(\)]+/', '_', $classname);
}
if (!$this->_validateString($classname)) {
@@ -611,6 +611,7 @@
foreach ($operation['input'] as $argname => $argtype) {
if ($argname == 'message') {
foreach ($this->messages[$argtype] as $_argname => $_argtype) {
+ $_argname = preg_replace('/[ :.\-\(\)]+/', '_', $_argname);
if ($opstyle == 'document' && $use == 'literal' &&
$_argtype['name'] == 'parameters') {
// The type or element refered to is used for
@@ -626,6 +627,7 @@
}
if (isset($el['elements'])) {
foreach ($el['elements'] as $elname => $elattrs) {
+ $elname=preg_replace('/[ :.\-\(\)]+/', '_', $elname);
// Is the element a complex type?
if (isset($this->complexTypes[$elattrs['namespace']][$elname])) {
$comments .= $this->_complexTypeArg($args, $argarray, $_argtype, $_argname);
@@ -658,7 +660,7 @@
// legal. This could potentially cause collisions, but let's try
// to make everything callable and see how many problems that
// causes.
- $opname_php = preg_replace('/[ .\-\(\)]+/', '_', $opname);
+ $opname_php = preg_replace('/[ :.\-\(\)]+/', '_', $opname);
if (!$this->_validateString($opname_php)) {
return null;
}
@@ -720,7 +722,7 @@
$classname = $name . '_' . $classname;
}
- $classname = preg_replace('/[ .\-\(\)]+/', '_', $classname);
+ $classname = preg_replace('/[ :.\-\(\)]+/', '_', $classname);
if (!class_exists($classname)) {
$proxy = $this->generateProxyCode($port, $classname);
require_once 'SOAP/Client.php';
[2006-06-19 15:58 UTC] karsten dot kuehnel at akb-net dot de
your patch work's, client can call functions and retrive data.