Author: jonathan Date: Mon Jul 21 01:05:23 2008 New Revision: 19727 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=19727
Log: Documented additional stub features. Modified: trunk/mashup/java/xdocs/consumingservices.html Modified: trunk/mashup/java/xdocs/consumingservices.html URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/xdocs/consumingservices.html?rev=19727&r1=19726&r2=19727&view=diff ============================================================================== --- trunk/mashup/java/xdocs/consumingservices.html (original) +++ trunk/mashup/java/xdocs/consumingservices.html Mon Jul 21 01:05:23 2008 @@ -21,9 +21,10 @@ <link href="css/mashup-docs.css" rel="stylesheet" type="text/css" media="all"> </head> <body lang="EN-US" link="blue" vlink="purple"> + <div id="main-content"> -<h1>Consuming Services</h1> +<h1>Consuming Services</h1> <p>Table of Contents</p> @@ -34,9 +35,11 @@ <li><a href="#Operations">Operations as Methods</a></li> <li><a href="#Setting">Setting Endpoints and Endpoint Addresses</a></li> <li><a href="#Asynchrono">Asynchronous Invocation</a></li> + <li><a href="#Authentication">Authentication</a></li> <li><a href="#Using1">Using Stubs in Web Pages</a></li> <li><a href="#Using2">Using Stubs in Services</a></li> <li><a href="#Automatic">Automatic Type Conversions</a></li> + <li><a href="#Utility">Utility Functions</a></li> </ul> </li> </ul> @@ -44,7 +47,6 @@ <p></p> -<div class="Section1"> <h2 id="Using">Using Stubs</h2> <p>The Javascript returned by "?stub" defines a JavaScript object @@ -117,34 +119,38 @@ property and two methods which help you determine which binding will be used to invoke the service:</p> -<ul> - <li><p><strong>{service}.endpoint</strong> - this read/write property - names the endpoint that will be invoked. This corresponds to the WSDL 2.0 - endpoint name - and for services exposed by the mashup, it is generally one - of these values:</p> -<ul> - <li>"SOAP12Endpoint"</li> - - <li>"SOAP11Endpoint"</li> - - <li>"HTTPEndoint"</li> - - <li>"SecureSOAP12Endpoint"</li> - - <li>"SecureSOAP11Endpoint"</li> - - <li>"SecureHTTPEndpoint"</li> -</ul> -</li> -<li><p><strong>{service}.getAddress(endpoint)</strong> - - this method takes an endpoint name (typically one of the above) and returns - the endpoint address.</p> -</li> -<li><p><strong>{service}.setAddress(endpoint, - url)</strong> - this method sets the address for a particular named - endpoint.</p> -</li> -</ul> +<table style="margin-left: 0.5in; border-collapse: collapse;" class="MsoTableGrid" border="1" cellpadding="5" + cellspacing="0"> + <tbody> + <tr> + <td><b>{service}.endpoint</b></td> + <td>This read/write property + names the endpoint that will be invoked. This corresponds to the WSDL 2.0 + endpoint name - and for services exposed by the mashup, it is generally one + of these values: + + <ul> + <li>"SOAP12Endpoint"</li> + <li>"SOAP11Endpoint"</li> + <li>"HTTPEndoint"</li> + <li>"SecureSOAP12Endpoint"</li> + <li>"SecureSOAP11Endpoint"</li> + <li>"SecureHTTPEndpoint"</li> + </ul> + </td> + </tr> + <tr> + <td><b>{service}.getAddress(endpoint)</b></td> + <td>This method takes an endpoint name (typically one of the above) and returns + the endpoint address.</td> + </tr> + <tr> + <td><b>{service}.setAddress(endpoint, url)</b></td> + <td>This method sets the address for a particular named endpoint.</td> + </tr> + </tbody> +</table> + <p>Typically you will use the "endpoint" property to select an alternate binding if the default (SOAP 12) isn't appropriate for some reason. You might use the getAddress and setAddress properties to reroute @@ -207,6 +213,29 @@ <p class="MsoListParagraphCxSpLast"> </p> +<h3 id="Authentication">Authentication</h3> + +<p>A service requiring username/password authentication can be accessed by setting the + username and password anntations on the WebService object prior to calling an operation:</p> + +<table style="margin-left: 0.5in; border-collapse: collapse;" class="MsoTableGrid" border="1" cellpadding="5" + cellspacing="0"> + <tbody> + <tr> + <td><b>{service}.username</b></td> + <td>Sets the username for authenticated calls.</td> + </tr> + <tr> + <td><b>{service}.password</b></td> + <td>Sets the password for authenticated calls.</td> + </tr> + </tbody> +</table> + +<p class="Code">helloworld.username = "joey";<br>helloworld.password = "fahr451!";<br>var theResponse = helloworld.hello();</p> + +<p class="MsoListParagraphCxSpLast"> </p> + <h3 id="Using1">Using Stubs in Web Pages</h3> <p>In order to use the stub in a Web page, you must import @@ -274,303 +303,232 @@ cellpadding="5" cellspacing="0"> <tbody> <tr> - <td width="156"><p><b>XML - Schema type</b></p> - </td> - <td><b>JavaScript - type</b> - - <p></p> - </td> + <td width="156"><p><b>XML Schema type</b></p></td> + <td><b>JavaScript type</b></td> </tr> <tr> - <td>xs:anyType<p></p> - </td> - <td><p>E4X - XML object</p> - </td> + <td>xs:anyType</td> + <td><p>E4X XML object</p></td> </tr> <tr> - <td>xs:anyURI<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:anyURI</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:base64Binary<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:base64Binary</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:boolean<p></p> - </td> - <td><p>boolean</p> - </td> + <td>xs:boolean</td> + <td><p>boolean</p></td> </tr> <tr> - <td>xs:byte<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:byte</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:date<p></p> - </td> - <td><p>Date(yyyy, - mm, dd, 0:00:00, tz)</p> - </td> + <td>xs:date</td> + <td><p>Date(yyyy, mm, dd, 0:00:00, tz)</p></td> </tr> <tr> - <td>xs:dateTime<p></p> - </td> - <td><p>Date(yyyy, - mm, dd, hh:mm:ss, tz)</p> - </td> + <td>xs:dateTime</td> + <td><p>Date(yyyy, mm, dd, hh:mm:ss, tz)</p></td> </tr> <tr> - <td>xs:decimal<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:decimal</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:double<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:double</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:duration<p></p> - </td> - <td><p>Number - (in milliseconds)</p> - </td> + <td>xs:duration</td> + <td><p>Number (in milliseconds)</p></td> </tr> <tr> - <td>xs:ENTITIES<p></p> - </td> - <td><p>Array - of strings</p> - </td> + <td>xs:ENTITIES</td> + <td><p>Array of strings</p></td> </tr> <tr> - <td>xs:ENTITY<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:ENTITY</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:float<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:float</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:gDay<p></p> - </td> - <td><p>Date(1970, - 1, dd, 0:00:00, tz)</p> - </td> + <td>xs:gDay</td> + <td><p>Date(1970, 1, dd, 0:00:00, tz)</p></td> </tr> <tr> - <td>xs:gMonth<p></p> - </td> - <td><p>Date(1970, - mm, 1, 0:00:00, tz)</p> - </td> + <td>xs:gMonth</td> + <td><p>Date(1970, mm, 1, 0:00:00, tz)</p></td> </tr> <tr> - <td>xs:gMonthDay<p></p> - </td> - <td><p>Date(1970, - mm, dd, 0:00:00, tz)</p> - </td> + <td>xs:gMonthDay</td> + <td><p>Date(1970, mm, dd, 0:00:00, tz)</p></td> </tr> <tr> - <td>xs:gYear<p></p> - </td> - <td><p>Date(yyyy, - 1, 1, 0:00:00, tz)</p> + <td>xs:gYear</td> + <td><p>Date(yyyy, 1, 1, 0:00:00, tz)</p> </td> </tr> <tr> - <td>xs:gYearMonth<p></p> - </td> - <td><p>Date - (yyyy, mm, 1, 0:00:00, tz)</p> - </td> + <td>xs:gYearMonth</td> + <td><p>Date (yyyy, mm, 1, 0:00:00, tz)</p></td> </tr> <tr> - <td>xs:hexBinary<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:hexBinary</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:ID<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:ID</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:IDREF<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:IDREF</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:IDREFS<p></p> - </td> - <td><p>Array - of strings</p> - </td> + <td>xs:IDREFS</td> + <td><p>Array of strings</p></td> </tr> <tr> - <td>xs:int<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:int</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:integer<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:integer</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:language<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:language</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:long<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:long</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:Name<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:Name</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:NCName<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:NCName</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:negativeInteger<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:negativeInteger</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:NMTOKEN<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:NMTOKEN</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:NMTOKENS<p></p> - </td> - <td><p>Array - of strings</p> - </td> + <td>xs:NMTOKENS</td> + <td><p>Array of strings</p></td> </tr> <tr> - <td>xs:nonNegativeInteger<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:nonNegativeInteger</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:nonPositiveInteger<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:nonPositiveInteger</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:normalizedString<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:normalizedString</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:NOTATION<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:NOTATION</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:positiveInteger<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:positiveInteger</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:QName<p></p> - </td> - <td><p>E4X - QName object consisting of name, prefix, local-name, namespace-uri. - (Note that DOM stubs don't support QNames yet.)</p> - </td> + <td>xs:QName</td> + <td><p>E4X QName object consisting of name, prefix, local-name, namespace-uri. + (Note that DOM stubs don't support QNames yet.)</p></td> </tr> <tr> - <td>xs:short<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:short</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:string<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:string</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:time<p></p> - </td> - <td><p>Date(1970, - 1, 1 hh:mm:ss, tz)</p> - </td> + <td>xs:time</td> + <td><p>Date(1970, 1, 1 hh:mm:ss, tz)</p></td> </tr> <tr> - <td>xs:token<p></p> - </td> - <td><p>string</p> - </td> + <td>xs:token</td> + <td><p>string</p></td> </tr> <tr> - <td>xs:unsignedByte<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:unsignedByte</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:unsignedInt<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:unsignedInt</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:unsignedLong<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:unsignedLong</td> + <td><p>number</p></td> </tr> <tr> - <td>xs:unsignedShort<p></p> - </td> - <td><p>number</p> - </td> + <td>xs:unsignedShort</td> + <td><p>number</p></td> </tr> </tbody> </table> -</div> + +<h3 id="Utility">Utility Functions</h3> + +<p>The WebService object also exposes some utility functions that can be used to further manipulate data types:</p> + +<table style="margin-left: 0.5in; border-collapse: collapse;" class="MsoTableGrid" border="1" cellpadding="5" cellspacing="0"> + + <tbody> + <tr> + <td><b>String WebService.utils.toXSdate(date)</b></td> + <td>Convert a Javascript Date to an xs:date format string (discarding the time information.)</td> + </tr> + <tr> + <td><b>String WebService.utils.toXStime(date)</b></td> + <td>Convert a Javascript Date to an xs:time format string (discarding the date information.)</td> + </tr> + <tr> + <td><b>String WebService.utils.toXSdateTime(date)</b></td> + <td>Convert a Javascript Date to an xs:dateTime format string.</td> + </tr> + <tr> + <td><b>Date WebService.utils.parseXSdateTime(date)</b></td> + <td>Convert an xs:date, xs:time, or xs:dateTime format string into a Javascript date.</td> + </tr> + <tr> + <td><b>String WebService.utils.scheme(url)</b></td> + <td>Extract the scheme from a url.</td> + </tr> + <tr> + <td><b>String WebService.utils.domain(url)</b></td> + <td>Extract the domain from a url.</td> + </tr> + <tr> + <td><b>String WebService.utils.domainNoPort(url)</b></td> + <td>Extract the domain from a url, trimming off any port information.</td> + </tr> + </tbody> +</table> + </div> <p>© 2007-2008 WSO2 Inc.</p> </body> _______________________________________________ Mashup-dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev
