File: StubHeaderImpl.java

package info (click to toggle)
axis 1.4-29
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 52,100 kB
  • sloc: java: 129,124; xml: 10,602; jsp: 983; sh: 84; cs: 36; makefile: 18
file content (39 lines) | stat: -rw-r--r-- 1,319 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
 * StubHeaderImpl.java
 *
 * Test implimentation.
 * Make sure the service sees a SOAP header added by the Sub API.
 * Set a different header in the response to the test can verify it.
 */

package test.wsdl.stubheaders;

import org.apache.axis.MessageContext;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPHeaderElement;

public class StubHeaderImpl implements test.wsdl.stubheaders.StubHeaderInterface {

    public java.lang.String echo(java.lang.String in) throws java.rmi.RemoteException {
        String ret = null;
        MessageContext mc = MessageContext.getCurrentContext();

        // Verify the existence of in the input header
        SOAPEnvelope env = mc.getRequestMessage().getSOAPEnvelope();
        SOAPHeaderElement header = env.getHeaderByName("http://test.org/inputheader", "headerin");
        if (header != null)
        {
            ret = header.getObjectValue().toString();
        }

        // add a different output header to the response
        env = mc.getResponseMessage().getSOAPEnvelope();
        SOAPHeaderElement hdr =
                new SOAPHeaderElement("http://test.org/outputheader", "headerout", "outputvalue");
        env.addHeader(hdr);

        // just return the input header, so test can validate it
        return ret;
    }

}