无法解析 URI 问题 Ruby URI

Unable to resolve URI Issue Ruby URI

client = Savon.client(:wsdl => 'LOCATION OF FILE CODE OF WHICH I HAVE POSTED BELOW'

Savon.call(:create_shipments, :message => some_hash)

我收到 URI::InvalidURIError:错误的 URI(不是 URI?)

我在 URI 库中为 url

URL 是 - https://ws.aramex.net/shippingapi/shipping/service_1_0.svc

尝试 URI.parse 同样 url 它没有给我任何错误

WSDL 文件 - 删除不需要的内容 - link 到原始文件 http://www.aramex.com/content/uploads/109/232/42194/shipping-services-api-wsdl.zip

    <?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:tns="http://ws.aramex.net/ShippingAPI/v1/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.aramex.net/ShippingAPI/v1/" name="Service_1_0">
  <wsdl:types>
    <xsd:schema targetNamespace="http://ws.aramex.net/ShippingAPI/v1/" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified">
      <xsd:element name="ShipmentCreationRequest">
    <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified">
      <xs:element type="xs:anyType" name="anyType" nillable="true"/>
      <xs:element type="xs:anyURI" name="anyURI" nillable="true"/>
      <xs:element type="xs:base64Binary" name="base64Binary" nillable="true"/>
      <xs:element type="xs:boolean" name="boolean" nillable="true"/>
      <xs:element type="xs:byte" name="byte" nillable="true"/>
      <xs:element type="xs:dateTime" name="dateTime" nillable="true"/>
      <xs:element type="xs:decimal" name="decimal" nillable="true"/>
      <xs:element type="xs:double" name="double" nillable="true"/>
      <xs:element type="xs:float" name="float" nillable="true"/>
      <xs:element type="xs:int" name="int" nillable="true"/>
      <xs:element type="xs:long" name="long" nillable="true"/>
      <xs:element type="xs:QName" name="QName" nillable="true"/>
      <xs:element type="xs:short" name="short" nillable="true"/>
      <xs:element type="xs:string" name="string" nillable="true"/>
      <xs:element type="xs:unsignedByte" name="unsignedByte" nillable="true"/>
      <xs:element type="xs:unsignedInt" name="unsignedInt" nillable="true"/>
      <xs:element type="xs:unsignedLong" name="unsignedLong" nillable="true"/>
      <xs:element type="xs:unsignedShort" name="unsignedShort" nillable="true"/>
      <xs:element type="tns:char" name="char" nillable="true"/>
      <xs:simpleType name="char">
        <xs:restriction base="xs:int"/>
      </xs:simpleType>
      <xs:element type="tns:duration" name="duration" nillable="true"/>
      <xs:simpleType name="duration">
        <xs:restriction base="xs:duration">
          <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
          <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
          <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:element type="tns:guid" name="guid" nillable="true"/>
      <xs:simpleType name="guid">
        <xs:restriction base="xs:string">
          <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:attribute type="xs:QName" name="FactoryType"/>
      <xs:attribute type="xs:ID" name="Id"/>
      <xs:attribute type="xs:IDREF" name="Ref"/>
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="ShipmentCreationRequest">
    <wsdl:part name="parameters" element="tns:ShipmentCreationRequest"/>
  </wsdl:message>
  <wsdl:message name="ShipmentCreationResponse">
    <wsdl:part name="parameters" element="tns:ShipmentCreationResponse"/>
  </wsdl:message>
  <wsdl:portType name="Service_1_0">
    <wsdl:operation name="CreateShipments">
      <wsdl:input name="ShipmentCreationRequest" message="tns:ShipmentCreationRequest" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CreateShipments"/>
      <wsdl:output name="ShipmentCreationResponse" message="tns:ShipmentCreationResponse" wsaw:Action="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CreateShipmentsResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding type="tns:Service_1_0" name="Service_1_0">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="CreateShipments">
      <soap:operation style="document" soapAction="http://ws.aramex.net/ShippingAPI/v1/Service_1_0/CreateShipments"/>
      <wsdl:input name="ShipmentCreationRequest">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="ShipmentCreationResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="Service_1_0">
    <wsdl:port name="Service_1_0" binding="tns:Service_1_0">
      <soap:address location="https://ws.aramex.net/shippingapi/shipping/service_1_0.svc"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

修复 - https://github.com/savonrb/savon/issues/488

只需安装 gem httpclient

我猜你的 wsdl 服务运行不正常。您的服务方案有问题。 我已尝试连接您的服务并进行可能的操作,但结果为空:

client = Savon.client(:wsdl => 'you service path')
client.operations #=> []

您还可以使用此 online 工具检查您的服务。当我尝试读取您的服务模式时出现错误:

SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in 'https://ws.aramex.net/shippingapi/shipping/service_1_0.svc?wsdl'

先尝试修复你的服务。