【发布时间】:2016-03-27 23:21:31
【问题描述】:
我正在尝试使用 NetSuite Suitelet 中的 UPS Rating API。当我使用 nlapiRequestURL 执行此操作时,我从 UPS 收到错误“XML 声明格式不正确”。我一直在盯着这个 XML,我找不到我做错了什么。有人有想法吗? 为什么我的 XML 格式不正确?
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<UPSSecurity xmlns="http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0">
<UsernameToken>
<Username>xxxxxxxxx</Username>
<Password>xxxxxxxxx</Password>
</UsernameToken>
<ServiceAccessToken>
<AccessLicenseNumber>xxxxxxxxx</AccessLicenseNumber>
</ServiceAccessToken>
</UPSSecurity>
</soap:Header>
<soap:Body>
<RateRequest xmlns="http://www.ups.com/XMLSchema/XOLTWS/Rate/v1.1">
<Request xmlns="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
<RequestOption>rate</RequestOption>
</Request>
<CustomerClassification>
<Code>00</Code>
</CustomerClassification>
<Shipment>
<Shipper>
<ShipperNumber>xxxxxx</ShipperNumber>
<Address>
<StateProvinceCode>WA</StateProvinceCode>
<PostalCode>98134</PostalCode>
<CountryCode>US</CountryCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<StateProvinceCode>CA</StateProvinceCode>
<PostalCode>90210</PostalCode>
<CountryCode>US</CountryCode>
</Address>
</ShipTo>
<ShipFrom>
<Address>
<StateProvinceCode>WA</StateProvinceCode>
<PostalCode>98134</PostalCode>
<CountryCode>US</CountryCode>
</Address>
</ShipFrom>
<Package>
<PackagingType><Code>00</Code></PackagingType>
<Dimensions>
<UnitOfMeasurement><Code>IN</Code></UnitOfMeasurement>
<Length>5</Length>
<Width>5</Width>
<Height>5</Height>
</Dimensions>
<PackageWeight>
<UnitOfMeasurement>
<Code>lbs</Code>
<Description>Pounds</Description>
</UnitOfMeasurement>
<Weight>5</Weight>
</PackageWeight>
</Package>
<ShipmentRatingOptions>
<NegotiatedRatesIndicator>1</NegotiatedRatesIndicator>
</ShipmentRatingOptions>
<ShipmentServiceOptions>
<SaturdayDeliveryIndicator>1</SaturdayDeliveryIndicator>
</ShipmentServiceOptions>
<Service>
<Code>14</Code><!-- code for the UPS Service associated with the shipment. see pg 47 of Rating XML pdf -->
</Service>
</Shipment>
</RateRequest>
</soap:Body>
</soap:Envelope>
【问题讨论】: