0
我正在使用FEDEX費率API並具有以下SOAP響應。我從來沒有解析過肥皂前後是我的嘗試,但我沒有結果。任何人都可以協助FEDEX費率API - 解析肥皂響應
<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);
$RateReplyDetails = $fedex_xml->children("soapenv", true)->Body->children("v10", true)->RateReply->children()->RateReplyDetails;
var_dump($RateReplyDetails);
foreach ($RateReplyDetails as $details) {
print_r($details);
}
我通過<v10:RateReplyDetails>
節點嘗試循環。