Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
关于.2.4.d类型的Fedex API XML错误_Xml_Soap_Fedex - Fatal编程技术网

关于.2.4.d类型的Fedex API XML错误

关于.2.4.d类型的Fedex API XML错误,xml,soap,fedex,Xml,Soap,Fedex,我尝试使用ETD(电子交易文档)创建标签和发票。 我可以打印标签,但当我在XML中添加发票信息时,我收到XML错误 以下是请求 { 'soap:Envelope': { '$': { 'xmlns:soap': 'http://schemas.xmlsoap.org/soap/envelope/', 'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:ns': 'h

我尝试使用ETD(电子交易文档)创建标签和发票。 我可以打印标签,但当我在XML中添加发票信息时,我收到XML错误

以下是请求

{ 'soap:Envelope': 
   { '$': 
      { 'xmlns:soap': 'http://schemas.xmlsoap.org/soap/envelope/',
        'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
        'xmlns:ns': 'http://fedex.com/ws/ship/v15' },
     'soap:Body': 
      { 'ns:ProcessShipmentRequest': 
         { '$': 
            { 'xmlns:ns': 'http://fedex.com/ws/ship/v15',
              xmlns: 'http://fedex.com/ws/ship/v15' },
           'ns:WebAuthenticationDetail': 
            { 'ns:UserCredential': 
               { 'ns:Key': 'key',
                 'ns:Password': 'password' } },
           'ns:ClientDetail': 
            { 'ns:AccountNumber': 'account',
              'ns:MeterNumber': 'meter' },
           'ns:Version': 
            { 'ns:ServiceId': 'ship',
              'ns:Major': '15',
              'ns:Intermediate': '0',
              'ns:Minor': '0' },
           'ns:RequestedShipment': 
            { 'ns:ShipTimestamp': '2017-04-19T02:34:23.563Z',
              'ns:DropoffType': 'REGULAR_PICKUP',
              'ns:ServiceType': 'INTERNATIONAL_ECONOMY',
              'ns:PackagingType': 'YOUR_PACKAGING',
              'ns:PreferredCurrency': 'JYE',
              'ns:Shipper': 
               { 'ns:Contact': 
                  { 'ns:PersonName': 'PLAYAUTO WARE',
                    'ns:PhoneNumber': '01012345678' },
                 'ns:Address': 
                  { 'ns:StreetLines': [ '2-Chome, Kozu', 'Chuo-ku, Osaka' ],
                    'ns:City': 'Osaka',
                    'ns:PostalCode': '542-0072',
                    'ns:CountryCode': 'JP' } },
              'ns:Recipient': 
               { 'ns:Contact': 
                  { 'ns:PersonName': 'Li Bing Lin',
                    'ns:PhoneNumber': '302 839 2008' },
                 'ns:Address': 
                  { 'ns:StreetLines': [ '19 Lukens Dr', '-' ],
                    'ns:City': 'New Castle',
                    'ns:StateOrProvinceCode': 'DE',
                    'ns:PostalCode': '19720-2787',
                    'ns:CountryCode': 'US' } },
              'ns:ShippingChargesPayment': 
               { 'ns:PaymentType': 'SENDER',
                 'ns:Payor': { 'ns:ResponsibleParty': { 'ns:AccountNumber': '426072840' } } },
              'ns:CustomsClearanceDetail': 
               { 'ns:DutiesPayment': 
                  { 'ns:PaymentType': 'SENDER',
                    'ns:Payor': 
                     { 'ns:ResponsibleParty': 
                        { 'ns:AccountNumber': '426072840',
                          'ns:Tins': { 'ns:TinType': 'BUSINESS_STATE', 'ns:Number': 'XXXX' },
                          'ns:Contact': { 'ns:ContactId': '12345', 'ns:PersonName': 'XXXX' } } } },
                 'ns:DocumentContent': 'DOCUMENTS_ONLY',
                 'ns:CustomsValue': { 'ns:Currency': 'USD', 'ns:Amount': '200.68' },
                 'ns:CommercialInvoice': { 'ns:TermsOfSale': 'FOB' },
                 'ns:Commodities': 
                  { 'ns:NumberOfPieces': '1',
                    'ns:Description': 'wefwef KR undefined undefined',
                    'ns:CountryOfManufacture': 'US',
                    'ns:Weight': { 'ns:Units': 'KG', 'ns:Value': '0' },
                    'ns:Quantity': '1',
                    'ns:QuantityUnits': 'cm',
                    'ns:UnitPrice': { 'ns:Currency': 'USD', 'ns:Amount': '200.68' },
                    'ns:CustomsValue': { 'ns:Currency': 'USD', 'ns:Amount': '200.68' } },
                 'ns:ExportDetail': { 'ns:ExportComplianceStatement': '30.37(f)' } },
              'ns:LabelSpecification': 
               { 'ns:LabelFormatType': 'COMMON2D',
                 'ns:ImageType': 'PDF',
                 'ns:LabelStockType': 'PAPER_4X6' },
              'ns:RateRequestTypes': 'LIST',
              'ns:PackageCount': '1',
              'ns:RequestedPackageLineItems': 
               { 'ns:SequenceNumber': '1',
                 'ns:Weight': { 'ns:Units': 'KG', 'ns:Value': '3' },
                 'ns:CustomerReferences': 
                  { 'ns:CustomerReferenceType': 'CUSTOMER_REFERENCE',
                    'ns:Value': '1234' } } }
           } } } } } }
当我发送这个请求时,我收到了我想要的结果。 但我必须收到ETD和发票。 因此,我发送带有ShippingDocumentSpecification和SpecialServicesRequested参数的请求

下面是添加的请求

{ 'soap:Envelope': 
   { '$': 
      { 'xmlns:soap': 'http://schemas.xmlsoap.org/soap/envelope/',
        'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
        'xmlns:ns': 'http://fedex.com/ws/ship/v15' },
     'soap:Body': 
      { 'ns:ProcessShipmentRequest': 
         { '$': 
            { 'xmlns:ns': 'http://fedex.com/ws/ship/v15',
              xmlns: 'http://fedex.com/ws/ship/v15' },
           'ns:WebAuthenticationDetail': 
            { 'ns:UserCredential': 
               { 'ns:Key': 'Key',
                 'ns:Password': 'Password' } },
           'ns:ClientDetail': 
            { 'ns:AccountNumber': 'Account',
              'ns:MeterNumber': 'Meter' },
           'ns:Version': 
            { 'ns:ServiceId': 'ship',
              'ns:Major': '15',
              'ns:Intermediate': '0',
              'ns:Minor': '0' },
           'ns:RequestedShipment': 
            { 'ns:ShipTimestamp': '2017-04-19T02:46:55.862Z',
              'ns:DropoffType': 'REGULAR_PICKUP',
              'ns:ServiceType': 'INTERNATIONAL_ECONOMY',
              'ns:PackagingType': 'YOUR_PACKAGING',
              'ns:PreferredCurrency': 'JYE',
              'ns:Shipper': 
               { 'ns:Contact': 
                  { 'ns:PersonName': 'PLAYAUTO WARE',
                    'ns:PhoneNumber': '01012345678' },
                 'ns:Address': 
                  { 'ns:StreetLines': [ '2-Chome, Kozu', 'Chuo-ku, Osaka' ],
                    'ns:City': 'Osaka',
                    'ns:PostalCode': '542-0072',
                    'ns:CountryCode': 'JP' } },
              'ns:Recipient': 
               { 'ns:Contact': 
                  { 'ns:PersonName': 'Li Bing Lin',
                    'ns:PhoneNumber': '302 839 2008' },
                 'ns:Address': 
                  { 'ns:StreetLines': [ '19 Lukens Dr', '-' ],
                    'ns:City': 'New Castle',
                    'ns:StateOrProvinceCode': 'DE',
                    'ns:PostalCode': '19720-2787',
                    'ns:CountryCode': 'US' } },
              'ns:ShippingChargesPayment': 
               { 'ns:PaymentType': 'SENDER',
                 'ns:Payor': { 'ns:ResponsibleParty': { 'ns:AccountNumber': '426072840' } } },
              'ns:CustomsClearanceDetail': 
               { 'ns:DutiesPayment': 
                  { 'ns:PaymentType': 'SENDER',
                    'ns:Payor': 
                     { 'ns:ResponsibleParty': 
                        { 'ns:AccountNumber': '426072840',
                          'ns:Tins': { 'ns:TinType': 'BUSINESS_STATE', 'ns:Number': 'XXXX' },
                          'ns:Contact': { 'ns:ContactId': '12345', 'ns:PersonName': 'XXXX' } } } },
                 'ns:DocumentContent': 'DOCUMENTS_ONLY',
                 'ns:CustomsValue': { 'ns:Currency': 'USD', 'ns:Amount': '200.68' },
                 'ns:CommercialInvoice': { 'ns:TermsOfSale': 'FOB' },
                 'ns:Commodities': 
                  { 'ns:NumberOfPieces': '1',
                    'ns:Description': 'wefwef KR undefined undefined',
                    'ns:CountryOfManufacture': 'US',
                    'ns:Weight': { 'ns:Units': 'KG', 'ns:Value': '0' },
                    'ns:Quantity': '1',
                    'ns:QuantityUnits': 'cm',
                    'ns:UnitPrice': { 'ns:Currency': 'USD', 'ns:Amount': '200.68' },
                    'ns:CustomsValue': { 'ns:Currency': 'USD', 'ns:Amount': '200.68' } },
                 'ns:ExportDetail': { 'ns:ExportComplianceStatement': '30.37(f)' } },
              'ns:LabelSpecification': 
               { 'ns:LabelFormatType': 'COMMON2D',
                 'ns:ImageType': 'PDF',
                 'ns:LabelStockType': 'PAPER_4X6' },
              'ns:RateRequestTypes': 'LIST',
              'ns:PackageCount': '1',
              'ns:RequestedPackageLineItems': 
               { 'ns:SequenceNumber': '1',
                 'ns:Weight': { 'ns:Units': 'KG', 'ns:Value': '3' },
                 'ns:CustomerReferences': 
                  { 'ns:CustomerReferenceType': 'CUSTOMER_REFERENCE',
                    'ns:Value': '1234' } },
              'ns:ShippingDocumentSpecification': 
               { 'ns:ShippingDocumentTypes': 'COMMERCIAL_INVOICE',
                 'ns:CommercialInvoiceDetail': 
                  { 'ns:Format': 
                     { 'ns:StockType': 'PAPER_LETTER',
                       'ns:ImageType': 'PDF',
                       'ns:ImageTypeSpecified': 'true',
                       'ns:StockTypeSpecified': 'true' } } },
              'ns:SpecialServicesRequested': 
               { 'ns:SpecialServiceTypes': 'ELECTRONIC_TRADE_DOCUMENTS',
                 'ns:EtdDetail': { 'ns:RequestedDocumentCopies': 'COMMERCIAL_INVOICE' } } } } } } 
我收到一个错误

faultcode=SOAP-ENV:Server, xml:lang=en, $value=Fault, cause=UnrecoverableClientError, code=SchemaError, desc=validation failure for ProcessShipmentRequest Error:cvc-complex-type.2.4.a: Invalid content was found starting with element 'ns:ShippingDocumentSpecification'. One of '{"http://fedex.com/ws/ship/v15":RequestedPackageLineItems}' is expected.
cvc-complex-type.2.4.a: Invalid content was found starting with element 'ns:ImageType'. One of '{"http://fedex.com/ws/ship/v15":ProvideInstructions, "http://fedex.com/ws/ship/v15":OptionsRequested, "http://fedex.com/ws/ship/v15":Localization, "http://fedex.com/ws/ship/v15":CustomDocumentIdentifier}' is expected.
我不理解这个错误。 我认为当XML顺序不正确或未定义时,就会出现这个错误。 但我还没有解决这个问题

我如何解决这个问题

API文件:

WSDL: