-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for xml schema imports /cc #27
unfortunately, these specs come with a lot of schema fixtures.
- Loading branch information
Showing
42 changed files
with
248 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
--- | ||
title: Version 4 | ||
--- | ||
|
||
|
||
Wasabi 4.0 is under active development and currently only available via GitHub. | ||
To give it a try, just add it to your Gemfile. | ||
|
||
``` ruby | ||
gem 'wasabi', github: 'savonrb/wasabi' | ||
``` | ||
|
||
You can also find a summary of the changes in the | ||
[Changelog](https://github.com/savonrb/wasabi/blob/master/CHANGELOG.md). | ||
|
||
|
||
The big rewrite | ||
--------------- | ||
|
||
Wasabi 4.0 is based on everything I learned while helping people talk to SOAP services using Ruby for the past five years. | ||
The goal for this is to follow the specifications as close as possible while verifying them against real world services. | ||
|
||
|
||
|
||
#### Services and endpoints | ||
|
||
"A WSDL document defines [services as collections of network endpoints](http://www.w3.org/TR/wsdl#_introduction), or ports". | ||
Multiple services, multiple ports. Endpoint URLs are defined per port and each port references a binding which in turn | ||
defines a set of operations. This means you need to know about the services and ports defined by the WSDL. | ||
|
||
``` xml | ||
<wsdl:service name="AuthenticationService"> | ||
<wsdl:port binding="tns:AuthenticationServiceBinding" name="AuthenticationServicePort"> | ||
<soap:address location="http://example.com/validation/1.0/AuthenticationService"/> | ||
</wsdl:port> | ||
</wsdl:service> | ||
``` | ||
|
||
Create a new Wasabi instance with a URL or a path to a local WSDL document. | ||
|
||
``` ruby | ||
wsdl = Wasabi.new('http://example.com?wsdl') | ||
``` | ||
|
||
Wasabi also accepts an optional `HTTPI::Request` object which it uses to fetch remote WSDL files and resolve imports. | ||
This allows you to [pre-configure any HTTP request](http://httpirb.com/#options). | ||
|
||
``` ruby | ||
request = HTTPI::Request.new | ||
request.proxy = 'http://localhost:8447' | ||
|
||
wsdl = Wasabi.new('example.wsdl', request) | ||
``` | ||
|
||
Now you can call the `#services` method for a summary of the services and ports defined by the WSDL. | ||
|
||
``` ruby | ||
wsdl.services | ||
``` | ||
|
||
This returns a list of service and ports along with information about the port's type and location. | ||
The type is a namespace which in this example indicates a SOAP 1.1 port. The location is the actual | ||
location of the service. | ||
|
||
Remember that there could be multiple services with multiple ports which each reference a different | ||
set of operations. Also, Wasabi currently only returns SOAP 1.1 and 1.2 services and ports. | ||
Selection the proper ports should probably be left to any client library, but this is just how | ||
it curently works. | ||
|
||
``` ruby | ||
{ | ||
'ExampleService' => { | ||
:ports => { | ||
'ExamplePort' => { | ||
:type => 'http://schemas.xmlsoap.org/wsdl/soap/', | ||
:location => 'http://example.com' | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
|
||
#### Operations | ||
|
||
Knowing the name of a service and port gives you access to its operations. | ||
|
||
``` ruby | ||
operations = wsdl.operations('ExampleService', 'ExamplePort') | ||
``` | ||
|
||
This returns a list of operation names and objects which can be asked anything needed to call this operation. | ||
|
||
``` ruby | ||
{ | ||
'someOperation' => <Wasabi::Operation>, | ||
'anotherOperation' => <Wasabi::Operation> | ||
} | ||
``` | ||
|
||
There's also the `#operation` shortcut method which accepts the name of a service and port and the | ||
name of an operation to get a single operation object. | ||
|
||
``` ruby | ||
operation = wsdl.operation('ExampleService', 'ExamplePort', 'someOperation') | ||
``` | ||
|
||
Operations should know everything you need to create an HTTP request and call the operation. | ||
|
||
``` ruby | ||
operation.name # => 'authenticate' | ||
operation.nsid # => 'tns' | ||
operation.input # => 'authenticate' | ||
operation.soap_action # => 'urn:authenticate' | ||
operation.endpoint # => 'http://v1.example.com' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/"><xs:element name="anyType" nillable="true" type="xs:anyType"/><xs:element name="anyURI" nillable="true" type="xs:anyURI"/><xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/><xs:element name="boolean" nillable="true" type="xs:boolean"/><xs:element name="byte" nillable="true" type="xs:byte"/><xs:element name="dateTime" nillable="true" type="xs:dateTime"/><xs:element name="decimal" nillable="true" type="xs:decimal"/><xs:element name="double" nillable="true" type="xs:double"/><xs:element name="float" nillable="true" type="xs:float"/><xs:element name="int" nillable="true" type="xs:int"/><xs:element name="long" nillable="true" type="xs:long"/><xs:element name="QName" nillable="true" type="xs:QName"/><xs:element name="short" nillable="true" type="xs:short"/><xs:element name="string" nillable="true" type="xs:string"/><xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/><xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/><xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/><xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/><xs:element name="char" nillable="true" type="tns:char"/><xs:simpleType name="char"><xs:restriction base="xs:int"/></xs:simpleType><xs:element name="duration" nillable="true" type="tns:duration"/><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 name="guid" nillable="true" type="tns:guid"/><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 name="FactoryType" type="xs:QName"/><xs:attribute name="Id" type="xs:ID"/><xs:attribute name="Ref" type="xs:IDREF"/></xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><xs:schema elementFormDefault="qualified" targetNamespace="http://connect.bookt.com/Schemas/Person.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://connect.bookt.com/Schemas/Person.xsd"><xs:import schemaLocation="http://connect.bookt.com/svc/connect.svc?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><xs:complexType name="Person"><xs:sequence><xs:element minOccurs="0" name="Address1" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Address2" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="AltID" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="CellPhone" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="City" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Company" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Country" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="FaxNumber" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="FirstName" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Greeting" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="HomePhone" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="ID" type="xs:int"/><xs:element minOccurs="0" name="Initial" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="LastName" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Latitude" type="xs:decimal"/><xs:element minOccurs="0" name="LeadSource" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Longitude" type="xs:decimal"/><xs:element minOccurs="0" name="Notes" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="PostalCode" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Prefix" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="PrimaryEmail" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="State" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Status" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Suffix" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Tags" nillable="true" type="q1:ArrayOfstring" xmlns:q1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><xs:element minOccurs="0" name="Title" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Type" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="WebSite" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="WorkPhone" nillable="true" type="xs:string"/></xs:sequence></xs:complexType><xs:element name="Person" nillable="true" type="tns:Person"/></xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><xs:schema elementFormDefault="qualified" targetNamespace="http://connect.bookt.com/Schemas/CreditCard.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://connect.bookt.com/Schemas/CreditCard.xsd"><xs:complexType name="CreditCard"><xs:sequence><xs:element minOccurs="0" name="Address" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="CardNumber" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="City" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="ExpiresOn" type="xs:dateTime"/><xs:element minOccurs="0" name="NameOnCard" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="PostalCode" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="SecurityCode" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="State" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Type" nillable="true" type="xs:string"/></xs:sequence></xs:complexType><xs:element name="CreditCard" nillable="true" type="tns:CreditCard"/></xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><xs:schema elementFormDefault="qualified" targetNamespace="http://connect.bookt.com/Schemas/Statement.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://connect.bookt.com/Schemas/Statement.xsd"><xs:import schemaLocation="http://connect.bookt.com/svc/connect.svc?xsd=xsd13" namespace="http://connect.bookt.com/Schemas/StatementDetail.xsd"/><xs:complexType name="Statement"><xs:sequence><xs:element minOccurs="0" name="Currency" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Description" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Details" nillable="true" type="q1:ArrayOfStatementDetail" xmlns:q1="http://connect.bookt.com/Schemas/StatementDetail.xsd"/><xs:element minOccurs="0" name="DueOn" type="xs:dateTime"/><xs:element minOccurs="0" name="ID" type="xs:int"/><xs:element minOccurs="0" name="Notes" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Status" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Total" type="xs:decimal"/><xs:element minOccurs="0" name="Type" nillable="true" type="xs:string"/></xs:sequence></xs:complexType><xs:element name="Statement" nillable="true" type="tns:Statement"/></xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><xs:schema elementFormDefault="qualified" targetNamespace="http://connect.bookt.com/Schemas/StatementDetail.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://connect.bookt.com/Schemas/StatementDetail.xsd"><xs:complexType name="ArrayOfStatementDetail"><xs:sequence><xs:element minOccurs="0" maxOccurs="unbounded" name="StatementDetail" nillable="true" type="tns:StatementDetail"/></xs:sequence></xs:complexType><xs:element name="ArrayOfStatementDetail" nillable="true" type="tns:ArrayOfStatementDetail"/><xs:complexType name="StatementDetail"><xs:sequence><xs:element minOccurs="0" name="Amount" type="xs:decimal"/><xs:element minOccurs="0" name="Currency" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="ID" type="xs:int"/><xs:element minOccurs="0" name="Notes" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Quantity" type="xs:decimal"/><xs:element minOccurs="0" name="Status" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="SubTotal" type="xs:decimal"/><xs:element minOccurs="0" name="Type" nillable="true" type="xs:string"/></xs:sequence></xs:complexType><xs:element name="StatementDetail" nillable="true" type="tns:StatementDetail"/></xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><xs:schema elementFormDefault="qualified" targetNamespace="http://connect.bookt.com/Schemas/Event.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://connect.bookt.com/Schemas/Event.xsd"><xs:import schemaLocation="http://connect.bookt.com/svc/connect.svc?xsd=xsd10" namespace="http://connect.bookt.com/Schemas/Person.xsd"/><xs:import schemaLocation="http://connect.bookt.com/svc/connect.svc?xsd=xsd12" namespace="http://connect.bookt.com/Schemas/Statement.xsd"/><xs:complexType name="Event"><xs:sequence><xs:element minOccurs="0" name="AddedOn" type="xs:dateTime"/><xs:element minOccurs="0" name="AltID" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="CheckIn" type="xs:dateTime"/><xs:element minOccurs="0" name="CheckOut" type="xs:dateTime"/><xs:element minOccurs="0" name="CompletedOn" type="xs:dateTime"/><xs:element minOccurs="0" name="ID" type="xs:int"/><xs:element minOccurs="0" name="Lead" nillable="true" type="q1:Person" xmlns:q1="http://connect.bookt.com/Schemas/Person.xsd"/><xs:element minOccurs="0" name="Message" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="MessageFormat" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="NumAdults" type="xs:int"/><xs:element minOccurs="0" name="NumChildren" type="xs:int"/><xs:element minOccurs="0" name="PropertyID" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Statement" nillable="true" type="q2:Statement" xmlns:q2="http://connect.bookt.com/Schemas/Statement.xsd"/><xs:element minOccurs="0" name="Status" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Subject" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="Type" nillable="true" type="xs:string"/><xs:element minOccurs="0" name="UnitID" nillable="true" type="xs:string"/></xs:sequence></xs:complexType><xs:element name="Event" nillable="true" type="tns:Event"/></xs:schema> |
Oops, something went wrong.