Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# SOAP client with reserved word in parameter

Tags:

soap

wcf

f#

I'm using the LanguageService (translation service) from Bing. I generated the F# soap client code with svcutil (and modified it a little to got it working) but got stuck with some methods that use the word to in their parameters. And it is reserved in F#.

 [<System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/Translate", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/TranslateResponse")>]
 abstract Translate :appId:string * text:string * from:string * to:string * contentType:string * category:string -> string

I already tried with _to and __to without luck.

I don't know if there is any way to undefine keywords or define the parameter another way (something like this: SOAPpy - reserved word in named parameter list ).

Thanks in advance!

like image 284
k4cho Avatar asked Jan 17 '23 17:01

k4cho


1 Answers

abstract Translate :appId:string * text:string * from:string * ``to``:string * contentType:string * category:string -> string

Double back-ticks allow you to put almost any string (including spaces and punctuation, and obviously reserved words).

like image 93
Ramon Snir Avatar answered Jan 25 '23 02:01

Ramon Snir