无法将非SOAP速率请求发送到FedEx [英] Cannot send non-SOAP rate request to FedEx

查看:74
本文介绍了无法将非SOAP速率请求发送到FedEx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试将非SOAP速率请求发送到FedEx.当我发送它们的SOAP端点时,以下XML与SOAP Env和Body一起使用.它在文档中说他们提供了仅XML的解决方案,其格式与SOAP请求的格式完全相同.发送到 https://wsbeta.fedex.com:443/xml .请让我知道是否有人有任何见识.

Trying to send non-SOAP rate request to FedEx. The following XML works with SOAP Env and Body when I send their SOAP endpoint. It says in the documentation that they offer an XML-only solution, and that is formatted exactly the same as the SOAP request. Sending to https://wsbeta.fedex.com:443/xml. Please let me know if anyone has any insight.

<RateRequest>
  <WebAuthenticationDetail>
    <UserCredential>
      <Key>omitted</Key>
      <Password>omitted</Password>
    </UserCredential>
  </WebAuthenticationDetail>
  <ClientDetail>
    <AccountNumber>omitted</AccountNumber>
    <MeterNumber>omitted</MeterNumber>
  </ClientDetail>
  <Version>
    <ServiceId>crs</ServiceId>
    <Major>28</Major>
    <Intermediate>0</Intermediate>
    <Minor>0</Minor>
  </Version>
  <RequestedShipment>
    <ServiceType>FEDEX_2_DAY</ServiceType>
    <Shipper>
      <Address>
        <StreetLines>4500 WEST 46TH STREET</StreetLines>
        <City>CHICAGO</City>
        <StateOrProvinceCode>IL</StateOrProvinceCode>
        <PostalCode>60632</PostalCode>
        <CountryCode>US</CountryCode>
      </Address>
    </Shipper>
    <Recipient>
      <Address>
        <City>TAMPA</City>
        <StateOrProvinceCode>FL</StateOrProvinceCode>
        <PostalCode>33616</PostalCode>
        <CountryCode>US</CountryCode>
      </Address>
    </Recipient>
    <PackageCount>1</PackageCount>
    <RequestedPackageLineItems>
      <SequenceNumber>1</SequenceNumber>
      <GroupPackageCount>1</GroupPackageCount>
      <Weight>
        <Units>LB</Units>
        <Value>10</Value>
      </Weight>
    </RequestedPackageLineItems>
  </RequestedShipment>
</RateRequest>

推荐答案

似乎您快到了.xml文档的根元素缺少名称空间 http://fedex.com/ws/rate/v28.

It looks like you're almost there. The root element of your xml document is missing the namespace http://fedex.com/ws/rate/v28.

在SOAP消息中,名称空间将在 Envelope 元素上定义.由于通过普通XML接口发送的数据不包含包装于SOAP的包装的Envelope和Body标签,因此必须将名称空间添加到 RateRequest 元素.

In a SOAP message the namespace would be defined on the Envelope element. Because the data sent via the plain XML interface does not contain the wrapping Envelope and Body tags that are specific to SOAP, you have to add the namespace to the RateRequest element.

您的请求应为:

<RateRequest xmlns="http://fedex.com/ws/rate/v28">
  <WebAuthenticationDetail>
    <UserCredential>
      <Key>omitted</Key>
      <Password>omitted</Password>
    </UserCredential>
  </WebAuthenticationDetail>
  <ClientDetail>
    <AccountNumber>omitted</AccountNumber>
    <MeterNumber>omitted</MeterNumber>
  </ClientDetail>
  <Version>
    <ServiceId>crs</ServiceId>
    <Major>28</Major>
    <Intermediate>0</Intermediate>
    <Minor>0</Minor>
  </Version>
  <RequestedShipment>
    <ServiceType>FEDEX_2_DAY</ServiceType>
    <Shipper>
      <Address>
        <StreetLines>4500 WEST 46TH STREET</StreetLines>
        <City>CHICAGO</City>
        <StateOrProvinceCode>IL</StateOrProvinceCode>
        <PostalCode>60632</PostalCode>
        <CountryCode>US</CountryCode>
      </Address>
    </Shipper>
    <Recipient>
      <Address>
        <City>TAMPA</City>
        <StateOrProvinceCode>FL</StateOrProvinceCode>
        <PostalCode>33616</PostalCode>
        <CountryCode>US</CountryCode>
      </Address>
    </Recipient>
    <PackageCount>1</PackageCount>
    <RequestedPackageLineItems>
      <SequenceNumber>1</SequenceNumber>
      <GroupPackageCount>1</GroupPackageCount>
      <Weight>
        <Units>LB</Units>
        <Value>10</Value>
      </Weight>
    </RequestedPackageLineItems>
  </RequestedShipment>
</RateRequest>

此外,请不要忘记在请求中设置以下标头:

Also, don't forget to set the following headers in your request:

Accept: image/gif, image/jpeg, image/pjpeg, text/plain, text/html, */*
Content-Type: text/xml

这篇关于无法将非SOAP速率请求发送到FedEx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆