[Lazarus] Web-services
Ian Godman
ian at gravytrain.co.uk
Mon Aug 6 16:51:12 CEST 2012
Tried that get the following:
On 06/08/12 11:21, michael.vancanneyt at wisa.be wrote:
>
> 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 !
>>
>>
>>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120806/b5f0a3cf/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bbefdeha.png
Type: image/png
Size: 29208 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120806/b5f0a3cf/attachment-0003.png>
More information about the Lazarus
mailing list