Jump to content

Retrieving elements from a soap response


aim2678

Recommended Posts

I am new to PHP and I am having trouble retrieving the following xpath value "//soapenv:Envelope/soapenv:Body/RateReply/RatedShipmentDetails/ShipmentRateDetai/TotalNetCharge/Amount"

 

Below is a sample of the Soap response.

Any help retrieving this value will be greatly appreciated.

Thanks in advance  :)

 

<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Header/>

<soapenv:Body>

<RateReply xmlns="http://myservername.com/ws/rate/v1" xmlns:m="http://com/myservername/ws/transform">

<HighestSeverity>SUCCESS</HighestSeverity>

<Notifications>

<Severity>SUCCESS</Severity>

<Source>crs</Source>

</Notifications>

<TransactionDetail xmlns:ns1="http://myservername.com/ws/rate/v1" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

<CustomerTransactionId> *** Rate Request using PHP ***</CustomerTransactionId>

</TransactionDetail>

<Version xmlns:ns1="http://myservername.com/ws/rate/v1" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

<Major>1</Major>

<Intermediate>1</Intermediate>

<Minor>0</Minor>

</Version>

<OriginServiceArea>A2</OriginServiceArea>

<DestinationServiceArea>A1</DestinationServiceArea>

<SignatureOption>SERVICE_DEFAULT</SignatureOption>

<ActualRateType>PAYOR_ACCOUNT</ActualRateType>

<RatedShipmentDetails>

<ShipmentRateDetail>

<RateType>PAYOR_ACCOUNT</RateType>

<RateScale>00001</RateScale>

<TotalBillingWeight>

<Units>LB</Units>

<Value>10.0</Value>

</TotalBillingWeight>

<TotalBaseCharge>

<Currency>USD</Currency>

<Amount>48.50</Amount>

</TotalBaseCharge>

<TotalFreightDiscounts>

<Currency>USD</Currency>

<Amount>0.00</Amount>

</TotalFreightDiscounts>

<TotalSurcharges>

<Currency>USD</Currency>

<Amount>16.50</Amount>

</TotalSurcharges>

<TotalNetCharge>

<Currency>USD</Currency>

<Amount>65.00</Amount>

</TotalNetCharge>

</ShipmentRateDetail>

<RatedPackages>

<PackageRateDetail>

<RateType>PAYOR_ACCOUNT</RateType>

<RatedWeightMethod>ACTUAL</RatedWeightMethod>

<BillingWeight>

<Units>LB</Units>

<Value>10.0</Value>

</BillingWeight>

<BaseCharge>

<Currency>USD</Currency>

<Amount>48.50</Amount>

</BaseCharge>

<TotalFreightDiscounts>

<Currency>USD</Currency>

<Amount>0.00</Amount>

</TotalFreightDiscounts>

<TotalSurcharges>

<Currency>USD</Currency>

<Amount>16.50</Amount>

</TotalSurcharges>

<NetCharge>

<Currency>USD</Currency>

<Amount>65.00</Amount>

</NetCharge>

<Surcharges>

<SurchargeType>COD</SurchargeType>

<Amount>

<Currency>USD</Currency>

<Amount>8.50</Amount>

</Amount>

</Surcharges>

<Surcharges>

<SurchargeType>FUEL</SurchargeType>

<Amount>

<Currency>USD</Currency>

<Amount>8.00</Amount>

</Amount>

</Surcharges>

<Surcharges>

<SurchargeType>INSURED_VALUE</SurchargeType>

<Amount>

<Currency>USD</Currency>

<Amount>0.00</Amount>

</Amount>

</Surcharges>

<Surcharges>

<SurchargeType>OTHER</SurchargeType>

<Amount>

<Currency>USD</Currency>

<Amount>0.00</Amount>

</Amount>

</Surcharges>

</PackageRateDetail>

</RatedPackages>

</RatedShipmentDetails>

</RateReply>

</soapenv:Body>

</soapenv:Envelope>

Link to comment
https://forums.phpfreaks.com/topic/71907-retrieving-elements-from-a-soap-response/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.