beesasoh
beesasoh

Reputation: 2135

PHP nusoap how to remove array wrapper element from response

I am using PHP nusoap library to create a webservice. The service returns 2 fields and an array of users and soap body is formatted as below:

<company></company>
<noOfUsers></noOfUsers>
<users>
    <user>
      .......
    </user>
    <user>
      .......
    </user>
    <user>
      .......
    </user>
</users>

How can i change this response to remove the users wrapper so that the response looks like:

<company></company>
<noOfUsers></noOfUsers>
<user>
.......
</user>
<user>
.......
</user>
<user>
.......
</user>

Upvotes: 0

Views: 530

Answers (1)

Aleksei Matiushkin
Aleksei Matiushkin

Reputation: 121010

TL;DR: you can’t

This is impossible because valid XML document can not have top-level nodes with same names. I bet there should be kinda hack/workaround, but I woul suggest you not to enter this territory and deal with what’s being generated by default.

Upvotes: 1

Related Questions