是否有人在PHP中集成了fedex API以生成跟踪号和运输标签?我将以下XML提交给fedex -
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://fedex.com/ws/ship/v19">
<SOAP-ENV:Body>
<ProcessShipmentRequest xmlns="http://fedex.com/ws/ship/v19">
<WebAuthenticationDetail>
<UserCredential>
<Key>avpSZAQRg9gu3zfm</Key>
<Password>gSmYLbjJwCYYVsoIwfp2ux2FY</Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber>604794161</AccountNumber>
<MeterNumber>100339204</MeterNumber>
</ClientDetail>
<TransactionDetail>
<CustomerTransactionId>8787</CustomerTransactionId>
</TransactionDetail>
<Version>
<ServiceId>ship</ServiceId>
<Major>19</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<RequestedShipment>
<ShipTimestamp>2017-07-29T12:34:56-06:00</ShipTimestamp>
<DropoffType>REGULAR_PICKUP</DropoffType>
<ServiceType>STANDARD_OVERNIGHT</ServiceType>
<PackagingType>YOUR_PACKAGING</PackagingType>
<Shipper>
<Contact>
<PersonName>Piyush Rana</PersonName>
<CompanyName>Eclators</CompanyName>
<PhoneNumber>9925383633</PhoneNumber>
<EMailAddress>rana@gmail.com</EMailAddress>
</Contact>
<Address>
<StreetLines>14-B-5</StreetLines>
<StreetLines>DkPark</StreetLines>
<City>Surat</City>
<StateOrProvinceCode>Gujarat</StateOrProvinceCode>
<PostalCode>395007</PostalCode>
<CountryCode>IN</CountryCode>
</Address>
</Shipper>
<Recipient>
<Contact>
<PersonName>Panakj Rana</PersonName>
<CompanyName>pp</CompanyName>
<PhoneNumber>9252905058</PhoneNumber>
<EMailAddress>php.pankaj@gmail.com</EMailAddress>
</Contact>
<Address>
<StreetLines>Near yadav floor mill</StreetLines>
<StreetLines>sarvodaya basti</StreetLines>
<City>Bikaner</City>
<StateOrProvinceCode>rajasthan</StateOrProvinceCode>
<PostalCode>334004</PostalCode>
<CountryCode>IN</CountryCode>
</Address>
</Recipient>
<ShippingChargesPayment>
<PaymentType>SENDER</PaymentType>
<Payor>
<ResponsibleParty>
<AccountNumber>604794161</AccountNumber>
<Contact>
<ContactId>12345</ContactId>
<PersonName>shanu rana</PersonName>
</Contact>
</ResponsibleParty>
</Payor>
</ShippingChargesPayment>
<SpecialServicesRequested>
<SpecialServiceTypes>ELECTRONIC_TRADE_DOCUMENTS</SpecialServiceTypes>
</SpecialServicesRequested>
<CustomsClearanceDetail>
<DutiesPayment>
<PaymentType>SENDER</PaymentType>
<Payor>
<ResponsibleParty>
<AccountNumber>604794161</AccountNumber>
<Contact>
<ContactId>12345</ContactId>
<PersonName>Input Your Information</PersonName>
</Contact>
</ResponsibleParty>
</Payor>
</DutiesPayment>
<DocumentContent>DOCUMENTS_ONLY</DocumentContent>
<CustomsValue>
<Currency>INR</Currency>
<Amount>100.00</Amount>
</CustomsValue>
<Commodities>
<NumberOfPieces>1</NumberOfPieces>
<Description>ABCD</Description>
<CountryOfManufacture>US</CountryOfManufacture>
<Weight>
<Units>LB</Units>
<Value>1.0</Value>
</Weight>
<Quantity>1</Quantity>
<QuantityUnits>cm</QuantityUnits>
<UnitPrice>
<Currency>INR</Currency>
<Amount>1.000000</Amount>
</UnitPrice>
<CustomsValue>
<Currency>INR</Currency>
<Amount>100.000000</Amount>
</CustomsValue>
</Commodities>
<ExportDetail>
<ExportComplianceStatement>30.37(f)</ExportComplianceStatement>
</ExportDetail>
</CustomsClearanceDetail>
<LabelSpecification>
<LabelFormatType>COMMON2D</LabelFormatType>
<ImageType>PNG</ImageType>
<LabelStockType>PAPER_7X4.75</LabelStockType>
</LabelSpecification>
<ShippingDocumentSpecification>
<ShippingDocumentTypes>COMMERCIAL_INVOICE</ShippingDocumentTypes>
<CommercialInvoiceDetail>
<Format>
<ImageType>PDF</ImageType>
<StockType>PAPER_LETTER</StockType>
<ProvideInstructions>1</ProvideInstructions>
</Format>
</CommercialInvoiceDetail>
</ShippingDocumentSpecification>
<RateRequestTypes>LIST</RateRequestTypes>
<PackageCount>1</PackageCount>
<RequestedPackageLineItems>
<SequenceNumber>1</SequenceNumber>
<Weight>
<Units>LB</Units>
<Value>20.0</Value>
</Weight>
<Dimensions>
<Length>12</Length>
<Width>12</Width>
<Height>12</Height>
<Units>IN</Units>
</Dimensions>
<CustomerReferences>
<CustomerReferenceType>CUSTOMER_REFERENCE</CustomerReferenceType>
<Value>TC001_01_PT1_ST01_PK01_SNDUS_RCPCA_POS</Value>
</CustomerReferences>
</RequestedPackageLineItems>
</RequestedShipment>
</ProcessShipmentRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
但低于输出 -
SimpleXMLElement对象 ( [@attributes] =&gt;排列 ( [xmlnsSOAPENV] =&gt; HTTP // schemas.xmlsoap.org /肥皂/信封/ )
[SOAPENVHeader] => SimpleXMLElement Object
(
)
[SOAPENVBody] => SimpleXMLElement Object
(
[ProcessShipmentReply] => SimpleXMLElement Object
(
[HighestSeverity] => ERROR
[Notifications] => SimpleXMLElement Object
(
[Severity] => ERROR
[Source] => ship
[Code] => 2200
[Message] => Missing or Invalid Shipment purpose for Commercial Invoice
[LocalizedMessage] => Missing or Invalid Shipment purpose for Commercial Invoice
)
[TransactionDetail] => SimpleXMLElement Object
(
[CustomerTransactionId] => 8787
)
[Version] => SimpleXMLElement Object
(
[ServiceId] => ship
[Major] => 19
[Intermediate] => 0
[Minor] => 0
)
)
)
)
这个api有什么问题?请建议。或者,如果有人已经集成,那么请提供我可以用来生成联邦快递跟踪号和运输标签的代码片段。
答案 0 :(得分:2)
您应该立即更改您的API凭据。你刚刚把它们贴在这里供所有人看。
您错过了Purpose
标记:
<CommercialInvoice>
<Purpose>SOLD</Purpose>
</CommercialInvoice>
可能的值:
以下是RocketShipIt(我是首席开发人员)的完整工作示例:
<Envelope>
<Body>
<ProcessShipmentRequest>
<WebAuthenticationDetail>
<UserCredential>
<Key></Key>
<Password></Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber></AccountNumber>
<MeterNumber></MeterNumber>
</ClientDetail>
<Version>
<ServiceId>ship</ServiceId>
<Major>17</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<RequestedShipment>
<ShipTimestamp>2017-07-29T07:52:19.692709183-07:00</ShipTimestamp>
<DropoffType>REGULAR_PICKUP</DropoffType>
<ServiceType>STANDARD_OVERNIGHT</ServiceType>
<PackagingType>YOUR_PACKAGING</PackagingType>
<TotalWeight>
<Units>LB</Units>
<Value>5</Value>
</TotalWeight>
<Shipper>
<Contact>
<PersonName>John Doe</PersonName>
<CompanyName>John Doe</CompanyName>
<PhoneNumber>1231231234</PhoneNumber>
</Contact>
<Address>
<StreetLines>2000 Meadowvale Rd</StreetLines>
<City>mumbai</City>
<StateOrProvinceCode>MH</StateOrProvinceCode>
<PostalCode>400037</PostalCode>
<CountryCode>IN</CountryCode>
</Address>
</Shipper>
<Recipient>
<Contact>
<PersonName>John Doe</PersonName>
<PhoneNumber>1231231234</PhoneNumber>
</Contact>
<Address>
<StreetLines>2300 Southern Blvd</StreetLines>
<City>Mumbai</City>
<StateOrProvinceCode>MH</StateOrProvinceCode>
<PostalCode>400037</PostalCode>
<CountryCode>IN</CountryCode>
</Address>
</Recipient>
<ShippingChargesPayment>
<PaymentType>SENDER</PaymentType>
<Payor>
<ResponsibleParty>
<AccountNumber></AccountNumber>
<Contact>
<CompanyName>John Doe</CompanyName>
</Contact>
<Address>
<CountryCode>US</CountryCode>
</Address>
</ResponsibleParty>
</Payor>
</ShippingChargesPayment>
<SpecialServicesRequested>
<SpecialServiceTypes>COD</SpecialServiceTypes>
<CodDetail>
<CodCollectionAmount>
<Currency>INR</Currency>
<Amount>100</Amount>
</CodCollectionAmount>
<CollectionType>CASH</CollectionType>
</CodDetail>
</SpecialServicesRequested>
<CustomsClearanceDetail>
<DutiesPayment>
<PaymentType>RECIPIENT</PaymentType>
</DutiesPayment>
<CustomsValue>
<Currency>INR</Currency>
<Amount>0</Amount>
</CustomsValue>
<CommercialInvoice>
<Purpose>SOLD</Purpose>
</CommercialInvoice>
<Commodities>
<NumberOfPieces>1</NumberOfPieces>
<Description>My Description</Description>
<CountryOfManufacture>US</CountryOfManufacture>
<Weight>
<Units>LB</Units>
<Value>2.5</Value>
</Weight>
<Quantity>1</Quantity>
<QuantityUnits>EA</QuantityUnits>
<UnitPrice>
<Currency>INR</Currency>
<Amount>50</Amount>
</UnitPrice>
</Commodities>
</CustomsClearanceDetail>
<LabelSpecification>
<LabelFormatType>COMMON2D</LabelFormatType>
<ImageType>PNG</ImageType>
<LabelStockType>PAPER_4X6</LabelStockType>
<LabelPrintingOrientation>TOP_EDGE_OF_TEXT_FIRST</LabelPrintingOrientation>
</LabelSpecification>
<PackageCount>1</PackageCount>
<RequestedPackageLineItems>
<SequenceNumber>1</SequenceNumber>
<GroupPackageCount>1</GroupPackageCount>
<Weight>
<Units>LB</Units>
<Value>5</Value>
</Weight>
<Dimensions>
<Length>1</Length>
<Width>1</Width>
<Height>1</Height>
<Units>IN</Units>
</Dimensions>
</RequestedPackageLineItems>
</RequestedShipment>
</ProcessShipmentRequest>
</Body>
</Envelope>
答案 1 :(得分:0)
实际上,您发送请求的结构错误。您应该在CommercialInvoice
下添加CustomsClearanceDetail
。由于请求中的请求参数放置错误而发生此错误。