org.apache.tools.ant.taskdefs.optional.dotnet
Class WsdlToDotnet

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet
All Implemented Interfaces:
java.lang.Cloneable

public class WsdlToDotnet
extends Task

Converts a WSDL file or URL resource into a .NET language. Why add a wrapper to the MS WSDL tool? So that you can verify that your web services, be they written with Axis or anyone else's SOAP toolkit, work with .NET clients. This task is dependency aware when using a file as a source and destination; so if you <get> the file (with usetimestamp="true") then you only rebuild stuff when the WSDL file is changed. Of course, if the server generates a new timestamp every time you ask for the WSDL, this is not enough...use the <filesmatch> <condition> to to byte for byte comparison against a cached WSDL file then make the target conditional on that test failing. See "Creating an XML Web Service Proxy", "wsdl.exe" docs in the framework SDK documentation

Since:
Ant 1.5
Version:
0.5

Nested Class Summary
static class WsdlToDotnet.Compiler
          The enumerated values for our compiler
static class WsdlToDotnet.Schema
          nested schema class Only supported on NET until mono add multi-URL handling on the command line
 
Field Summary
static java.lang.String ERROR_DEST_FILE_IS_DIR
          error message: dest file is a directory
static java.lang.String ERROR_NO_DEST_FILE
          error message: no dest file
protected  java.lang.String extraOptions
          any extra command options?
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
WsdlToDotnet()
           
 
Method Summary
 void addSchema(WsdlToDotnet.Schema source)
          add a new source schema to the compilation
 void execute()
          do the work by building the command line and then calling it
 void setCompiler(WsdlToDotnet.Compiler compiler)
          identify the compiler
 void setDestFile(java.io.File destFile)
          Name of the file to generate.
 void setExtraOptions(java.lang.String extraOptions)
          Any extra WSDL.EXE options which aren't explicitly supported by the ant wrapper task; optional
 void setFailOnError(boolean failOnError)
          Whether or not a failure should halt the build.
 void setIdeErrors(boolean ideErrors)
          Defines wether errors are machine parseable.
 void setLanguage(java.lang.String language)
          set the language; one of "CS", "JS", or "VB" optional, default is CS for C# source
 void setMakeURL(boolean b)
          flag to trigger turning a filename into a file:url ignored for the mono compiler.
 void setNamespace(java.lang.String namespace)
          namespace to place the source in.
 void setProtocol(java.lang.String protocol)
          what protocol to use.
 void setServer(boolean server)
          flag to enable server side code generation; optional, default=false
 void setSrcFile(java.io.File srcFile)
          The local WSDL file to parse; either url or srcFile is required.
 void setUrl(java.lang.String url)
          Sets the URL to fetch.
protected  void validate()
          validation code
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extraOptions

protected java.lang.String extraOptions
any extra command options?


ERROR_DEST_FILE_IS_DIR

public static final java.lang.String ERROR_DEST_FILE_IS_DIR
error message: dest file is a directory

See Also:
Constant Field Values

ERROR_NO_DEST_FILE

public static final java.lang.String ERROR_NO_DEST_FILE
error message: no dest file

See Also:
Constant Field Values
Constructor Detail

WsdlToDotnet

public WsdlToDotnet()
Method Detail

setDestFile

public void setDestFile(java.io.File destFile)
Name of the file to generate. Required

Parameters:
destFile - filename

setUrl

public void setUrl(java.lang.String url)
Sets the URL to fetch. Fetching is by wsdl.exe; Ant proxy settings are ignored; either url or srcFile is required.

Parameters:
url - url to save

setSrcFile

public void setSrcFile(java.io.File srcFile)
The local WSDL file to parse; either url or srcFile is required.

Parameters:
srcFile - WSDL file

setLanguage

public void setLanguage(java.lang.String language)
set the language; one of "CS", "JS", or "VB" optional, default is CS for C# source

Parameters:
language - language to generate

setServer

public void setServer(boolean server)
flag to enable server side code generation; optional, default=false

Parameters:
server - server-side flag

setNamespace

public void setNamespace(java.lang.String namespace)
namespace to place the source in. optional; default ""

Parameters:
namespace - new namespace

setFailOnError

public void setFailOnError(boolean failOnError)
Whether or not a failure should halt the build. Optional - default is true.

Parameters:
failOnError - new failure option

setExtraOptions

public void setExtraOptions(java.lang.String extraOptions)
Any extra WSDL.EXE options which aren't explicitly supported by the ant wrapper task; optional

Parameters:
extraOptions - The new ExtraOptions value

setIdeErrors

public void setIdeErrors(boolean ideErrors)
Defines wether errors are machine parseable. Optional, default=true

Parameters:
ideErrors - a boolean value.
Since:
Ant 1.7

setProtocol

public void setProtocol(java.lang.String protocol)
what protocol to use. SOAP, SOAP1.2, HttpPost and HttpGet are the base options. Different version and implementations may. offer different options.

Parameters:
protocol - the protocol to use.
Since:
Ant 1.7

addSchema

public void addSchema(WsdlToDotnet.Schema source)
add a new source schema to the compilation

Parameters:
source - a nested schema element.
Since:
Ant 1.7

setMakeURL

public void setMakeURL(boolean b)
flag to trigger turning a filename into a file:url ignored for the mono compiler.

Parameters:
b - a boolean value.

setCompiler

public void setCompiler(WsdlToDotnet.Compiler compiler)
identify the compiler

Parameters:
compiler - the enumerated value.
Since:
Ant 1.7

validate

protected void validate()
                 throws BuildException
validation code

Throws:
BuildException - if validation failed

execute

public void execute()
             throws BuildException
do the work by building the command line and then calling it

Overrides:
execute in class Task
Throws:
BuildException - if validation or execution failed