[AWS] Troble with wsdl2aws

Poul-Erik Andreasen poulerik at pea.dk
Fri Jul 2 14:06:48 CEST 2004


Pascal Obry wrote:

>Poul-Erik,
>
> > i hope you or someone else can give me some hint.
>
>I fear that nobody will be able to help here. You need to provide more
>information. It will be very great if you could send a small reproducer for
>this problem.
>
>  
>
Hey again

I have now been digging into the problem.

If i take the getLast rutine from the the privius
wsdl dukument the generated function with
output of the array image added lookking like this:

pragma Warnings (Off);

with Ada.Exceptions;

with SOAP.Client;
with SOAP.Message.Payload;
with SOAP.Message.Response;
with SOAP.Parameters;
with SOAP.Utils;
with Text_IO; use Text_IO;   --PEA adding
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

.......

function getLast
     (stock  : in Integer;
      v_type : in Integer;
      amount : in Integer)
      return getLast_Result
   is
      P_Set   : SOAP.Parameters.List;
      Payload : SOAP.Message.Payload.Object;
   begin
      --  Set parameters
      P_Set := +SOAP.Types.I (stock, "stock")
         & SOAP.Types.I (v_type, "type")
            & SOAP.Types.I (amount, "amount");
      Payload := SOAP.Message.Payload.Build
        ("getLast", P_Set, "urn:datafeed.dukascopy.com");

--PEA here a some nessesary adding to get contact to the server.     

      declare
         Response : constant SOAP.Message.Response.Object'Class
           := SOAP.Client.Call
                
("http://anonymous:anonymous@freeserv.dukascopy.com/axis/services/Datafeed",
                 Payload,
                 " ",
                 "anonymous",
                 "anonymous");



         R_Param  : constant SOAP.Parameters.List
           := SOAP.Message.Parameters (Response);
      begin

         put(Image(SOAP_Array'(SOAP.Parameters.Get (R_Param, 
"getLastReturn")))); -- PEA addition


         if SOAP.Message.Response.Is_Error (Response) then
            Ada.Exceptions.Raise_Exception
              (SOAP.SOAP_Error'Identity,
               SOAP.Parameters.Get (R_Param, "faultstring"));
         else
            declare
               Result : constant getLast_Result
                 := To_ArrayOfCandle_Type
                 (V ( SOAP_Record'(SOAP.Parameters.Get (R_Param, 
"getLastReturn"))));
            begin
               return Result;
            end;
         end if;
      end;
   end getLast;

it will then com ut with the following output before the
contraint error:
( 1 => (item => (artificial => ()), item => (closePrice => ()), item => 
(flat => ()), item => (id => ()), item => (maxPrice => ()), item => 
(minPrice => ()), item => (openPrice => ()), item => (periodType => ()), 
item => (time => ()), item => (timeIndex => ()), item => (volume => ())))

a test with ada.tags show that the constraint error accurs becouse the 
the program deleveres a
SOAP_record  to the To_Candle_Program where where SOAP_Boolean is expected
(and the same with al the rest of the parameters);

Now kome the interresting part: a sniffing of the communikaction with 
the Ethereal program shows the following

my request:

POST /axis/services/Datafeed HTTP/1.1
Connection: Close
Host: freeserv.dukascopy.com
Accept: text/html, */*
Accept-Encoding: deflate, gzip
Accept-Language: fr, ru, us
User-Agent: AWS (Ada Web Server) v2.1w
Authorization: Basic YW5vbnltb3VzOmFub255bW91cw==
Content-Type: text/xml
SOAPAction: " "
Content-Length: 591

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/1999/XMLSchema" 
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
<SOAP-ENV:Body>
<awsns:getLast xmlns:awsns="urn:datafeed.dukascopy.com">
<stock xsi:type="xsd:int">533</stock>
<type xsi:type="xsd:int">0</type>
<amount xsi:type="xsd:int">1</amount>
</awsns:getLast>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


This will induce the following server ansver:


HTTP/1.1 200 OK
Date: Thu, 01 Jul 2004 16:01:51 GMT
Server: Apache
Connection: close
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8

8f5
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/1999/XMLSchema" 
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
 <soapenv:Header>
  <ns2:sessionID soapenv:mustUnderstand="0" xsi:type="ns1:long" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:ns1="http://www.w3.org/2001/XMLSchema" 
xmlns:ns2="http://xml.apache.org/axis/session">-7240174764224234493</ns2:sessionID>
 </soapenv:Header>
 <soapenv:Body>
  <ns3:getLastResponse 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns3="urn:datafeed.dukascopy.com">
   <ns3:getLastReturn xsi:type="soapenc:Array" 
soapenc:arrayType="ns3:Candle[1]" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <item href="#id0"/>
   </ns3:getLastReturn>
  </ns3:getLastResponse>
  <multiRef id="id0" soapenc:root="0" 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xsi:type="ns4:Candle" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:ns4="urn:datafeed.dukascopy.com">
   <artificial xsi:type="ns5:boolean" 
xmlns:ns5="http://www.w3.org/2001/XMLSchema">false</artificial>
   <closePrice xsi:type="ns6:double" 
xmlns:ns6="http://www.w3.org/2001/XMLSchema">1.7717</closePrice>
   <flat xsi:type="ns7:boolean" 
xmlns:ns7="http://www.w3.org/2001/XMLSchema">false</flat>
   <id xsi:type="ns8:int" 
xmlns:ns8="http://www.w3.org/2001/XMLSchema">533</id>
   <maxPrice xsi:type="ns9:double" 
xmlns:ns9="http://www.w3.org/2001/XMLSchema">1.7722</maxPrice>
   <minPrice xsi:type="ns10:double" 
xmlns:ns10="http://www.w3.org/2001/XMLSchema">1.7715</minPrice>
   <openPrice xsi:type="ns11:double" 
xmlns:ns11="http://www.w3.org/2001/XMLSchema">1.772</openPrice>
   <periodType xsi:type="ns12:int" 
xmlns:ns12="http://www.w3.org/2001/XMLSchema">0</periodType>
   <time xsi:type="ns13:long" 
xmlns:ns13="http://www.w3.org/2001/XMLSchema">1088697610</time>
   <timeIndex xsi:type="ns14:int" 
xmlns:ns14="http://www.w3.org/2001/XMLSchema">108869761</timeIndex>
   <volume xsi:type="ns15:long" 
xmlns:ns15="http://www.w3.org/2001/XMLSchema">0</volume>
  </multiRef>
 </soapenv:Body>
</soapenv:Envelope>
0

As you can se, the server actually send the proper values, but for some 
reason the parsing
goes wrong. The question is know wheter it is the XML there are 
malformed or it is a bug in SOAP.

I will try dig feather into this but some  clou,suggestion,  proposel  
whatever wouldt  be nice.

Best regards

Poul-Erik Andresen.







More information about the AWS mailing list