NetSuite nlapiRequestURL 到 UPS 收到 "XML declaration is not well-formed" 错误
NetSuite nlapiRequestURL to UPS receives "XML declaration is not well-formed" error
我正在尝试使用 NetSuite Suitelet 中的 UPS 评级 API。当我使用 nlapiRequestURL 执行此操作时,我从 UPS 收到错误 "XML declaration is not well-formed"。我一直盯着这个 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>
这里是我复制粘贴的,删除后"xmllint"顺利通过了
来自 XML 声明之前的 space。你那里有 space 吗,还是只是将它粘贴到 SO 中的产物?
-s
我正在尝试使用 NetSuite Suitelet 中的 UPS 评级 API。当我使用 nlapiRequestURL 执行此操作时,我从 UPS 收到错误 "XML declaration is not well-formed"。我一直盯着这个 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>
这里是我复制粘贴的,删除后"xmllint"顺利通过了 来自 XML 声明之前的 space。你那里有 space 吗,还是只是将它粘贴到 SO 中的产物?
-s