ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: ws-site/targets/axis faq.html
Date Tue, 25 Mar 2003 15:10:05 GMT
tomj        2003/03/25 07:10:05

  Modified:    targets/axis faq.html
  Log:
  Add two new FAQs:
  - How do you set a timeout using stubs?
  - How do you add a header using stubs?
  
  Revision  Changes    Path
  1.4       +51 -2     ws-site/targets/axis/faq.html
  
  Index: faq.html
  ===================================================================
  RCS file: /home/cvs/ws-site/targets/axis/faq.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- faq.html	6 Feb 2003 13:29:16 -0000	1.3
  +++ faq.html	25 Mar 2003 15:10:05 -0000	1.4
  @@ -64,6 +64,13 @@
   
   <li>
   <a href="#faq16">How do I associate a namespace mapping with my service?</a></li>
  +
  +<li>
  +<a href="#faq17">How do I set a timeout when using WSDL2Java stubs?</a></li>
  +
  +<li>
  +<a href="#faq18">How do I set a header when using WSDL2Java stubs?</a></li>
  +
   </ul>
   
   <hr><a NAME="faq1"></a><i>What is Axis? What is its relationship
to Apache
  @@ -196,8 +203,50 @@
   <br>&nbsp; &lt;namespace>http://my.com/MyServiceNamespace&lt;/namespace>
   <br>&nbsp; ...
   <br>&lt;/service>
  -<br>&nbsp;
  -<br>&nbsp;</blockquote>
  +<br>&nbsp;&nbsp;</blockquote>
  +<a name="faq17"></a><i>How do I set a timeout when using WSDL2Java stubs?</i>
  +<blockquote>
  +<p>There is a <em>setTimeout</em> method on the <tt>org.apache.axis.client.Stub</tt>
class, which
  +is the class all emitted stubs extend.
  +<p>Here is how to set the timeout given a service named Foo:
  +<pre>
  + FooServiceLocator loc = new FooServiceLocator();
  + FooService binding = loc.getFooService();
  + org.apache.axis.client.Stub s = (Stub) binding;
  + s.setTimeout(1000);  // 1 second, in miliseconds
  + </pre>
  +<p>The default timeout in Axis 1.1 and later is 60 seconds. Axis 1.0
  +did not have a default timeout (i.e. it defaulted to 0). 
  +This timeout value is set on the HTTP socket and is not a connection timeout,
  +which requires implementation we do not have as of Axis 1.1.
  +</p>
  +</blockquote>
  +
  +<a name="faq18"></a><i>How do I set a header when using WSDL2Java stubs?</i>
  +<blockquote>
  +<p>There are two styles of headers, explicit and implicit.  Explicit headers are
  +defined in the WSDL of the service.  The WSDL2Java generation tool will recognize
  +these headers in most cases and emit stub class methods that include the headers
  +as arguments to the methods.
  +<p>In other cases, you may want to set headers that are not explicitly called
  +  out in the WSDL. For instance, you want to do some custom processing in a handler
  +  or add security.
  +In this case you can add headers to request before you invoke the stub method.
  +<p>There are are two <em>setHeader</em> APIs on the <tt>org.apache.axis.client.Stub</tt>
class.
  +The first takes the namespace, name and value of the header.
  + <pre>setHeader(String namespace, String partName, Object headerValue)</pre>
  +The second takes a SoapHeaderElement: 
  +<pre>setHeader(SOAPHeaderElement header)</pre>
  +<p>Here is an example of using the first API</p>
  +<pre>
  + FooServiceLocator loc = new FooServiceLocator();
  + FooService binding = loc.getFooService();
  + org.apache.axis.client.Stub s = (Stub) binding;
  + s.setHeader("http://my.name.space/headers", "mysecurityheader", "This guy is OK");
  + result = binding.myOperation(...);
  +</pre>
  +
  +</blockquote>
   
   </body>
   </html>
  
  
  

Mime
View raw message