Php 联邦快递费率API-解析soap响应

Php 联邦快递费率API-解析soap响应,php,api,soap,fedex,Php,Api,Soap,Fedex,我正在使用联邦快递费率API,并有以下SOAP响应。我以前从未解析过soap,下面是我的尝试,但没有结果。有人能帮忙吗 <soapenv:Envelope> <env:Header/> <soapenv:Body> <v10:RateReply> <v10:HighestSeverity>SUCCESS</v10:HighestSeverity> <v10:Notificatio

我正在使用联邦快递费率API,并有以下SOAP响应。我以前从未解析过soap,下面是我的尝试,但没有结果。有人能帮忙吗

<soapenv:Envelope>
  <env:Header/>
  <soapenv:Body>
    <v10:RateReply>
      <v10:HighestSeverity>SUCCESS</v10:HighestSeverity>
      <v10:Notifications>
        <v10:Severity>SUCCESS</v10:Severity>
        <v10:Source>crs</v10:Source>
        <v10:Code>0</v10:Code>
        <v10:Message>Request was successfully processed. </v10:Message>
        <v10:LocalizedMessage>Request was successfully processed. </v10:LocalizedMessage>
      </v10:Notifications>
      <ns1:TransactionDetail>
        <ns1:CustomerTransactionId> *** Rate Available Services Request v10 using PHP ***</ns1:CustomerTransactionId>
      </ns1:TransactionDetail>
      <ns1:Version>
        <ns1:ServiceId>crs</ns1:ServiceId>
        <ns1:Major>10</ns1:Major>
        <ns1:Intermediate>0</ns1:Intermediate>
        <ns1:Minor>0</ns1:Minor>
      </ns1:Version>
      <v10:RateReplyDetails>
        <v10:ServiceType>INTERNATIONAL_FIRST</v10:ServiceType>
        <v10:PackagingType>YOUR_PACKAGING</v10:PackagingType>
        <v10:DeliveryStation>DKKA </v10:DeliveryStation>
        <v10:DeliveryDayOfWeek>MON</v10:DeliveryDayOfWeek>
        <v10:DeliveryTimestamp>2012-12-10T09:00:00</v10:DeliveryTimestamp>
        <v10:CommitDetails>
          <v10:CommodityName>DOCUMENTS</v10:CommodityName>
          <v10:ServiceType>INTERNATIONAL_FIRST</v10:ServiceType>
          <v10:CommitTimestamp>2012-12-10T09:00:00</v10:CommitTimestamp>
          <v10:DayOfWeek>MON</v10:DayOfWeek>
          <v10:DestinationServiceArea>A4</v10:DestinationServiceArea>
          <v10:BrokerToDestinationDays>0</v10:BrokerToDestinationDays>
          <v10:CommitMessages>
            <v10:Code>134</v10:Code>
            <v10:Message>REQUEST COMPLETED</v10:Message>
          </v10:CommitMessages>
          <v10:DeliveryMessages> 9:00 A.M. IF NO CUSTOMS DELAY</v10:DeliveryMessages>
          <v10:DocumentContent>DOCUMENTS_ONLY</v10:DocumentContent>
          <v10:RequiredDocuments>INTERNATIONAL_AIRWAY_BILL</v10:RequiredDocuments>
        </v10:CommitDetails>
        <v10:DestinationAirportId>BUF</v10:DestinationAirportId>
        <v10:IneligibleForMoneyBackGuarantee>false</v10:IneligibleForMoneyBackGuarantee>
        <v10:OriginServiceArea>AM</v10:OriginServiceArea>
        <v10:DestinationServiceArea>A4</v10:DestinationServiceArea>
        <v10:SignatureOption>INDIRECT</v10:SignatureOption>
        <v10:ActualRateType>PAYOR_ACCOUNT_SHIPMENT</v10:ActualRateType>
        <v10:RatedShipmentDetails></v10:RatedShipmentDetails>
        <v10:RatedShipmentDetails></v10:RatedShipmentDetails>
      </v10:RateReplyDetails>
      <v10:RateReplyDetails>
        <v10:ServiceType>INTERNATIONAL_PRIORITY</v10:ServiceType>
        <v10:PackagingType>YOUR_PACKAGING</v10:PackagingType>
        <v10:DeliveryStation>DKKA </v10:DeliveryStation>
        <v10:DeliveryDayOfWeek>MON</v10:DeliveryDayOfWeek>
        <v10:DeliveryTimestamp>2012-12-10T10:30:00</v10:DeliveryTimestamp>
        <v10:CommitDetails>
          <v10:CommodityName>DOCUMENTS</v10:CommodityName>
          <v10:ServiceType>INTERNATIONAL_PRIORITY</v10:ServiceType>
          <v10:CommitTimestamp>2012-12-10T10:30:00</v10:CommitTimestamp>
          <v10:DayOfWeek>MON</v10:DayOfWeek>
          <v10:DestinationServiceArea>A4</v10:DestinationServiceArea>
          <v10:BrokerToDestinationDays>0</v10:BrokerToDestinationDays>
          <v10:CommitMessages>
            <v10:Code>134</v10:Code>
            <v10:Message>REQUEST COMPLETED</v10:Message>
          </v10:CommitMessages>
          <v10:DeliveryMessages>10:30 A.M. IF NO CUSTOMS DELAY</v10:DeliveryMessages>
          <v10:DocumentContent>DOCUMENTS_ONLY</v10:DocumentContent>
          <v10:RequiredDocuments>INTERNATIONAL_AIRWAY_BILL</v10:RequiredDocuments>
        </v10:CommitDetails>
        <v10:DestinationAirportId>BUF</v10:DestinationAirportId>
        <v10:IneligibleForMoneyBackGuarantee>false</v10:IneligibleForMoneyBackGuarantee>
        <v10:OriginServiceArea>AM</v10:OriginServiceArea>
        <v10:DestinationServiceArea>A4</v10:DestinationServiceArea>
        <v10:SignatureOption>INDIRECT</v10:SignatureOption>
        <v10:ActualRateType>PAYOR_ACCOUNT_SHIPMENT</v10:ActualRateType>
        <v10:RatedShipmentDetails></v10:RatedShipmentDetails>
        <v10:RatedShipmentDetails></v10:RatedShipmentDetails>
      </v10:RateReplyDetails>
      <v10:RateReplyDetails>
        <v10:ServiceType>INTERNATIONAL_ECONOMY</v10:ServiceType>
        <v10:PackagingType>YOUR_PACKAGING</v10:PackagingType>
        <v10:DeliveryStation>DKKA </v10:DeliveryStation>
        <v10:DeliveryDayOfWeek>WED</v10:DeliveryDayOfWeek>
        <v10:DeliveryTimestamp>2012-12-12T16:30:00</v10:DeliveryTimestamp>
        <v10:CommitDetails>
          <v10:CommodityName>DOCUMENTS</v10:CommodityName>
          <v10:ServiceType>INTERNATIONAL_ECONOMY</v10:ServiceType>
          <v10:CommitTimestamp>2012-12-12T16:30:00</v10:CommitTimestamp>
          <v10:DayOfWeek>WED</v10:DayOfWeek>
          <v10:DestinationServiceArea>A4</v10:DestinationServiceArea>
          <v10:BrokerToDestinationDays>0</v10:BrokerToDestinationDays>
          <v10:CommitMessages>
            <v10:Code>134</v10:Code>
            <v10:Message>REQUEST COMPLETED</v10:Message>
          </v10:CommitMessages>
          <v10:DeliveryMessages> 4:30 P.M. IF NO CUSTOMS DELAY</v10:DeliveryMessages>
          <v10:DocumentContent>DOCUMENTS_ONLY</v10:DocumentContent>
          <v10:RequiredDocuments>INTERNATIONAL_AIRWAY_BILL</v10:RequiredDocuments>
        </v10:CommitDetails>
        <v10:DestinationAirportId>BUF</v10:DestinationAirportId>
        <v10:IneligibleForMoneyBackGuarantee>false</v10:IneligibleForMoneyBackGuarantee>
        <v10:OriginServiceArea>AM</v10:OriginServiceArea>
        <v10:DestinationServiceArea>A4</v10:DestinationServiceArea>
        <v10:SignatureOption>INDIRECT</v10:SignatureOption>
        <v10:ActualRateType>PAYOR_ACCOUNT_SHIPMENT</v10:ActualRateType>
        <v10:RatedShipmentDetails></v10:RatedShipmentDetails>
        <v10:RatedShipmentDetails></v10:RatedShipmentDetails>
      </v10:RateReplyDetails>
    </v10:RateReply>
  </soapenv:Body>
</soapenv:Envelope>

我正在尝试通过
节点进行循环。

我在正确的线路上,回答如下:

$fedex_xml = simplexml_load_string($fedex_response);

$RateReply = $fedex_xml->children("env", true)->Body->children("v13", true)->RateReply;
foreach($RateReply->RateReplyDetails as $details){

}
$fedex_xml = simplexml_load_string($fedex_response);

$RateReply = $fedex_xml->children("env", true)->Body->children("v13", true)->RateReply;
foreach($RateReply->RateReplyDetails as $details){

}