Skip to content

Instantly share code, notes, and snippets.

@mavnn
Created February 13, 2012 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mavnn/1815919 to your computer and use it in GitHub Desktop.
Save mavnn/1815919 to your computer and use it in GitHub Desktop.
F# WSDL regeneration
open System.IO
open System.Text.RegularExpressions
open System.Diagnostics
let (|Match|_|) pattern input =
let m = Regex.Match(input, pattern)
if m.Success then Some (List.tail [for g in m.Groups -> g.Value]) else None
let abcDeploy = @"\\cvsw90163\c$\Apps\ABC2\apache-tomcat-6.0.33\webapps\ABC"
let svc = @"c:\Program Files\Microsoft SDKs\Windows\v7.0a\bin\SvcUtil.exe"
let getFilesInDir dirName =
Directory.EnumerateFiles(dirName, "deploy_*.wsdd")
let filterServiceName line =
match line with
| Match "<service.+name=\"(\\w+)\"" result -> Some(result.Head)
| _ -> None
let getServiceName = File.ReadAllLines >> Seq.pick filterServiceName
let runSvc serviceName =
let p = Process.Start (svc, sprintf "/out:%s /noconfig /namespace:\"*,CCC.CRM.Integration.Academy.Contracts.%s\" /serializer:XmlSerializer http://cvsw90163:9090/ABC/services/%s?wsdl" serviceName serviceName serviceName)
p.WaitForExit ()
if p.ExitCode <> 0 then
printfn "%s failed!" serviceName
getFilesInDir abcDeploy
|> Seq.map getServiceName
|> Seq.map runSvc
|> Seq.length
|> ignore
System.Console.Read () |> ignore
@mavnn
Copy link
Author

mavnn commented Feb 13, 2012

Added a point-free moment just because...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment