Login   Register  
PHP Classes
elePHPant
Icontem

No objects nor arrays

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP WSDL Generator  >  All threads  >  No objects nor arrays  >  (Un) Subscribe thread alerts  
Subject:No objects nor arrays
Summary:It is not able to export some data types
Messages:7
Author:Lucjan
Date:2008-09-24 12:40:03
Update:2009-08-10 09:11:29
 

  1. No objects nor arrays   Reply   Report abuse  
Picture of Lucjan
Lucjan
2008-09-24 12:40:03
Hi!

PHP WSDL Generator is excellent, but it lacks of some things or maybe I can't find how to use it (sorry for my english)

1. If I create a class that is returned by main class method, the wsld definition doesn't define the structure of this class, i.e.

class mainClass {

/**
* @return someClass
*/
public function mainClassMethod() {
$ob = new someClass()
return $ob;
}
}

class someClass {
/**
* @var integer blahblah
*/
public $field1;
/**
* @var string blahblah
*/
public $field2;
}

The WSDL file generates sth like this:

<definitions ...>
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:...">
<xsd:complexType name="someClass">
<xsd:all>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
...
</definitions>

So there is no details about structure of someClass class.

2. How can I set @return datatype as array? Is it possible?
I.e. I would like to return array of someClass, but

@return someClass[] ...

doesn't work. Instead

@return someClass ...

works fine.


I hope it was comprensible. Best regards!

  2. Re: No objects nor arrays   Reply   Report abuse  
Picture of Protung Dragos
Protung Dragos
2008-11-28 13:19:24 - In reply to message 1 from Lucjan
Support was added.
Maybe you can do some testing.

Thnak you

  3. Re: No objects nor arrays   Reply   Report abuse  
Picture of Protung Dragos
Protung Dragos
2008-11-28 13:43:57 - In reply to message 2 from Protung Dragos
Suppor tfor class description (public members) will be added soon

  4. Re: No objects nor arrays   Reply   Report abuse  
Picture of Galmok
Galmok
2009-08-07 11:09:32 - In reply to message 3 from Protung Dragos
How difficult would it be to add support for public class members? I don't know how the wsdl should look and can't add it manually. And I really need it. :-/

  5. Re: No objects nor arrays   Reply   Report abuse  
Picture of Galmok
Galmok
2009-08-07 11:58:04 - In reply to message 4 from Galmok
I think I can make it work with arrays of arrays but I am not sure if php2wsdl exports it correctly as soapclient.com chokes on my wsdl with this error:

Error parsing the WSDL file: https://<sitename>/soap/?wsdl Error at Line 17, position 3345 Error c00cee01, Unexpected end of input.

but http://www.validwsdl.com/ accepts the wsdl just fine.

Update: It turns out soapclient.com doesn't accept lines longer than about 6-8000 bytes. Taking the WSDL and inserting newlines makes it accept the wsdl generated. :-)

Maybe newlines should be inserted automatically?

  6. Re: No objects nor arrays   Reply   Report abuse  
Picture of Galmok
Galmok
2009-08-10 08:52:37 - In reply to message 5 from Galmok
A new issue has cropped up. Visual Studio complains about the generated wsdl file if I return this:

@return Array[][]

I get these complaints from Visual Studio (sorry, in Danish):

Dokumentet på URL-adressen https://<server>/soap/?wsdl blev ikke genkendt som en kendt dokumenttype.
Fejlmeddelelserne fra de kendte typer kan hjælpe dig med at løse problemet:
- Rapporten fra 'DISCO-dokument' er 'Discovery-dokumentet på URL-adressen https://<server>/soap/?wsdl blev ikke fundet.'.
- Dokumentets format kan ikke genkendes.
- Rapporten fra 'WSDL-dokument' er 'Der er en fejl i XML-dokumentet (3, 480).'.
- Navneområdepræfikset 'urn' er ikke defineret.
- Rapporten fra 'XML-skema' er 'Rodelementet for et W3C XML-skema skal være <schema>, og dets navneområde skal være 'http://www.w3.org/2001/XMLSchema'.'.

Even though the error message is in Danish, one of the issues is the "urn not defined" issue. I tested the result with a couple of webbased wsdl validators/invokers and they had no problem with the generated wsdl file. That doesn't mean, though, that the file is without errors. :-/

After some grinding in google, it seems .NET isn't able to handle ArrayOfArrays at all. It seems ArrayOfArrays is a 2-dimensional array, but that is not what I want. I want to reply with something like this:

$r = array();
$r[] = array(
"A" => "123456789",
"B" => "12345678",
"C" => "blah blah");
$r[] = array(
"A" => "x123456789",
"B" => "x12345678",
"C" => "xBlah blah");
$r[] = array(
"A" => "y123456789",
"B" => "y12345678",
"C" => "ydksfgjyhkj");

  7. Re: No objects nor arrays   Reply   Report abuse  
Picture of Protung Dragos
Protung Dragos
2009-08-10 09:11:29 - In reply to message 6 from Galmok
@return Array[][] is not supported ... sorry :(

as i said numerous times, i will remake the class with more support
i just didn't had time to start