[Lazarus] Web-services

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Mon Aug 6 12:21:57 CEST 2012


Hi,

In the generated hello.pas, try changing  'literal' to 'document' in the
following calls:

   mm.SetOperationCustomData(
     sUNIT_NAME,
     'HelloWorldPortType',
     'hello',
     'FORMAT_Input_EncodingStyle',
     'literal'
   );
   mm.SetOperationCustomData(
     sUNIT_NAME,
     'HelloWorldPortType',
     'hello',
     'FORMAT_OutputEncodingStyle',
     'literal'
   );

Michael.

On Mon, 6 Aug 2012, Ian Godman wrote:

> Hi
>
> I have been having an issue with a "Hello World" web service.
>
> The first issue was Lazarus throwing an error when processing the
> response. This was chased down to  chunking. Having disabled the
> chunking on the web-service no error is thrown. The trouble is now there
> are no results either!
>
> I have generated the Lazarus code using the Web Service Toolkit and
> importing the WDSL (attached).
>
> My code that makes use of the generated classes is:
>
>
> program webservice;
>
> {$mode objfpc}{$H+}
>
> uses
>  {$IFDEF UNIX}{$IFDEF UseCThreads}
>  cthreads,
>  {$ENDIF}{$ENDIF}
>  Classes,
>  { you can add units after this }
>  hello, hello_proxy, soap_formatter, logger_extension,
>  fpc_http_protocol;
>
> {$R *.res}
> var
>  service : HelloWorldPortType;
>  serviceText : hello_Type ;
>  responce : helloResponse ;
> begin
>  FPC_RegisterHTTP_Transport();
>  Register_hello_ServiceMetadata();
>  WriteLn('Web Services Toolkit');
>  WriteLn();
>  service := wst_CreateInstance_HelloWorldPortType();
>  serviceText:= hello_Type.create();
>  serviceText.arg0:='fred_test';
>
>  WriteLn( 'making service request' );
>  responce:=service.hello(serviceText);
>  if (responce=nil) then
>     WriteLn( 'have NO service responce' )
>  else
>      WriteLn( 'have service responce' );
> end.
>
>
> The web service is written in Java and has a single string parameter
> which is returned appended to the text "Hello ".
>
> Example retuned (taken using SOAPUI)
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>      <ns1:helloResponse xmlns:ns1="http://example.org/">
>         <ns1:return>Hello George</ns1:return>
>      </ns1:helloResponse>
>   </soap:Body>
> </soap:Envelope>
>
> With the chunking enabled I get an error referring to an unexpected
> character before the '<' which suggests to me that the response is being
> processed. But when the chunking is removed I no longer get the error
> and the response is null.
>
> Any ideas ?
>
> I dont want to have to use C !
>
>
>




More information about the Lazarus mailing list