title: how to add a http header to a soaprequest in java
body: <p>I try to connect to a Yahoo webservice. I generated the classes by axis2. The problem I am facing right now is, that the webservice requires a specific key value pair in the header and I am absolutely not able, to do so. I searched the web and found different possibilities - none of them worked for me. The most promissing was the post nearly at the end of <a href="http://www.coderanch.com/t/489196/Web-Services/java/Axis-Http-Header">this page</a>, were Claude Coulombe sugested to change the code of the generated stub, but this failed as well. Can anybody show me a way how to solve this issue?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>The suggested way using Options produced the following exception:</p>
  
  <pre><code>Exception in thread "main" org.apache.axis2.AxisFault: Address information does not exist in the Endpoint Reference (EPR).The system cannot infer the transport mechanism.
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>val stub = new IndexToolsApiServiceStub("https://api.web.analytics.yahoo.com/IndexTools/services/IndexToolsApiV3")
  
  val client = stub._getServiceClient
  val options = new Options
  val list = new ArrayList[Header]()
  val header = new Header
  header.setName("YWA_API_TOKEN")
  header.setValue("NOTtheREALvalue")
  list.add(header)
  options.setProperty(HTTPConstants.HTTP_HEADERS, list)
  client.setOptions(options)
  stub._setServiceClient(client)
  </code></pre>