【发布时间】:2014-10-03 08:56:55
【问题描述】:
我尝试实施fedex api 来计算从一个国家的邮政编码到某个国家/地区的运输成本。它在美国工作得很好。它也适用于从美国到其他国家/地区(尝试过 IN 和 AU)。但是当我尝试使用来自印度或澳大利亚的两个邮政编码作为发货人和收件人地址时。它给出以下错误:-
The transaction returned an Error.
Severity: ERROR
Source: crs
Code: 691
Message: The PurposeOfShipmentType is null, empty or invalid.
LocalizedMessage: The PurposeOfShipmentType is null, empty or invalid.
不知道是什么问题。我在 wsdl 文件中检查了 PurposeOfShipmentType 的值,它显示在 xml 代码下方:-
First occurrence
<xs:element name="Purpose" type="ns:PurposeOfShipmentType" minOccurs="0">
<xs:annotation>
<xs:documentation>The reason for the shipment. Note: SOLD is not a valid purpose for a Proforma Invoice.</xs:documentation>
</xs:annotation>
</xs:element>
second occurrence
<xs:simpleType name="PurposeOfShipmentType">
<xs:restriction base="xs:string">
<xs:enumeration value="GIFT"/>
<xs:enumeration value="NOT_SOLD"/>
<xs:enumeration value="PERSONAL_EFFECTS"/>
<xs:enumeration value="REPAIR_AND_RETURN"/>
<xs:enumeration value="SAMPLE"/>
<xs:enumeration value="SOLD"/>
</xs:restriction>
</xs:simpleType>
不明白价值应该是什么。下面是我发送到 $client ->getRates($request) 函数的数组
$request = Array
(
[WebAuthenticationDetail] => Array
(
[UserCredential] => Array
(
[Key] => *******
[Password] => *******
)
)
[ClientDetail] => Array
(
[AccountNumber] => *****
[MeterNumber] => *****
)
[TransactionDetail] => Array
(
[CustomerTransactionId] => *** Rate Available Services Request using PHP ***
)
[Version] => Array
(
[ServiceId] => crs
[Major] => 16
[Intermediate] => 0
[Minor] => 0
)
[ReturnTransitAndCommit] => 1
[RequestedShipment] => Array
(
[DropoffType] => REGULAR_PICKUP
[ShipTimestamp] => 2014-10-03T11:37:53+02:00
[Shipper] => Array
(
[Address] => Array
(
[StreetLines] => Array
(
[0] => 10 Fed Ex Pkwy
)
[City] => Memphis
[StateOrProvinceCode] =>
[PostalCode] => 110016
[CountryCode] => IN
)
)
[Recipient] => Array
(
[Address] => Array
(
[StreetLines] => Array
(
[0] => 13450 Farmcrest Ct
)
[City] => Herndon
[StateOrProvinceCode] =>
[PostalCode] => 302015
[CountryCode] => IN
)
)
[ShippingChargesPayment] => Array
(
[PaymentType] => SENDER
[Payor] => Array
(
[ResponsibleParty] => Array
(
[AccountNumber] => 510087500
[Contact] =>
[Address] => Array
(
[CountryCode] => IN
)
)
)
)
[PackageCount] => 2
[RequestedPackageLineItems] => Array
(
[0] => Array
(
[SequenceNumber] => 1
[GroupPackageCount] => 1
[Weight] => Array
(
[Value] => 2
[Units] => LB
)
[Dimensions] => Array
(
[Length] => 10
[Width] => 10
[Height] => 3
[Units] => IN
)
)
[1] => Array
(
[SequenceNumber] => 2
[GroupPackageCount] => 1
[Weight] => Array
(
[Value] => 5
[Units] => LB
)
[Dimensions] => Array
(
[Length] => 20
[Width] => 20
[Height] => 10
[Units] => IN
)
)
)
)
)
【问题讨论】:
-
它会告诉你哪里出了问题。
PurposeOfShipmentType和PurposeOfShipmentType两者之一; null、空或无效。 -
我已编辑问题以供您发表评论。我检查了 PurposeOfShipmentType 的值,但不知道应该是什么。
-
你要发送什么?
-
在印度一个城市的发件人邮政编码和收件人印度的另一个城市的邮政编码和国家代码 IN 它适用于国际运输和美国城市
-
在您的请求中,
PurposeOfShipmentType的值是多少?