| 1 |
/** |
| 2 |
* StubHeaderImpl.java |
| 3 |
* |
| 4 |
* Test implimentation. |
| 5 |
* Make sure the service sees a SOAP header added by the Sub API. |
| 6 |
* Set a different header in the response to the test can verify it. |
| 7 |
*/ |
| 8 |
|
| 9 |
package test.wsdl.stubheaders; |
| 10 |
|
| 11 |
import org.apache.axis.MessageContext; |
| 12 |
import org.apache.axis.message.SOAPEnvelope; |
| 13 |
import org.apache.axis.message.SOAPHeaderElement; |
| 14 |
|
| 15 |
public class StubHeaderImpl implements test.wsdl.stubheaders.StubHeaderInterface { |
| 16 |
|
| 17 |
public java.lang.String echo(java.lang.String in) throws java.rmi.RemoteException { |
| 18 |
String ret = null; |
| 19 |
MessageContext mc = MessageContext.getCurrentContext(); |
| 20 |
|
| 21 |
// Verify the existence of in the input header |
| 22 |
SOAPEnvelope env = mc.getRequestMessage().getSOAPEnvelope(); |
| 23 |
SOAPHeaderElement header = env.getHeaderByName("http://test.org/inputheader", "headerin"); |
| 24 |
if (header != null) |
| 25 |
{ |
| 26 |
ret = header.getObjectValue().toString(); |
| 27 |
} |
| 28 |
|
| 29 |
// add a different output header to the response |
| 30 |
env = mc.getResponseMessage().getSOAPEnvelope(); |
| 31 |
SOAPHeaderElement hdr = |
| 32 |
new SOAPHeaderElement("http://test.org/outputheader", "headerout", "outputvalue"); |
| 33 |
env.addHeader(hdr); |
| 34 |
|
| 35 |
// just return the input header, so test can validate it |
| 36 |
return ret; |
| 37 |
} |
| 38 |
|
| 39 |
} |