1

I have a Online Trust Alliance xsd that i want to parse with php soap client. I can generate soap parameter for normal xml structure with

`$params['OTA_HotelAvailRQ']['AvailRequestSegments']['AvailRequestSegment ']['Criterion ']['ChainCode'] = $chain_code`;

but how do i generate params for this OTA standard xsds see example below:

    <OTA_HotelAvailRQ xmlns="http://www.opentravel.org/OTA/2003/05" AvailRatesOnly="true" EchoToken="Single" ExactMatchOnly="true" PrimaryLangID="EN" RateDetailsInd="true" RateRangeOnly="true" RequestedCurrency="GBP" SummaryOnly="true" Version="6.000" OnRequestInd="true">
  <AvailRequestSegments>
    <AvailRequestSegment InfoSource="Distribution">
      <HotelSearchCriteria AvailableOnlyIndicator="true">
        <Criterion ExactMatch="true">
          <HotelRef ChainCode="CH" HotelCityCode="HCC" HotelCode="CHHCC"></HotelRef>
          <StayDateRange Start="2013-12-20" End="2013-12-25"/>
          <RoomStayCandidates>
            <RoomStayCandidate Quantity="2">
              <GuestCounts>
                <GuestCount AgeQualifyingCode="10" Count="2"/>
              </GuestCounts>
            </RoomStayCandidate>
          </RoomStayCandidates>
        </Criterion>
      </HotelSearchCriteria>
    </AvailRequestSegment>
  </AvailRequestSegments>
</OTA_HotelAvailRQ>

I just need a little guidance for this.

Tariq G
  • 346
  • 2
  • 9
  • What exactly about the more complex request are you finding problematic? – IMSoP Nov 09 '13 at 15:57
  • if you see the attribute are within schema . when i create parameter it generate xml like true – Tariq G Nov 10 '13 at 19:48
  • OK, so the question is how to generate attributes rather than child elements? Are you initialising the SOAPClient with a WSDL, or just defining the endpoint and actions as direct options? – IMSoP Nov 11 '13 at 14:54
  • yes its more how to generate attribute. yes initialising the soap client with wsdl. – Tariq G Nov 14 '13 at 20:03
  • yes thats right, i am not able to generate attribute as there are multiple attributes for some elements. and yes, soapClient is initialised with WSDL where WSDL file have all the references to schema files. – Tariq G Jan 05 '14 at 13:25
  • Would it not just be `$params['OTA_HotelAvailRQ']['AvailRequestSegments']['AvailRequestSegment']['Criterion']['HotelRef']['ChainCode'] = $chain_code` ...? Given that it reads the schema from the WSDL, the SoapClient can decide automatically whether to generate a child element or attribute... – IMSoP Jan 05 '14 at 18:19
  • if you read above the question, this is what i was using without luck. :-( – Tariq G Jan 05 '14 at 23:36
  • Ah, OK. It wasn't clear, because your example had `['Criterion']['ChainCode']`, which doesn't fit the desired structure, but that was probably just a mistake copying it into the question. – IMSoP Jan 06 '14 at 09:12
  • yes, that was just typo. I will investigate more and update later here. thnx for your help – Tariq G Jan 06 '14 at 10:53

1 Answers1

2

take a look here https://github.com/goetas/xsd2php

It will help you read and parse requests/responses

Asmir Mustafic
  • 533
  • 4
  • 14
  • 1
    Link-only answers are discouraged because they will become useless if the linked resource changes or is deleted. Try to summarise the key points of the linked article, as they relate to this question, in the answer itself. – IMSoP Nov 15 '14 at 12:03