Board index » delphi » D6EE SOAP WSDL Importer & reserved words problem

D6EE SOAP WSDL Importer & reserved words problem

Hi,

I'm in the process of writing a client for a webservice I didn't write...

I used the WSDL importer of D6EE to get the interface for the service.
WSDL Importer properly renames reserved words with an '_' (underscore).
However, the return mapping is never registered (or something)

How can I fix this?

We've been bugging with this:

---- Imported Interface: ----
initialization
  RemClassRegistry.RegisterExternalPropName(TypeInfo(Location), 'Type_',
'Type');
----

---- InvokeRegistry.pas ----
  TRemRegEntry = record
    ClassType: TClass;
    Info: PTypeInfo;
    URI: WideString;
    Name: WideString;
    ExtName: WideString;
    IsScalar: Boolean;
    MultiRefOpt: TObjMultiOptions;
    SerializationOpt: TSerializationOptions;
    PropNameMap: array of ExtNameMapItem;   // <-- added this
  end;

procedure TRemotableTypeRegistry.RegisterExternalPropName(Info: PTypeInfo;
InternalName: string; const ExternalName: InvString);
var
  I, J: Integer;
begin
//Todo:'_' checking!
  Lock;
  try
    for I := 0 to Length(UriMap) - 1 do
      if UriMap[I].Info = Info then
      begin
        J := Length(UriMap[I].PropNameMap);
        SetLength(UriMap[I].PropNameMap, J + 1);
        UriMap[I].PropNameMap[J].Name := InternalName;
        UriMap[I].PropNameMap[J].ExtName := ExternalName;
      end;
  finally
    Unlock;
  end;
end;

function TRemotableTypeRegistry.GetExternalPropName(Info: PTypeInfo;
InternalName: string): InvString;
var
  I, J: Integer;
begin
//Todo:'_' checking!
  Result := InternalName;
  Lock;
  try
    for I := 0 to Length(UriMap) - 1 do
    begin
      if UriMap[I].Info = Info then
      begin
        for J := 0 to Length(UriMap[I].PropNameMap) -1 do
          if SameText(UriMap[I].PropNameMap[J].Name, InternalName) then
          begin
            if UriMap[I].PropNameMap[J].ExtName <> '' then
              Result := UriMap[I].PropNameMap[J].ExtName;
            Exit;
          end;
      end;
    end;
  finally
    Unlock;
  end;
end;

function TRemotableTypeRegistry.GetInternalPropName(Info: PTypeInfo;
ExternalName: InvString): string;
var
  I, J: Integer;
begin
//Todo:'_' checking!
  Result := ExternalName;
  Lock;
  try
    for I := 0 to Length(UriMap) - 1 do
    begin
      if UriMap[I].Info = Info then
      begin
        for J := 0 to Length(UriMap[I].PropNameMap) -1 do
          if SameText(UriMap[I].PropNameMap[J].ExtName, ExternalName) then
          begin
            if UriMap[I].PropNameMap[J].Name <> '' then
              Result := UriMap[I].PropNameMap[J].Name;
            Exit;
          end;
      end;
    end;
  finally
    Unlock;
  end;
end;
----

This makes the functions look very similar to TInvokableClassRegistry's
RegisterExternalMethName, GetMethExternalName and GetMethInternalName... And
UriMap resembles the FRegIntfs of TInvokableClassRegistry.

Now it looks like I'm close, but I haven't got a clue what to do about the
_'s...
Also, the above doesn't say anything to me (kindof clueless wat it does)

Can anyone please shed some light on this problem?
Any help is appreciated...

Rory

PS. To be fair, this shouldn't be happening... Converting to a language will
always come into problems with this. Why is this not documented? I can imagine
that C or VB will have similar problems right? So it should be fixed in the
interface using the wsdl you created... SOAP can't be responsible for this...

 

Re:D6EE SOAP WSDL Importer & reserved words problem


Hi DJ Bo,

Quote
> I used the WSDL importer of D6EE to get the interface for the service.
> WSDL Importer properly renames reserved words with an '_' (underscore).
> However, the return mapping is never registered (or something)

FWIW, this was fixed in Delphi 7. I once tried to manually fix the
Delphi 6 generated import unit, but can't remember anymore if this was
successful or not, sorry...

If you have the location of the WSDL, I can try to generate a Delphi 7
import unit for you (so you can see if that compiles with Delphi 6 ;-)

Groetjes,
          Bob Swart (aka Dr.Bob - www.DrBob42.com)

--
Bob Swart Training & Consultancy (eBob42.com) - Delphi & Web Services
webmaster UK Borland User Group (BUG) & Borland UK Connections member

Re:D6EE SOAP WSDL Importer & reserved words problem


Got it...

I forgot the line:
  RemClassRegistry.RegisterExternalPropName(TypeInfo(LocationInput), 'Type_',
'Type');

as I wasn't using the Location object but the LocationInput object...

Quote
"DJ Bo" <d...@gios.nl> wrote in message

news:3e6ca2ff$1@newsgroups.borland.com...
Quote
> Hi,

> I'm in the process of writing a client for a webservice I didn't write...

> I used the WSDL importer of D6EE to get the interface for the service.
> WSDL Importer properly renames reserved words with an '_' (underscore).
> However, the return mapping is never registered (or something)

> How can I fix this?

> We've been bugging with this:

> ---- Imported Interface: ----
> initialization
>   RemClassRegistry.RegisterExternalPropName(TypeInfo(Location), 'Type_',
> 'Type');
> ----

> ---- InvokeRegistry.pas ----
>   TRemRegEntry = record
>     ClassType: TClass;
>     Info: PTypeInfo;
>     URI: WideString;
>     Name: WideString;
>     ExtName: WideString;
>     IsScalar: Boolean;
>     MultiRefOpt: TObjMultiOptions;
>     SerializationOpt: TSerializationOptions;
>     PropNameMap: array of ExtNameMapItem;   // <-- added this
>   end;

> procedure TRemotableTypeRegistry.RegisterExternalPropName(Info: PTypeInfo;
> InternalName: string; const ExternalName: InvString);
> var
>   I, J: Integer;
> begin
> //Todo:'_' checking!
>   Lock;
>   try
>     for I := 0 to Length(UriMap) - 1 do
>       if UriMap[I].Info = Info then
>       begin
>         J := Length(UriMap[I].PropNameMap);
>         SetLength(UriMap[I].PropNameMap, J + 1);
>         UriMap[I].PropNameMap[J].Name := InternalName;
>         UriMap[I].PropNameMap[J].ExtName := ExternalName;
>       end;
>   finally
>     Unlock;
>   end;
> end;

> function TRemotableTypeRegistry.GetExternalPropName(Info: PTypeInfo;
> InternalName: string): InvString;
> var
>   I, J: Integer;
> begin
> //Todo:'_' checking!
>   Result := InternalName;
>   Lock;
>   try
>     for I := 0 to Length(UriMap) - 1 do
>     begin
>       if UriMap[I].Info = Info then
>       begin
>         for J := 0 to Length(UriMap[I].PropNameMap) -1 do
>           if SameText(UriMap[I].PropNameMap[J].Name, InternalName) then
>           begin
>             if UriMap[I].PropNameMap[J].ExtName <> '' then
>               Result := UriMap[I].PropNameMap[J].ExtName;
>             Exit;
>           end;
>       end;
>     end;
>   finally
>     Unlock;
>   end;
> end;

> function TRemotableTypeRegistry.GetInternalPropName(Info: PTypeInfo;
> ExternalName: InvString): string;
> var
>   I, J: Integer;
> begin
> //Todo:'_' checking!
>   Result := ExternalName;
>   Lock;
>   try
>     for I := 0 to Length(UriMap) - 1 do
>     begin
>       if UriMap[I].Info = Info then
>       begin
>         for J := 0 to Length(UriMap[I].PropNameMap) -1 do
>           if SameText(UriMap[I].PropNameMap[J].ExtName, ExternalName) then
>           begin
>             if UriMap[I].PropNameMap[J].Name <> '' then
>               Result := UriMap[I].PropNameMap[J].Name;
>             Exit;
>           end;
>       end;
>     end;
>   finally
>     Unlock;
>   end;
> end;
> ----

> This makes the functions look very similar to TInvokableClassRegistry's
> RegisterExternalMethName, GetMethExternalName and GetMethInternalName... And
> UriMap resembles the FRegIntfs of TInvokableClassRegistry.

> Now it looks like I'm close, but I haven't got a clue what to do about the
> _'s...
> Also, the above doesn't say anything to me (kindof clueless wat it does)

> Can anyone please shed some light on this problem?
> Any help is appreciated...

> Rory

> PS. To be fair, this shouldn't be happening... Converting to a language will
> always come into problems with this. Why is this not documented? I can imagine
> that C or VB will have similar problems right? So it should be fixed in the
> interface using the wsdl you created... SOAP can't be responsible for this...

Re:D6EE SOAP WSDL Importer & reserved words problem


Quote
> I used the WSDL importer of D6EE to get the interface for the service.
> WSDL Importer properly renames reserved words with an '_' (underscore).
> However, the return mapping is never registered (or something)

> How can I fix this?

I remember doing something like this - except I've forgotten which service I
used. Could you let me know if there's a service I could use so I can check
out what changes I'd made to the d6 soap source for it?

--
Deepak Shenoy (TeamB)
Agni Software
http://www.agnisoft.com

Re:D6EE SOAP WSDL Importer & reserved words problem


Dear Bob,

Thank you for the import you made...
It does indeed look what I created by hand.
However, the D6EE InvokeRegistry.pas doesn't do anything in order to actually
'map' type to type_.
My changes 'look' like they are indeed working, and with your interface it does
so indeed.
Are they enough (changes in first post regarding the three functions) ?

I'll keep the changes as they are for now (as they are working :) )...

Thanks again,
Rory

Other Threads