Groups > Borland > Delphi web services WSDL > Re: WSDL Import Issue




WSDL Import Issue

WSDL Import Issue
13 Nov 2007 18:10:33 -0700
Hi,

We are attempting to utilise a third party webservice and are running
into issues we clearly are not properly comprehending,  I am importing
and generating a request seemingly OK, however the owner of the service
is suggesting our request is poorly structured as I outline below.  Any
assistance will be greatly appreciated,

When we import the WSDL using the command Line WSDLImp.exe we get a
class definition as follows:-
<Snip>
  Image = class(TRemotable)
  private
    FText: TByteDynArray;
    FName_: WideString;
    FName__Specified: boolean;
    FType_: WideString;
    FType__Specified: boolean;
    FAltTag: WideString;
    FAltTag_Specified: boolean;
    FPriority: WideString;
    FPriority_Specified: boolean;
    FFormat: WideString;
    FFormat_Specified: boolean;
    procedure SetName_(Index: Integer; const AWideString: WideString);
    function  Name__Specified(Index: Integer): boolean;
    procedure SetType_(Index: Integer; const AWideString: WideString);
    function  Type__Specified(Index: Integer): boolean;
    procedure SetAltTag(Index: Integer; const AWideString: WideString);
    function  AltTag_Specified(Index: Integer): boolean;
    procedure SetPriority(Index: Integer; const AWideString:
WideString);
    function  Priority_Specified(Index: Integer): boolean;
    procedure SetFormat(Index: Integer; const AWideString: WideString);
    function  Format_Specified(Index: Integer): boolean;
  published
    property Text:     TByteDynArray  Index (IS_TEXT) read FText write
FText;
    property Name_:    WideString     Index (IS_ATTR or IS_OPTN) read
FName_ write SetName_ stored Name__Specified;
    property Type_:    WideString     Index (IS_ATTR or IS_OPTN) read
FType_ write SetType_ stored Type__Specified;
    property AltTag:   WideString     Index (IS_ATTR or IS_OPTN) read
FAltTag write SetAltTag stored AltTag_Specified;
    property Priority: WideString     Index (IS_ATTR or IS_OPTN) read
FPriority write SetPriority stored Priority_Specified;
    property Format:   WideString     Index (IS_ATTR or IS_OPTN) read
FFormat write SetFormat stored Format_Specified;
  end;
</Snip>

This generates a request that looks like the following
<Snip>
<Image Name="Elemis Skin Specifics Facial.jpg">
<Text>UJJQUFELzJ3QkRBQU1DQWdNQ0FnTURBd01FQXdNRUJRZ0ZC
</Text>
<Type>jpg</Type>
<AltTag>0</AltTag>
</Image>
</Snip>

While we are advised by the developer of the service that they are
expecting to receive
<Snip>
<Image Name="Elemis Skin Specifics Facial.jpg" AltTag="0"
Type="jpg">
UJJQUFELzJ3QkRBQU1DQWdNQ0FnTURBd01FQXdNRUJRZ0ZC
</Image>
</Snip>

-- 
Post Reply
Re: WSDL Import Issue
Wed, 14 Nov 2007 12:09:10 -080
Hello,

What version of the SOAP runtime are you using? The attributes on your
properties match what you're expecting. IOW, the IS_TEXT and IS_ATTR bits on
the 'Index' is what the latest runtime will use to decide how to serialize
the data to XML. Earlier runtimes (pre-D2007) don't pay attention to any of
these flags. If you have an earlier version of Delphi you'll need to pick
the updates from here:

  http://cc.codegear.com/Item/24535

You might run into a problem whereby the runtime does not allow you to send
an array as text. That's a bug that's been addressed since as byte array
should be allowed as text. However, it seems that that's not issue you've
run into which leads me to believe that you have an earlier runtime.

I took the class you posted, filled in the implementation, dropped it on a
form with a RIO, a Button and a Memo. In the Button Click event I added the
following code:

procedure TForm1.Button1Click(Sender: TObject);
var
  AnImage: Image;
  Data: TByteDynArray;
begin
  AnImage := Image.Create;
  try
    AnImage.Name_ := 'AName.jpg';
    AnImage.Type_ := 'JPG';
    AnImage.FPriority := 'High';

    SetLength(Data, 10);
    AnImage.Text := Data;
    Memo1.Text := ObjToXML(AnImage, CloneConverter(HTTPRIO1));
  finally
    AnImage.Free;
  end;
end;


After executing the above, my Memo contains the following:

<?xml version="1.0"?>
<Root xmlns="urn:TestNamespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Image xmlns="urn:Unit1" Name_="AName.jpg"
Type_="JPG">AAAAAAAAAAAAAA==</Image>
</Root>

(NOTE: There's a bug above where I accessed 'FPriority' instead of
'Priority'; this prevented the specified flag to be set and made the runtime
not stream the data; I noted that after inspecting my code but left it
as-is).

Please let me know the version of Delphi/SOAP runtime you are using.

Cheers,

Bruneau.

Post Reply
about | contact