PHP Classes

part name reuse

Recommend this page to a friend!

      PHP WSDL Generator  >  All threads  >  part name reuse  >  (Un) Subscribe thread alerts  
Subject:part name reuse
Summary:<part name="xxx"... xxx cannot be reused properly
Messages:5
Author:Galmok
Date:2009-08-07 09:38:26
Update:2009-08-07 10:31:52
 

  1. part name reuse   Reply   Report abuse  
Picture of Galmok Galmok - 2009-08-07 09:38:26
I have several functions with many of the same arguments and while php2wsdl exports the functions with their arguments, the part names that take the name of the arguments are renamed, or rather, using the same argument name in different functions causes the epeated used argument name to be added a "1". An example:

php:

function A(a, b, c) {}
function B(a, b, d) {}
function C(a, b, e) {}

wsdl:

...
<message name="A">
<part name="a" type="xsd:string"/>
<part name="b" type="xsd:datetime"/>
<part name="c" type="xsd:float"/>
...
<message name="B">
<part name="a1" type="xsd:string"/>
<part name="b1" type="xsd:datetime"/>
<part name="d" type="xsd:float"/>
...
<message name="C">
<part name="a1" type="xsd:string"/>
<part name="b1" type="xsd:datetime"/>
<part name="e" type="xsd:float"/>
...

Why are the part names called "a1" and "b1" when they should be called just "a" and "b"?

  2. Re: part name reuse   Reply   Report abuse  
Picture of Protung Dragos Protung Dragos - 2009-08-07 10:02:44 - In reply to message 1 from Galmok
I know about this "feature" and i had a reason when i've create the class, but i can't remember now.

It's been a while since i've worked on this class.
It needs to be rewritten.
I plan on doing this soon.

I know my answer does not satisfy you... but please bare with me until i rewrite this class.

  3. Re: part name reuse   Reply   Report abuse  
Picture of Galmok Galmok - 2009-08-07 10:28:05 - In reply to message 2 from Protung Dragos
Ok, but is there a quick hack I can do? Checking for part name reuse seems like something that would be easy to "disable". ;-)

  4. Re: part name reuse   Reply   Report abuse  
Picture of Galmok Galmok - 2009-08-07 10:30:54 - In reply to message 3 from Galmok
In WSDLCreator.php, I commented this line:

$pname = $pname.($this->paramsNames[$pname]+1);

Now, the part name can be reused. :-)

  5. Re: part name reuse   Reply   Report abuse  
Picture of Protung Dragos Protung Dragos - 2009-08-07 10:31:52 - In reply to message 3 from Galmok
from the createMessage() method comment out these lines:

if (isset($this->paramsNames[$pname])) {
$pname = $pname.($this->paramsNames[$pname]+1);
} else {
$this->paramsNames[$pname] = 0;
}

i haven't checked if that is all you need to do, but try it out.

 
For more information send a message to info at phpclasses dot org.