Groups > Borland > Delphi web services WSDL > Re: WSDL - a problem...




WSDL - a problem...

WSDL - a problem...
Mon, 17 Dec 2007 15:51:46 +010
Hi,

I have to send messages to a WebService...I got WSDL, some XML and test 
data. I produced a unit using the WSDL-importer but the result is poor. 
Some types are not recognized. I downloaded the latest importer, but the 
problem still exists.

I am not very familiar to XML etc. but I think there is a problem in the 
WSDL I got, but I am not sure.

I use Turbo Delphi W32. I have enclosed some data and the shortened 
WSDL. If it is nesessary to post the complete address etc. I would send 
it directly.

As I have read some of the threads here I am pretty sure it has to do 
with "importing schemas"

Thank you for any hint!

Gerhard

**********************************************************************


****WSDL************

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
xmlns:tns="http://tempuri.org/" 
xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
targetNamespace="http://tempuri.org/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <wsdl:types>
     <s:schema elementFormDefault="qualified" 
targetNamespace="http://tempuri.org/">
       <s:element name="OrderRequest">
         <s:complexType>
           <s:sequence>
             <s:element minOccurs="0" maxOccurs="1"
name="ID" 
type="s:string" />
             <s:element minOccurs="0" maxOccurs="1"
name="OrderID" 
type="s:string" />
             <s:element minOccurs="0" maxOccurs="1"
name="OrderInfo">
               <s:complexType mixed="true">
                 <s:sequence>
                   <s:any />
                 </s:sequence>
               </s:complexType>
             </s:element>
           </s:sequence>
         </s:complexType>
       </s:element>
       <s:element name="OrderRequestResponse">
         <s:complexType>
           <s:sequence>
             <s:element minOccurs="1" maxOccurs="1" 
name="OrderRequestResult" type="s:short" />
             <s:element minOccurs="0" maxOccurs="1"
name="OrderID" 
type="s:string" />
           </s:sequence>
         </s:complexType>
       </s:element>
     </s:schema>
   </wsdl:types>
   <wsdl:message name="OrderRequestSoapIn">
     <wsdl:part name="parameters"
element="tns:OrderRequest" />
   </wsdl:message>
   <wsdl:message name="OrderRequestSoapOut">
     <wsdl:part name="parameters"
element="tns:OrderRequestResponse" />
   </wsdl:message>
   <wsdl:portType name="OrdersSoap">
     <wsdl:operation name="OrderRequest">
       <wsdl:documentation 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Order request (or 
modification) from transport company to tank cleaning station. 
(1)</wsdl:documentation>
       <wsdl:input message="tns:OrderRequestSoapIn" />
       <wsdl:output message="tns:OrderRequestSoapOut" />
     </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="OrdersSoap"
type="tns:OrdersSoap">
     <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
/>
     <wsdl:operation name="OrderRequest">
       <soap:operation soapAction="http://tempuri.org/OrderRequest"

style="document" />
       <wsdl:input>
         <soap:body use="literal" />
       </wsdl:input>
       <wsdl:output>
         <soap:body use="literal" />
       </wsdl:output>
     </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="OrdersSoap12"
type="tns:OrdersSoap">
     <soap12:binding
transport="http://schemas.xmlsoap.org/soap/http" />
     <wsdl:operation name="OrderRequest">
       <soap12:operation
soapAction="http://tempuri.org/OrderRequest" 
style="document" />
       <wsdl:input>
         <soap12:body use="literal" />
       </wsdl:input>
       <wsdl:output>
         <soap12:body use="literal" />
       </wsdl:output>
     </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="Orders">
     <wsdl:port name="OrdersSoap"
binding="tns:OrdersSoap">
       <soap:address 
location="http://lynx.vanroey.be/ecd_webserv/orders.asmx" />
     </wsdl:port>
     <wsdl:port name="OrdersSoap12"
binding="tns:OrdersSoap12">
       <soap12:address 
location="http://lynx.vanroey.be/ecd_webserv/orders.asmx" />
     </wsdl:port>
   </wsdl:service>
</wsdl:definitions><?xml version="1.0"
encoding="utf-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
xmlns:tns="http://tempuri.org/" 
xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
targetNamespace="http://tempuri.org/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <wsdl:types>
     <s:schema elementFormDefault="qualified" 
targetNamespace="http://tempuri.org/">
       <s:element name="OrderRequest">
         <s:complexType>
           <s:sequence>
             <s:element minOccurs="0" maxOccurs="1"
name="ID" 
type="s:string" />
             <s:element minOccurs="0" maxOccurs="1"
name="OrderID" 
type="s:string" />
             <s:element minOccurs="0" maxOccurs="1"
name="OrderInfo">
               <s:complexType mixed="true">
                 <s:sequence>
                   <s:any />
                 </s:sequence>
               </s:complexType>
             </s:element>
           </s:sequence>
         </s:complexType>
       </s:element>
       <s:element name="OrderRequestResponse">
         <s:complexType>
           <s:sequence>
             <s:element minOccurs="1" maxOccurs="1" 
name="OrderRequestResult" type="s:short" />
             <s:element minOccurs="0" maxOccurs="1"
name="OrderID" 
type="s:string" />
           </s:sequence>
         </s:complexType>
       </s:element>
     </s:schema>
   </wsdl:types>
   <wsdl:message name="OrderRequestSoapIn">
     <wsdl:part name="parameters"
element="tns:OrderRequest" />
   </wsdl:message>
   <wsdl:message name="OrderRequestSoapOut">
     <wsdl:part name="parameters"
element="tns:OrderRequestResponse" />
   </wsdl:message>
   <wsdl:portType name="OrdersSoap">
     <wsdl:operation name="OrderRequest">
       <wsdl:documentation 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Order request (or 
modification) from transport company to tank cleaning station. 
(1)</wsdl:documentation>
       <wsdl:input message="tns:OrderRequestSoapIn" />
       <wsdl:output message="tns:OrderRequestSoapOut" />
     </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="OrdersSoap"
type="tns:OrdersSoap">
     <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
/>
     <wsdl:operation name="OrderRequest">
       <soap:operation soapAction="http://tempuri.org/OrderRequest"

style="document" />
       <wsdl:input>
         <soap:body use="literal" />
       </wsdl:input>
       <wsdl:output>
         <soap:body use="literal" />
       </wsdl:output>
     </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="OrdersSoap12"
type="tns:OrdersSoap">
     <soap12:binding
transport="http://schemas.xmlsoap.org/soap/http" />
     <wsdl:operation name="OrderRequest">
       <soap12:operation
soapAction="http://tempuri.org/OrderRequest" 
style="document" />
       <wsdl:input>
         <soap12:body use="literal" />
       </wsdl:input>
       <wsdl:output>
         <soap12:body use="literal" />
       </wsdl:output>
     </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="Orders">
     <wsdl:port name="OrdersSoap"
binding="tns:OrdersSoap">
       <soap:address 
location="http://lynx.vanroey.be/ecd_webserv/orders.asmx" />
     </wsdl:port>
     <wsdl:port name="OrdersSoap12"
binding="tns:OrdersSoap12">
       <soap12:address 
location="http://lynx.vanroey.be/ecd_webserv/orders.asmx" />
     </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

****UNIT************

// 
************************************************************************ //
// Die in dieser Datei deklarierten Typen wurden aus Daten generiert, 
die aus
// unten beschriebener WSDL-Datei stammen:
// WSDL     : orders.asmx.test.xml
// Codierung : utf-8
// Version  : 1.0
// (10.12.2007 20:49:39 - 16.03.2006)
// 
************************************************************************ //

unit orders;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type

   // 
************************************************************************ //
   // Die folgenden Typen, auf die im WSDL-Dokument Bezug genommen wird, 
sind in dieser Datei
   // nicht repräsentiert. Sie sind entweder Aliase(@) anderer 
repräsentierter Typen oder auf sie wurde Bezug genommen,
   // aber in diesem Dokument nicht deklariert (!). Die Typen aus 
letzterer Kategorie
   // sind normalerweise mit vordefinierten/bekannten XML- oder 
Borland-Typen verbunden; sie könnten aber auch ein Anzeichen
   // für ein falsches WSDL-Dokument sein, das einen Schema-Typ nicht 
deklariert oder importiert..
   // 
************************************************************************ //
   // !:string          - "http://www.w3.org/2001/XMLSchema"
   // !:short           - "http://www.w3.org/2001/XMLSchema"


   OrderInfo       =  type WideString;      { "http://tempuri.org/" }

   // 
************************************************************************ //
   // Namespace : http://tempuri.org/
   // soapAction: http://tempuri.org/OrderRequest
   // Transport : http://schemas.xmlsoap.org/soap/http
   // Bindung   : OrdersSoap
   // Service   : Orders
   // Port      : OrdersSoap
   // URL       : http://lynx.vanroey.be/ecd_webserv/orders.asmx
   // 
************************************************************************ //
   OrdersSoap = interface(IInvokable)
   ['']
     procedure OrderRequest(const ID: WideString; const OrderID: 
WideString; const OrderInfo: OrderInfo; out OrderRequestResult: 
Smallint; out OutOrderID: WideString); stdcall;
   end;

function GetOrdersSoap(UseWSDL: Boolean=System.False; Addr: string=''; 
HTTPRIO: THTTPRIO = nil): OrdersSoap;


implementation

function GetOrdersSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: 
THTTPRIO): OrdersSoap;
const
   defWSDL = 'orders.asmx.test.xml';
   defURL  = '';
   defSvc  = 'Orders';
   defPrt  = 'OrdersSoap';
var
   RIO: THTTPRIO;
begin
   Result := nil;
   if (Addr = '') then
   begin
     if UseWSDL then
       Addr := defWSDL
     else
       Addr := defURL;
   end;
   if HTTPRIO = nil then
     RIO := THTTPRIO.Create(nil)
   else
     RIO := HTTPRIO;
   try
     Result := (RIO as OrdersSoap);
     if UseWSDL then
     begin
       RIO.WSDLLocation := Addr;
       RIO.Service := defSvc;
       RIO.Port := defPrt;
     end else
       RIO.URL := Addr;
   finally
     if (Result = nil) and (HTTPRIO = nil) then
       RIO.Free;
   end;
end;


initialization
   InvRegistry.RegisterInterface(TypeInfo(OrdersSoap), 
'http://tempuri.org/', 'utf-8');
   InvRegistry.RegisterDefaultSOAPAction(TypeInfo(OrdersSoap), 
'http://tempuri.org/OrderRequest');
   RemClassRegistry.RegisterXSInfo(TypeInfo(OrderInfo), 
'http://tempuri.org/', 'OrderInfo');

end.

****Structure of data to send************

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified">
   <xs:element name="CleaningOrder">
     <xs:complexType>
       <xs:sequence>
         <xs:element name="SenderId" type="xs:string"
/>
         <xs:element name="RefId" type="xs:string" />
         <xs:element name="RecieverId" type="xs:string"
/>
       </xs:sequence>
     </xs:complexType>
   </xs:element>
</xs:schema>

***Data to send************

<?xml version="1.0" encoding="utf-8"?>
<CleaningOrder xmlns="">
	<SenderId>1234567</SenderId>
	<RefId>11223344</RefId>
	<ReceiverId>56784321</ReceiverId>
</CleaningOrder>

Die wird nach Memo.Lines.Text geladen

****call in program***********

AOrdersSoap:=GetOrdersSoap(true);
AOrdersSoap.OrderRequest('1234567',OrderID,MemoOrder.Lines.Text,iOutRes,OutOrder
ID);

****resulting Stream************

POST /ecd_webserv/orders.asmx HTTP/1.1
SOAPAction: "http://tempuri.org/OrderRequest"
Content-Type: text/xml; charset="utf-8"
User-Agent: Borland SOAP 1.2
Host: test.host.com
Content-Length: 1455 - stimmt natürlich hier nicht mehr...
Connection: Keep-Alive
Cache-Control: no-cache

<?xml version="1.0"?>
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP
-ENV:Body 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:NS2="http://tempuri.org/"><NS1:OrderRequest 
xmlns:NS1="http://tempuri.org/"><ID 
xsi:type="xsd:string">1234567</ID><OrderID 
xsi:type="xsd:string"></OrderID><OrderInfo
xsi:type="NS2:OrderInfo">
&lt;CleaningOrder xmlns=""&gt;
&lt;SenderId&gt;1234567&lt;/SenderId&gt;
&lt;RefId&gt;11223344&lt;/RefId&gt;
&lt;ReceiverId&gt;56784321&lt;/ReceiverId&gt;
&lt;/CleaningOrder&gt;</OrderInfo></NS1:OrderRequest></SO
AP-ENV:Body></SOAP-ENV:Envelope>

Post Reply
Re: WSDL - a problem...
Mon, 17 Dec 2007 17:53:35 -080
Hello,

The WSDL you posted is that of a doc|lit service and yet the envelope being
sent very much resembles that of a rpc|encoded packet. Could it be that you
have an earlier importer that failed to detect this correctly? Or, if your
service is built with WCF v3.0, there is a known issue about properly
detecting the style of the service. However, the WSDL you posted does not
like it's from WCF v3.0.

Can you post the first few lines of the initialization section of the file
generated by the WSDL importer?

Does is read something along the lines of:

initialization
  InvRegistry.RegisterInterface(TypeInfo(OrdersSoap), 'http://tempuri.org/',
'utf-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(OrdersSoap),
'http://tempuri.org/OrderRequest');
  InvRegistry.RegisterReturnParamNames(TypeInfo(OrdersSoap),
'OrderRequestResult');
  InvRegistry.RegisterInvokeOptions(TypeInfo(OrdersSoap), ioDocument);
  RemClassRegistry.RegisterXSInfo(TypeInfo(OrderInfo),
'http://tempuri.org/', 'OrderInfo');

Cheers,

Bruneau.




PS:

Here's the binding I generated with the importer:

// ************************************************************************
//
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : test.xml
//  >Import : test.xml:0
// Encoding : utf-8
// Version  : 1.0
// (12/17/2007 5:49:57 PM - - $Rev: 7395 $)
// ************************************************************************
//

unit test;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
  IS_OPTN = $0001;


type

  //
************************************************************************ //
  // The following types, referred to in the WSDL document are not being
represented
  // in this file. They are either aliases[@] of other types represented or
were referred
  // to but never[!] declared in the document. The types from the latter
category
  // typically map to predefined/known XML or Borland types; however, they
could also
  // indicate incorrect WSDL documents that failed to declare or import a
schema type.
  //
************************************************************************ //
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:schema          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:short           - "http://www.w3.org/2001/XMLSchema"[Gbl]


  OrderInfo       = TXMLData;       { "http://tempuri.org/"[CplxMxd]
}

  //
************************************************************************ //
  // Namespace : http://tempuri.org/
  // soapAction: http://tempuri.org/OrderRequest
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : OrdersSoap
  // service   : Orders
  // port      : OrdersSoap
  // URL       : http://lynx.vanroey.be/ecd_webserv/orders.asmx
  //
************************************************************************ //
  OrdersSoap = interface(IInvokable)
  ['']
    function  OrderRequest(const ID: WideString; var OrderID: WideString;
const OrderInfo: OrderInfo): Smallint; stdcall;
  end;

function GetOrdersSoap(UseWSDL: Boolean=System.False; Addr: string='';
HTTPRIO: THTTPRIO = nil): OrdersSoap;


implementation
  uses SysUtils;

function GetOrdersSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO):
OrdersSoap;
const
  defWSDL = 'test.xml';
  defURL  = 'http://lynx.vanroey.be/ecd_webserv/orders.asmx';
  defSvc  = 'Orders';
  defPrt  = 'OrdersSoap';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as OrdersSoap);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;


initialization
  InvRegistry.RegisterInterface(TypeInfo(OrdersSoap), 'http://tempuri.org/',
'utf-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(OrdersSoap),
'http://tempuri.org/OrderRequest');
  InvRegistry.RegisterReturnParamNames(TypeInfo(OrdersSoap),
'OrderRequestResult');
  InvRegistry.RegisterInvokeOptions(TypeInfo(OrdersSoap), ioDocument);
  RemClassRegistry.RegisterXSInfo(TypeInfo(OrderInfo),
'http://tempuri.org/', 'OrderInfo');

end.

Post Reply
Re: WSDL - a problem...
Wed, 19 Dec 2007 10:11:10 +010
Hello,

the generated unit is in my posting after the WSDL, also some data and 
the resulting stream. There is also the complete address where the 
service resides.

I used the latest importer I could find according to some of your 
earlier comments to other postings - but it seems to me that when I call 
the importer from inside Turbo Delphi I always get the same one - there 
is e.g. no '$Rev:' in the generated header...but I put the downlaoded 
wsdlimp.exe into the bin directory c:\Borland\BDS\4.0 - is this the 
right way to get the latest importer from inside the IDE? I am not quite 
sure...

Thank you for any more hints!

Post Reply
Re: WSDL - a problem...
Wed, 19 Dec 2007 15:55:19 +010
On Wed, 19 Dec 2007 10:11:10 +0100, Gerhard Delfs  
<gerhard.delfs@gmail.com> wrote:

> Hello,
>
> the generated unit is in my posting after the WSDL, also some data and  
> the resulting stream. There is also the complete address where the  
> service resides.
>
> I used the latest importer I could find according to some of your  
> earlier comments to other postings - but it seems to me that when I call  
> the importer from inside Turbo Delphi I always get the same one - there  
> is e.g. no '$Rev:' in the generated header...but I put the downlaoded  
> wsdlimp.exe into the bin directory c:\Borland\BDS\4.0 - is this the  
> right way to get the latest importer from inside the IDE? I am not quite  
> sure...

I always call wsdlimp.exe outside the IDE (D2005). That works properly.

Post Reply
Re: WSDL - a problem...
Wed, 19 Dec 2007 16:50:03 +010
Hello,

the parameters for wsdlimp.exe a a bit confusing to me...what would be a 
kind of default? I am not used to cmd-line calls... ;-)

Post Reply
<< Previous 1 2 3 Next >>
( Page 1 of 3 )
about | contact