phpro / soap-client

A general purpose SOAP client for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SoapVar object is not converted to respective classes

ajay668496 opened this issue · comments

Need help to resolve this issue.

Q A
Version 1.7.4

Support Question

I am facing issues when decoding SoapResponse to PHP objects. Request & response XMLs are generated as per my requirement, but XML to PHP conversion is not working as per my requirement. There are some SoapVars in decoded response which needs to be converted to objects of classes defined in classmap.

Request XSD: https://soap.provisdemo.com/server/OpenTravel_2021A_XML/OTA_HotelRateAmountNotifRQ.xsd
Response XSD: https://soap.provisdemo.com/server/OpenTravel_2021A_XML/OTA_HotelRateAmountNotifRS.xsd
WSDL: https://soap.provisdemo.com/server/hotel.wsdl
Request: https://soap.provisdemo.com/hotelRateAmountNotifRQ.php
Response: https://soap.provisdemo.com/hotelRateAmountNotifRS.php

Please guide me as it is taking lot of time to debug this issue.

Thanks

Hello,

It seems like the type is marked as a special any type:

                    [TPA_Extensions:Ota\Type\Other\UniqueIDType:private] => SoapVar Object
                        (
                            [enc_type] => 0
                            [enc_value] => Ota\Type\TPAExtensionsType Object
                                (
                                    [any:Ota\Type\TPAExtensionsType:private] => Array
                                        (
                                            [text] => UniqueID
                                        )

                                )

                            [enc_stype] => TPA_ExtensionsType
                            [enc_ns] => http://www.opentravel.org/OTA/2003/05
                        )
                )

PHP's ext-soap converts this to a SoapVar instead of a raw value.
You might be able to create a type converter to handle {http://www.opentravel.org/OTA/2003/05:TPA_ExtensionsType} types the way you want to handle them?

Hello veewee,

Thanks for the provided solution. I have successfully removed SoapVars using type converters. You saved my time.

Thank you