使用FedEx送货服务WSDL创建FedEx送货凭证

时间:2011-02-10 09:35:22

标签: c# fedex

我正在与FedEx国际船舶服务集成。但我真的被困在一个方面。我正在尝试使用他们的测试环境创建原产地证书。我已经遵循了xml架构,并提出了以下代码

private static void SetCustomInvoice(ProcessShipmentRequest request)
    {
        request.RequestedShipment.ShippingDocumentSpecification = new ShippingDocumentSpecification();
        request.RequestedShipment.ShippingDocumentSpecification.ShippingDocumentTypes = new RequestedShippingDocumentType[1] { new RequestedShippingDocumentType() };
        request.RequestedShipment.ShippingDocumentSpecification.ShippingDocumentTypes[0] = RequestedShippingDocumentType.CERTIFICATE_OF_ORIGIN;
        request.RequestedShipment.ShippingDocumentSpecification.CertificateOfOrigin = new CertificateOfOriginDetail();
        request.RequestedShipment.ShippingDocumentSpecification.CertificateOfOrigin.DocumentFormat = new ShippingDocumentFormat { StockType = ShippingDocumentStockType.STOCK_4X6, ImageType = ShippingDocumentImageType.PDF, ImageTypeSpecified = true, StockTypeSpecified = true };
        request.RequestedShipment.SpecialServicesRequested = new ShipmentSpecialServicesRequested();
        request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes = new ShipmentSpecialServiceType[1] { new ShipmentSpecialServiceType() };
        request.RequestedShipment.SpecialServicesRequested.SpecialServiceTypes[0] = ShipmentSpecialServiceType.ELECTRONIC_TRADE_DOCUMENTS;

        request.RequestedShipment.SpecialServicesRequested.EtdDetail = new EtdDetail();
        request.RequestedShipment.SpecialServicesRequested.EtdDetail.RequestedDocumentCopies = new RequestedShippingDocumentType[1] { RequestedShippingDocumentType.CERTIFICATE_OF_ORIGIN };
        request.RequestedShipment.SpecialServicesRequested.EtdDetail.DocumentReferences = new UploadDocumentReferenceDetail[1] { new UploadDocumentReferenceDetail() };
        request.RequestedShipment.SpecialServicesRequested.EtdDetail.RequestedDocumentCopies[0] = RequestedShippingDocumentType.CERTIFICATE_OF_ORIGIN;

    }

但我不断收到来自网络服务的错误消息,说明“无效的股票类型”。尽管shipmentDocumentStockType是一个枚举,我正在使用其中的一个值。我仍然收到此错误。我可能会出错的任何想法? 任何信息都将是一个很大的帮助。我尝试与FedEx技术支持取得联系,但他们并没有给我很大的帮助。

1 个答案:

答案 0 :(得分:5)

这对你来说可能有点晚,但只是想提供一个答案以防其他人可能正在寻找它。

我遇到了类似的问题,但是使用商业发票而不是原产地证书。事实证明这些表格需要以PDF格式打印在一个完整的8.5 x 11页面上,因此将StockType从STOCK_4x6更改为PAPER_LETTER会为我修复它:

自: request.RequestedShipment.ShippingDocumentSpecification.CertificateOfOrigin.DocumentFormat = new ShippingDocumentFormat { StockType = ShippingDocumentStockType.STOCK_4X6, ImageType = ShippingDocumentImageType.PDF, ImageTypeSpecified = true, StockTypeSpecified = true };

要: request.RequestedShipment.ShippingDocumentSpecification.CertificateOfOrigin.DocumentFormat = new ShippingDocumentFormat { StockType = ShippingDocumentStockType.PAPER_LETTER, ImageType = ShippingDocumentImageType.PDF, ImageTypeSpecified = true, StockTypeSpecified = true };

希望这有帮助

相关问题