Method Name


GenerateBook


Summary


Web method that generates random text in the form of a book.


See Resources for examples of applications that access this web method.


Parameters


bookTitle

       Type: String

       Specified the type of document to generate.

       Valid Values:

        Text that specifies title of the generated book.


numChapters

       Type: Integer

       Specifies the number of random chapters to generate.

       Valid Values:

        Integer greater than zero (0).


chapterHeadings

       Type: String

       Specifies headings for each chapter. Place each chapter heading on a separate line. If there are fewer chapter headings than numChapters value then default chapter headings will be generated for chapters greater than numChapters.

       Valid Values:

        Text that specifies title of the generated chapter.


minNumParagraphsPerChapter

       Type: Integer

       Minimum number of paragraphs to generate for each chapter.

       Valid Values:

        Integer greater than zero (0).


maxNumParagraphsPerChapter

       Type: Integer

       Minimum number of paragraphs to generate for each chapter.

       Valid Values:

        Integer greater than or equal to minNumParagraphsPerChapter.


minNumSentencesPerParagraph

       Type: Integer

       Minimum number of sentences to generate for each paragraph.

       Valid Values:

        Integer greater than zero (0).


maxNumSentencesPerParagraph

       Type: Integer

       Maximum number of sentences to generate for each paragraph.

       Valid Values:

        Integer greater than or equal to minNumSentencesPerParagraph.

       

insertBlankLineBetweenParagraphs

       Type: Boolean

       If true, a blank line will be inserted after each paragraph. If false, generated paragraphs are not separated by a blank line. Blank line improves readability of output..

       Valid Values:

        True or False.


insertNewPageBetweenChapters

       Type: Boolean

       If true, form feed character will be inserted at end of each chapter except for the last chapter.

       Valid Values:

        True or False.


Return Value


Type: String

String containing random text formatted as a book.


Example


URL


http://pfrandomtextwebservice.azurewebsites.net/TextGenerator.asmx/GenerateBook?bookTitle=Random%20Book%20Title&numChapters=5&chapterHeadings=First%20Chapter%0ASecond%20Chapter%20Is%20This%0AThird%20Chapter&minNumParagraphsPerChapter=4&maxNumParagraphsPerChapter=6&minNumSentencesPerParagraph=3&maxNumSentencesPerParagraph=5&insertBlankLineBetweenParagraphs=true&insertNewPageBetweenChapters=false

       

CAUTION: &insertNewPageBetweenChapters will throw an exception if browser cannot handle the \x0A new page (form feed) character.


C#


       //Test endpoint address for ServiceReference1:

       //     http://pfrandomtextwebservice.azurewebsites.net/textgenerator.asmx


       TestWebServiceApp.ServiceReference1.TextGeneratorSoapClient serviceClient = new  ServiceReference1.TextGeneratorSoapClient();


public string GenerateDocument(int minNumParagraphs, int maxNumParagraphs,

                                                int minNumSentencesPerParagraph, int maxNumSentencesPerParagraph,

                                                string documentType, string documentSubject,

                                               bool specifyDateFromTo, bool insertBlankLineBetweenParagraphs)

{

string result = string.Empty;


result = txtProc.GenerateDocument(minNumParagraphs, maxNumParagraphs,

                                                    minNumSentencesPerParagraph, maxNumSentencesPerParagraph,

                                                    documentType, documentSubject,

                                                    specifyDateFromTo, insertBlankLineBetweenParagraphs);

return result;

}