2

i'm trying to setup a SOAP server with a function that reads an array of objects as parameter. I'm generating WSDL with php-wsdl. Here's my approach:

/**
 * TStanMag
 * 
 *
 * @pw_set nillable=false The next element can't be NULL
 * @pw_element string $kodTowaru Kod towaru
 * @pw_set nillable=false The next element can't be NULL
 * @pw_element float $ilosc Dostępna ilość
 * @pw_complex TStanMag Pozycja stanu magazynowego
 */
class TStanMag {
    public $kodTowaru;
    public $ilosc;
};

...

/**
 * Aktualizacja stanów magazynowych
 * 
 * @param string $key1 Klucz 1
 * @param string $key2 Klucz 2
 * @param TStanMag[] $stany Tabela stanów magazynowych
 * @param int $store_id
 * @return TResult[] Response
 */
public function AktualizujStanyMagazynowe($key1, $key2, $stany, $store_id = 0) {
...
}

but in WSDL i see this type instead of array of types:

<wsdl:part name="stany" type="tns:TStanMag[]">
<s:documentation>Tabela stanów magazynowych</s:documentation>
</wsdl:part>

also getting warning in SoapUI

Thu Mar 19 21:04:38 CET 2015:WARN:Failed to find type [{http://localhost/symsync/}TStanMag[]]

How can I fix this?

1
  • can you share the whole wsdl? is TStanMag type defined inside schema defined with http://localhost/symsync/ namespace? Commented Mar 19, 2015 at 22:09

1 Answer 1

1

In the meantime I solved this. Working code below.

/**
 * TStanMag
 * 
 *
 * @pw_set nillable=false The next element can't be NULL
 * @pw_element string $kodTowaru Kod towaru
 * @pw_set nillable=false The next element can't be NULL
 * @pw_element float $ilosc Dostępna ilość
 * @pw_complex TStanMag Pozycja stanu magazynowego
 */
class TStanMag {
    public $kodTowaru;
    public $ilosc;
};

/**
 * TStanMagArray
 * 
 *
 * @pw_element TStanMag $TStanMag Kod towaru
 * @pw_complex TStanMagArray Tablica pozycji stanu magazynowego
 */
class TStanMagArray {
    public $TStanMag;
};

...

/**
     * Aktualizacja stanów magazynowych
     * 
     * @param string $key1 Klucz 1
     * @param string $key2 Klucz 2
     * @param TStanMagArray $stany Tabela stanów magazynowych
     * @param int $store_id
     * @return TResultArray Response
     */
    public function AktualizujStanyMagazynowe($key1, $key2, $stany, $store_id = 0) {
Sign up to request clarification or add additional context in comments.

2 Comments

What did you do, please explain. It will other SO users will gain.
What I needed was creating TStanMagArray class as declared above. Note the ...Array suffix is needed by php-wsdl parser to "recognize" it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.