Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequences without <item> #41

Open
rodrigobb opened this issue Jun 24, 2014 · 2 comments
Open

Sequences without <item> #41

rodrigobb opened this issue Jun 24, 2014 · 2 comments

Comments

@rodrigobb
Copy link

My problems is related with this: BeSimple/BeSimpleSoapBundle#29.

I have to process an xml item with a property "accessories" as described here:

<xs:element name="accessories" minOccurs="0">
    <xs:complexType>
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element name="accessory">
                <xs:complexType>
                    <xs:sequence>
                        [...]
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>

So the received XML Object is something like:

<accessories>
         <accessory>
            <description>Bla</description>
         </accessory>
[...]
         <accessory>
            <description>Bla</description>
         </accessory>
</accessories>

This is my accessories var definition:

/**
     * @var array
     * @Soap\ComplexType("Type\Accessory[]")
     */
    private $accessories;

BeSimpleSoap is unable to load this collection, returning allways null when I call $object->getAccessories()

If the received XML object were with "item" elements in sequence there's no problem, but I'm not I would be able to change received data as it's from an external system.

I mean, this works and loads...

<accessories>
   <item>
      <description>Bla</description>
   </item>
   [...]
   <item>
      <description>Bla</description>
   </item>
</accessories>

Is there something I can do?

@raziel057
Copy link

I encounter this problem too. In fact the XML should be:

<accessories>
    <description>Bla</description>
</accessories>
<accessories>
    <description>Bla</description>
</accessories>
[...]

In order to be able to call:
$accessories = $myObject->getAccessories();

Rather than:
$accessories = $myObject->getAccessories()->item;

I tried with SOAP webservices in EJB3 and the result is as in my example.

@raziel057
Copy link

From my tests (with SOAP UI), when I call the service exposed by Symfony + BeSimpleSoap, I got this response:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://organisation.novento-reloaded.eu/ws/MobileApi/1.0/">
   <SOAP-ENV:Body>
      <ns1:getMeetingListResponse>
         <return>
            <item>
               <id>1</id>
               <name>Symposium annuel des osthéopathes d'Europe</name>
               <participants>
                   <item>
                      <id>1</id>
                   </item>
                   <item>
                      <id>2</id>
                   </item>
               </participants>
            </item>
            <item>
               <id>2</id>
               <name>Réunion des dirigeants de l'industrie pharmaceutique</name>
            </item>
     </return>
      </ns1:getMeetingListResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

But I think we must not have the item keyword as for the same service exposed in J2EE EJB3:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://organisation.novento-reloaded.eu/ws/MobileApi/1.0/">
   <SOAP-ENV:Body>
      <ns1:getMeetingListResponse>
         <return>
             <id>1</id>
             <name>Symposium annuel des osthéopathes d'Europe</name>
             <participants>
                <id>1</id>
             </participants>
             <participants>
                <id>2</id>
             </participants>
          </return>
          <return>
             <id>2</id>
             <name>Réunion des dirigeants de l'industrie pharmaceutique</name>
          </return>
      </ns1:getMeetingListResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants