Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
22575 amit.gupta 1
package com.aramex.impl;
2
 
3
import java.io.IOException;
4
import java.util.Set;
5
 
6
import javax.xml.namespace.QName;
7
import javax.xml.soap.SOAPException;
8
import javax.xml.soap.SOAPMessage;
9
import javax.xml.ws.handler.MessageContext;
10
import javax.xml.ws.handler.soap.SOAPHandler;
11
import javax.xml.ws.handler.soap.SOAPMessageContext;
12
 
13
@SuppressWarnings("restriction")
14
public class MyServiceLogHandler implements SOAPHandler<SOAPMessageContext> {
15
 
16
	public Set<QName> getHeaders() {
17
		// TODO Auto-generated method stub
18
		return null;
19
	}
20
 
21
	public void close(MessageContext arg0) {
22
		// TODO Auto-generated method stub
23
 
24
	}
25
 
26
	public boolean handleFault(SOAPMessageContext arg0) {
27
		SOAPMessage message= arg0.getMessage();
28
		try {
29
			message.writeTo(System.out);
30
		} catch (SOAPException e) {
31
			// TODO Auto-generated catch block
32
			e.printStackTrace();
33
		} catch (IOException e) {
34
			// TODO Auto-generated catch block
35
			e.printStackTrace();
36
		}
37
		return false;
38
	}
39
 
40
	public boolean handleMessage(SOAPMessageContext arg0) {
41
		SOAPMessage message= arg0.getMessage();
42
		boolean isOutboundMessage=  (Boolean)arg0.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);
43
		if(isOutboundMessage){
44
			System.out.println("OUTBOUND MESSAGE\n");
45
 
46
		}else{
47
			System.out.println("INBOUND MESSAGE\n");
48
		}
49
		try {
50
			message.writeTo(System.out);
51
		} catch (SOAPException e) {
52
			e.printStackTrace();
53
		} catch (IOException e) {
54
			e.printStackTrace();
55
		}
56
		return false;
57
	}
58
}