【问题标题】:NetSuite nlapiRequestURL to UPS receives "XML declaration is not well-formed" error到 UPS 的 NetSuite nlapiRequestURL 收到“XML 声明格式不正确”错误
【发布时间】:2016-03-27 23:21:31
【问题描述】:

我正在尝试使用 NetSuite Suitelet 中的 UPS Rating API。当我使用 nlapiRequestURL 执行此操作时,我从 UPS 收到错误“XML 声明格式不正确”。我一直在盯着这个 XML,我找不到我做错了什么。有人有想法吗? 为什么我的 XML 格式不正确?

  <?xml version="1.0" encoding="utf-8"?>
  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
          <UPSSecurity xmlns="http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0">
              <UsernameToken>
                  <Username>xxxxxxxxx</Username>
                  <Password>xxxxxxxxx</Password>
              </UsernameToken>
              <ServiceAccessToken>
                  <AccessLicenseNumber>xxxxxxxxx</AccessLicenseNumber>
              </ServiceAccessToken>
          </UPSSecurity>
  </soap:Header>
  <soap:Body>
          <RateRequest xmlns="http://www.ups.com/XMLSchema/XOLTWS/Rate/v1.1">
              <Request xmlns="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
                  <RequestOption>rate</RequestOption>
              </Request>
              <CustomerClassification>
                  <Code>00</Code>
              </CustomerClassification>
              <Shipment>
                  <Shipper>
                      <ShipperNumber>xxxxxx</ShipperNumber>
                      <Address>
                          <StateProvinceCode>WA</StateProvinceCode>
                          <PostalCode>98134</PostalCode>
                          <CountryCode>US</CountryCode>
                      </Address>
                  </Shipper>
                  <ShipTo>
                      <Address>
                          <StateProvinceCode>CA</StateProvinceCode>
                          <PostalCode>90210</PostalCode>
                          <CountryCode>US</CountryCode>
                      </Address>
                  </ShipTo>
                  <ShipFrom>
                      <Address>
                          <StateProvinceCode>WA</StateProvinceCode>
                          <PostalCode>98134</PostalCode>
                          <CountryCode>US</CountryCode>
                      </Address>
                  </ShipFrom>
                      <Package>
                          <PackagingType><Code>00</Code></PackagingType> 
                          <Dimensions>
                              <UnitOfMeasurement><Code>IN</Code></UnitOfMeasurement>
                              <Length>5</Length>
                              <Width>5</Width>
                              <Height>5</Height>
                          </Dimensions>
                          <PackageWeight>
                              <UnitOfMeasurement>
                                  <Code>lbs</Code>
                                  <Description>Pounds</Description>
                              </UnitOfMeasurement>
                              <Weight>5</Weight>
                          </PackageWeight>
                      </Package>               
                  <ShipmentRatingOptions>
                      <NegotiatedRatesIndicator>1</NegotiatedRatesIndicator>                    
                  </ShipmentRatingOptions>
                  <ShipmentServiceOptions>
                      <SaturdayDeliveryIndicator>1</SaturdayDeliveryIndicator>
                  </ShipmentServiceOptions>        
                  <Service>
                      <Code>14</Code><!-- code for the UPS Service associated with the shipment. see pg 47 of Rating XML pdf -->
                  </Service>        
              </Shipment>
          </RateRequest>
  </soap:Body>
  </soap:Envelope>

【问题讨论】:

    标签: xml soap netsuite ups


    【解决方案1】:

    我在这里复制并粘贴,“xmllint”在我删除后顺利通过 XML 声明之前的一个空格。您那里有空间,还是只是将其粘贴到 SO 中的人工制品?

    -s

    【讨论】:

    • 哦,大便,就是这样!我什至没有看到那个错误的空间。你摇滚,谢谢!
    猜你喜欢
    • 1970-01-01
    • 2014-08-26
    • 1970-01-01
    • 1970-01-01
    • 2021-04-26
    • 2021-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多