gpt4 book ai didi

php - UPS 运输 API - ShipmentConfirmRequest 错误

转载 作者:可可西里 更新时间:2023-11-01 13:00:08 25 4
gpt4 key购买 nike

您好,我正在使用 WooCommerce 为客户创建一个 wordpress 网站。该站点已完成,但客户希望能够从 shop_order 页面创建发货。我已经弄明白了大部分,问题是我对 UPS API 的 XML 请求。我已经检查并重新检查,但似乎找不到错误:

<ShipmentConfirmResponse><Response><ResponseStatusCode>0</ResponseStatusCode><ResponseStatusDescription>Failure</ResponseStatusDescription><Error><ErrorSeverity>Hard</ErrorSeverity><ErrorCode>10002</ErrorCode><ErrorDescription>The XML document is well formed but the document is not valid</ErrorDescription></Error></Response></ShipmentConfirmResponse>

下面是我的 xml 标记,其中隐藏了敏感信息。

<?xml version="1.0" ?>
<AccessRequest xml:lang='en-US'>
<AccessLicenseNumber>******</AccessLicenseNumber>
<UserId>********</UserId>
<Password>********</Password>
</AccessRequest>
<?xml version="1.0" ?>
<ShipConfirmRequest xml:lang='en-US'>
<Request>
<TransactionReference>
<CustomerContext>Customer Context</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>ShipConfirm</RequestAction>
<RequestOption>validate</RequestOption>
</Request>
<Shipment>
<Shipper>
<ShipperNumber>*******</ShipperNumber>
<Name>Canyon Werks, LLC</Name>
<Address>
<AddressLine>2941 Brookspark Drive</AddressLine>
<AddressLine></AddressLine>
<City>North Las Vegas</City>
<StateProvinceCode>NV</StateProvinceCode>
<PostalCode>89030</PostalCode>
<CountryCode>US</CountryCode>
</Address>
<Phone>
<Number>7022552222</Number>
</Phone>
</Shipper>
<ShipTo>
<Name>Justin Walker</Name>
<Address>
<AddressLine>2675 Windmill Pkwy</AddressLine>
<AddressLine>3024</AddressLine>
<City>Henderson</City>
<StateProvinceCode>NV</StateProvinceCode>
<PostalCode>89074</PostalCode>
<CountryCode>US</CountryCode>
</Address>
<Phone>
<Number>7024609485</Number>
</Phone>
</ShipTo>
<ShipFrom>
<Name>Canyon Werks, LLC</Name>
<Address>
<AddressLine>2941 Brookspark Drive</AddressLine>
<AddressLine></AddressLine>
<City>North Las Vegas</City>
<StateProvinceCode>NV</StateProvinceCode>
<PostalCode>89030</PostalCode>
<CountryCode>US</CountryCode>
</Address>
<Phone>
<Number>7022552222</Number>
</Phone>
</ShipFrom>
<PaymentInformation>
<ShipmentCharge>
<Type>01</Type>
<BillShipper>
<AccountNumber>*******</AccountNumber>
</BillShipper>
</ShipmentCharge>
</PaymentInformation>
<Service>
<Code>03</Code>
</Service>
<Package>
<Packaging>
<Code>02</Code>
<Description>Customer Supplied</Description>
</Packaging>
<Dimensions>
<UnitOfMeasurement>
<Code>IN</Code>
</UnitOfMeasurement>
<Length>16</Length>
<Width>12</Width>
<Height>6</Height>
</Dimensions>
<PackageWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>6.07</Weight>
</PackageWeight>
</Package>
</Shipment>
<LabelSpecification>
<LabelImageFormat>
<Code>GIF</Code>
</LabelImageFormat>
</LabelSpecification>
</ShipConfirmRequest>

我几乎就在这上面,但我被困在这个路障上。如果有人能阐明这一点,我们将不胜感激。

最佳答案

它是必须包含在包容器中的服务代码容器。我之前有过。我花了很长时间才弄清楚我这个愚蠢的错误。

之前:

...
<Service>
<Code>03</Code>
</Service>
<Package>
...

之后:

...
<Package>
<Service>
<Code>03</Code>
</Service>
...

感谢您的帮助,是的,UPS 需要一种奇怪的 XML 格式。

关于php - UPS 运输 API - ShipmentConfirmRequest 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20294168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com