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?)
我为url
做了一个URI库网址为 - https://ws.aramex.net/shippingapi/shipping/service_1_0.svc
尝试在同一个网址上使用URI.parse,但没有给我任何错误
WSDL文件 - 删除了不需要的内容 - 链接到原始内容 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>
答案 0 :(得分:0)
修复 - https://github.com/savonrb/savon/issues/488
只需安装gem httpclient
答案 1 :(得分:0)
我猜你的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'
首先尝试修复服务。