0

我正在尝试使用 XML 集成 UPS API,以提取所有可用的运输类型及其给定送货地址的运费。我正在使用这个 XML,它适用于给定的运输类型,我想获得所有可用的运输类型。任何人都可以帮助我使用正确的 xml 吗?

 $data ="<?xml version=\"1.0\"?>  
        <AccessRequest xml:lang=\"en-US\">  
            <AccessLicenseNumber>$this->AccessLicenseNumber</AccessLicenseNumber>  
            <UserId>$this->UserID</UserId>  
            <Password>$this->Password</Password>  
        </AccessRequest>  
        <?xml version=\"1.0\"?>  
        <RatingServiceSelectionRequest xml:lang=\"en-US\">  
            <Request>  
            <TransactionReference>  
                <CustomerContext>Bare Bones Rate Request</CustomerContext>  
                <XpciVersion>1.0001</XpciVersion>  
            </TransactionReference>  
            <RequestAction>Rate</RequestAction>  
            <RequestOption>Rate</RequestOption>  
            </Request>  
        <PickupType>  
            <Code>01</Code>  
        </PickupType>  
        <Shipment>  
            <Shipper>  
            <Address>  
                <PostalCode>ZIP</PostalCode>  
                <CountryCode>US</CountryCode> 
                <AddressLine1>ADDRESS1</AddressLine1>
                <City>CITY</City>
                <StateProvinceCode>STATE</StateProvinceCode>
            </Address>  
            <ShipperNumber>$this->shipperNumber</ShipperNumber>  
            </Shipper>  
            <ShipTo>  
            <Address>  
                <PostalCode>$dest_zip</PostalCode>  
                <CountryCode>US</CountryCode>  
                <AddressLine1>$dest_addr</AddressLine1>
                <City>$dest_city</City>
                <StateProvinceCode>$dest_state</StateProvinceCode>
            </Address>  
            </ShipTo>  
            <ShipFrom>  
            <Address>  
                <PostalCode>$this->sourceZip</PostalCode>  
                <CountryCode>US</CountryCode>  
            </Address>  
            </ShipFrom>  
            <Service>  
            <Code>$service</Code>  
            </Service>  
            <Package>  
            <PackagingType>  
                <Code>02</Code>  
            </PackagingType>  
            <Dimensions>  
                <UnitOfMeasurement>  
                <Code>$this->dimensionsUnits</Code>     
                </UnitOfMeasurement>  
                <Length>$length</Length>  
                <Width>$width</Width>  
                <Height>$height</Height>  
            </Dimensions>  
            <PackageWeight>  
                <UnitOfMeasurement>  
                <Code>$this->weightUnits</Code>  
                </UnitOfMeasurement>  
                <Weight>$weight</Weight>  
            </PackageWeight>  
            </Package>  
        </Shipment>  
        </RatingServiceSelectionRequest>";  

谢谢!

4

1 回答 1

0

我得到了这个答案,以防其他人想知道。

我们只需要在 XML 中更改这部分

<RequestOption>Rate</RequestOption> 

它为 <RequestOption>Shop</RequestOption> 我们提供了所有可用运输类型的费率。

于 2020-01-30T22:37:24.133 回答