[Lazarus] Webservice Toolkit problem

Ian Godman ianpg2010 at gmail.com
Sun Sep 23 14:13:42 CEST 2012


Hi

I am have a web service written in Java which is working fine when used
from SOAPUI.

I am trying to write a client using Lazarus and WST as I need a client for
Windows and OSX and it would be nice if could get it to work with Linux
also (I use Suse).

I have managed to get a "Hello World" service working but now am trying
something a little more adventurous.

The problem is that the proxy generated by WST does not make sense to me:

{
This unit has been produced by ws_helper.
  Input unit name : "hello".
  This unit name  : "hello_proxy".
  Date            : "09/23/12 12:47:48 PM".
}

Unit hello_proxy;
{$IFDEF FPC} {$mode objfpc}{$H+} {$ENDIF}
Interface

Uses SysUtils, Classes, TypInfo, base_service_intf, service_intf, hello,
     http_cxf_apache_org_aegisTypes, http_example_org;

Type

Implementation
uses wst_resources_imp, metadata_repository;

initialization
  {$i hello.wst}

  {$IF DECLARED(Register_hello_ServiceMetadata)}
  Register_hello_ServiceMetadata();
  {$IFEND}
End.


The wdsl I have is generated by CXF and works fine when imported into
SOAPUI.

My WSDL ia at the end of this email.

The documentation for WST and my previous "Hello World" service leads me to
think I should have some code in the proxy to set things like the
ServicePortType etc.

I imported it using the latest WST from the repository with the flowing
options:

   - add generated files to project
   - Interface file
   - Parse all types
   - Proxy file

I am using Lazarus 1.0 with FPC 2.6.0 on OSX.

If I save the Lazarus application before using WST it reports errors
reading files but if I create a new project and run the WST import before
saving no errors are reported and I can then save every thing fine.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="HelloWorld" targetNamespace="http://example.org/"
xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://example.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
  <wsdl:types>
<xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://example.org" xmlns:ns0="
http://cxf.apache.org/aegisTypes" xmlns:tns="http://example.org" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://cxf.apache.org/aegisTypes"/>
<xsd:complexType name="User">
<xsd:sequence>
<xsd:element minOccurs="0" name="email" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="enabled" type="ns0:char"/>
<xsd:element minOccurs="0" name="firstname" nillable="true"
type="xsd:string"/>
<xsd:element minOccurs="0" name="id" type="xsd:long"/>
<xsd:element minOccurs="0" name="password" nillable="true"
type="xsd:string"/>
<xsd:element minOccurs="0" name="surname" nillable="true"
type="xsd:string"/>
<xsd:element minOccurs="0" name="username" nillable="true"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="unqualified" targetNamespace="
http://cxf.apache.org/aegisTypes" xmlns:aegisTypes="
http://cxf.apache.org/aegisTypes" xmlns:xs="http://www.w3.org/2001/XMLSchema
">
<xs:simpleType name="char">
<xs:restriction base="xs:short">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://example.org/"
xmlns:ns0="http://example.org" xmlns:tns="http://example.org/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://example.org"/>
<xsd:element name="getUser" type="tns:getUser"/>
<xsd:complexType name="getUser">
<xsd:sequence>
<xsd:element minOccurs="0" name="arg0" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="getUserResponse" type="tns:getUserResponse"/>
<xsd:complexType name="getUserResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="return" type="ns0:User"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="hello" type="tns:hello"/>
<xsd:complexType name="hello">
<xsd:sequence>
<xsd:element minOccurs="0" name="arg0" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="helloResponse" type="tns:helloResponse"/>
<xsd:complexType name="helloResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="return" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
  </wsdl:types>
  <wsdl:message name="getUserResponse">
    <wsdl:part element="tns:getUserResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="hello">
    <wsdl:part element="tns:hello" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getUser">
    <wsdl:part element="tns:getUser" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="helloResponse">
    <wsdl:part element="tns:helloResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="HelloWorldPortType">
    <wsdl:operation name="getUser">
      <wsdl:input message="tns:getUser" name="getUser">
    </wsdl:input>
      <wsdl:output message="tns:getUserResponse" name="getUserResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="hello">
      <wsdl:input message="tns:hello" name="hello">
    </wsdl:input>
      <wsdl:output message="tns:helloResponse" name="helloResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorldPortType">
    <soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getUser">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="getUser">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="getUserResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="hello">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="hello">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="helloResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="HelloWorld">
    <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldPort">
      <soap:address location="http://localhost:63081/hello"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120923/bf27da53/attachment-0002.html>


More information about the Lazarus mailing list