2011-02-10 69 views
2

我正在與FedEx國際船務服務集成。但我真的被困在一個部分。我正在嘗試使用他們的測試環境創建原始證書。我遵循XML模式,並都拿出了下面的代碼使用FedEx船務服務創建聯邦快遞航運文件WSDL

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; 

    } 

但我不斷收到一條錯誤消息從Web服務說明「無效的股票型」回來。即使shipmentDocumentStockType是一個枚舉,我正在使用它的一個值。我仍然收到這個錯誤。任何想法,我可能會出錯? 任何信息將是一個很大的幫助。我嘗試聯繫聯邦快遞的技術支持,他們並不是很有幫助。

回答

5

這可能對你有點遲,但只是想提供一個答案,以防別人可能正在尋找它。

我有一個類似的問題,但不是原產地證書,它與商業發票。原來這些表格需要在PDF格式的完整的8.5×11頁上打印,因此改變從STOCK_4x6的StockType到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 };

希望這會有所幫助