[AWS] Problem using wsdl2ada
Björn Lundin
b.f.lundin at gmail.com
Tue Nov 20 15:53:07 CET 2012
2012/11/20 Björn Lundin <b.f.lundin at gmail.com>:
> 2012/11/20 Pascal Obry <pascal at obry.net>:
>>
>> Björn,
>>
>> BTW, is this some kind of inheritance?
>
> I'm not sure, but
> http://www.w3schools.com/schema/el_extension.asp
> seems to indicate that.
>
>
>> Does LoginResp contains all fields of APIResponse plus the four
>> (current, errorCode, minorErrorCode and validUnit) fields? What does
>> Visual Studio generate?
>
> Hmm, no. A closer look reveals that LoginResp is broken.
>
>
> ----------------
> with www.betfair.com.publicapi.types.global.v3.APIResponse_Type_Pkg;
> use www.betfair.com.publicapi.types.global.v3.APIResponse_Type_Pkg;
>
> with Ada.Calendar;
> with Ada.Strings.Unbounded;
>
> with SOAP.Types;
> pragma Elaborate_All (SOAP);
> pragma Elaborate_All (SOAP.Types);
> with SOAP.Utils;
> pragma Elaborate_All (SOAP.Utils);
>
> package www.betfair.com.publicapi.types.global.v3.LoginResp_Type_Pkg is
>
> pragma Warnings (Off, Ada.Calendar);
> pragma Warnings (Off, Ada.Strings.Unbounded);
> pragma Warnings (Off, SOAP.Types);
> pragma Warnings (Off, SOAP.Utils);
>
> pragma Style_Checks (Off);
>
> use Ada.Strings.Unbounded;
>
> function "+"
> (Str : String)
> return Unbounded_String
> renames To_Unbounded_String;
>
> type LoginResp_Type is record
> : APIResponse_Type;
> end record;
>
> function To_LoginResp_Type
> (O : SOAP.Types.Object'Class)
> return LoginResp_Type;
>
> function To_SOAP_Object
> (R : LoginResp_Type;
> Name : String := "item")
> return SOAP.Types.SOAP_Record;
>
> end www.betfair.com.publicapi.types.global.v3.LoginResp_Type_Pkg;
> ----------------
>
>
> The record definition misses the variable,
> as well as the specified fields :
> currency
> errorCode
> minorErrorCode
> validUntil
>
>> So even when switching the order wsdl2ada might not generate a proper
>> definition.
>
> Unfortunately, you are correct.
>
> I tried to short the wsdl down to a minimum, but being unused to them,
> it's a bit tricky. Not done yet.
>
> however, the c# code looks like this (a snippet from a large file)
>
> public partial class LoginResp : APIResponse {
> private string currencyField;
> private LoginErrorEnum errorCodeField;
> private string minorErrorCodeField;
> private System.DateTime validUntilField;
> ...
>
> public partial class APIResponseHeader : object,
> System.ComponentModel.INotifyPropertyChanged {
> private APIErrorEnum errorCodeField;
> private string minorErrorCodeField;
> private string sessionTokenField;
> private System.DateTime timestampField;
> ...
> public abstract partial class APIResponse : object,
> System.ComponentModel.INotifyPropertyChanged {
> private APIResponseHeader headerField;
>
>
> So, you are right in inheritance.
>
>
> --
> /Björn
Ok, I got a slimmed wsdl working now.
It contains 2 services, login and logout.
wsdl2ada
* crashes with sigsegv if the types are in wrong order as above
* does not handle 'extension' tag
move block
<xsd:complexType name="LoginResp">
underneath
<xsd:complexType abstract="true" name="APIResponse">
in order to avoid the crash.
I ran (as mentioned in first post)
wsdl2aws -doc BFGlobalService_stripped.wsdl
where below content is file BFGlobalService_stripped.wsdl
-----
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="BFGlobalService"
targetNamespace="http://www.betfair.com/publicapi/v3/BFGlobalService/"
xmlns:types="http://www.betfair.com/publicapi/types/global/v3/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.betfair.com/publicapi/v3/BFGlobalService/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema
targetNamespace="http://www.betfair.com/publicapi/types/global/v3/">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:complexType name="LoginResp">
<xsd:complexContent>
<xsd:extension base="types:APIResponse">
<xsd:sequence>
<xsd:element name="currency" nillable="true" type="xsd:string"/>
<xsd:element name="errorCode" type="types:LoginErrorEnum"/>
<xsd:element name="minorErrorCode" nillable="true"
type="xsd:string"/>
<xsd:element name="validUntil" type="xsd:dateTime"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="APIResponseHeader">
<xsd:sequence>
<xsd:element name="errorCode" type="types:APIErrorEnum"/>
<xsd:element name="minorErrorCode" nillable="true" type="xsd:string"/>
<xsd:element name="sessionToken" nillable="true" type="xsd:string"/>
<xsd:element name="timestamp" type="xsd:dateTime"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType abstract="true" name="APIResponse">
<xsd:sequence>
<xsd:element name="header" nillable="true"
type="types:APIResponseHeader"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType abstract="true" name="APIRequest">
<xsd:sequence>
<xsd:element name="header" nillable="true"
type="types:APIRequestHeader"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="APIRequestHeader">
<xsd:sequence>
<xsd:element name="clientStamp" type="xsd:long"/>
<xsd:element name="sessionToken" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="APIErrorEnum">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="OK"/>
<xsd:enumeration value="INTERNAL_ERROR"/>
<xsd:enumeration value="EXCEEDED_THROTTLE"/>
<xsd:enumeration value="USER_NOT_SUBSCRIBED_TO_PRODUCT"/>
<xsd:enumeration value="SUBSCRIPTION_INACTIVE_OR_SUSPENDED"/>
<xsd:enumeration value="VENDOR_SOFTWARE_INACTIVE"/>
<xsd:enumeration value="VENDOR_SOFTWARE_INVALID"/>
<xsd:enumeration value="SERVICE_NOT_AVAILABLE_IN_PRODUCT"/>
<xsd:enumeration value="NO_SESSION"/>
<xsd:enumeration value="TOO_MANY_REQUESTS"/>
<xsd:enumeration value="PRODUCT_REQUIRES_FUNDED_ACCOUNT"/>
<xsd:enumeration value="SERVICE_NOT_AVAILABLE_FOR_LOGIN_STATUS"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LoginErrorEnum">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="OK"/>
<xsd:enumeration value="OK_MESSAGES"/>
<xsd:enumeration value="FAILED_MESSAGE"/>
<xsd:enumeration value="INVALID_USERNAME_OR_PASSWORD"/>
<xsd:enumeration value="USER_NOT_ACCOUNT_OWNER"/>
<xsd:enumeration value="INVALID_VENDOR_SOFTWARE_ID"/>
<xsd:enumeration value="INVALID_PRODUCT"/>
<xsd:enumeration value="INVALID_LOCATION"/>
<xsd:enumeration value="LOGIN_FAILED_ACCOUNT_LOCKED"/>
<xsd:enumeration value="ACCOUNT_SUSPENDED"/>
<xsd:enumeration value="T_AND_C_ACCEPTANCE_REQUIRED"/>
<xsd:enumeration value="POKER_T_AND_C_ACCEPTANCE_REQUIRED"/>
<xsd:enumeration
value="LOGIN_REQUIRE_TERMS_AND_CONDITIONS_ACCEPTANCE"/>
<xsd:enumeration value="LOGIN_UNAUTHORIZED"/>
<xsd:enumeration value="ACCOUNT_CLOSED"/>
<xsd:enumeration value="LOGIN_RESTRICTED_LOCATION"/>
<xsd:enumeration value="API_ERROR"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ServiceEnum">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="LOGIN"/>
<xsd:enumeration value="LOGOUT"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="LoginReq">
<xsd:sequence>
<xsd:element name="ipAddress" nillable="false" type="xsd:string"/>
<xsd:element name="locationId" nillable="false" type="xsd:int"/>
<xsd:element name="password" nillable="false" type="xsd:string"/>
<xsd:element name="productId" nillable="false" type="xsd:int"/>
<xsd:element name="username" nillable="false" type="xsd:string"/>
<xsd:element name="vendorSoftwareId" nillable="false" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="LogoutErrorEnum">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="OK" />
<xsd:enumeration value="API_ERROR" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="LogoutResp">
<xsd:complexContent mixed="false">
<xsd:extension base="types:APIResponse">
<xsd:sequence>
<xsd:element name="minorErrorCode" nillable="true"
type="xsd:string" />
<xsd:element name="errorCode" type="types:LogoutErrorEnum" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="LogoutReq">
<xsd:complexContent>
<xsd:extension base="types:APIRequest" />
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
<!-- -->
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://www.betfair.com/publicapi/v3/BFGlobalService/">
<xsd:import
namespace="http://www.betfair.com/publicapi/types/global/v3/"/>
<xsd:element name="login">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="request" type="types:LoginReq"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="loginResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Result" nillable="true" type="types:LoginResp"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="logout">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="request" type="types:LogoutReq"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="logoutResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Result" nillable="false"
type="types:LogoutResp"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<!-- -->
<wsdl:message name="loginIn">
<wsdl:part element="tns:login" name="parameters"/>
</wsdl:message>
<wsdl:message name="loginOut">
<wsdl:part element="tns:loginResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="logoutIn">
<wsdl:part element="tns:logout" name="parameters"/>
</wsdl:message>
<wsdl:message name="logoutOut">
<wsdl:part element="tns:logoutResponse" name="parameters"/>
</wsdl:message>
<!-- -->
<wsdl:portType name="BFGlobalService">
<wsdl:operation name="login">
<wsdl:input message="tns:loginIn" name="loginIn"/>
<wsdl:output message="tns:loginOut" name="loginOut"/>
</wsdl:operation>
<wsdl:operation name="logout">
<wsdl:input message="tns:logoutIn" name="logoutIn"/>
<wsdl:output message="tns:logoutOut" name="logoutOut"/>
</wsdl:operation>
</wsdl:portType>
<!-- -->
<wsdl:binding name="BFGlobalService" type="tns:BFGlobalService">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="login">
<soap:operation soapAction="login" style="document"/>
<wsdl:input name="loginIn">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="loginOut">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="logout">
<soap:operation soapAction="logout" style="document"/>
<wsdl:input name="logoutIn">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="logoutOut">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<!-- -->
<wsdl:service name="BFGlobalService">
<wsdl:port binding="tns:BFGlobalService" name="BFGlobalService">
<soap:address
location="https://api.betfair.com/global/v3/BFGlobalService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
-----
--
/Björn
More information about the AWS
mailing list