Created
February 13, 2012 10:41
-
-
Save mavnn/1815919 to your computer and use it in GitHub Desktop.
F# WSDL regeneration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added a point-free moment just because...