1 18 package org.apache.axis2.clientapi; 19 20 import org.apache.axis2.addressing.EndpointReference; 21 import org.apache.axis2.addressing.MessageInformationHeadersCollection; 22 import org.apache.axis2.addressing.miheaders.RelatesTo; 23 import org.apache.axis2.context.ConfigurationContext; 24 import org.apache.axis2.context.MessageContext; 25 import org.apache.axis2.context.ServiceContext; 26 import org.apache.axis2.description.OperationDescription; 27 import org.apache.axis2.description.TransportOutDescription; 28 import org.apache.axis2.engine.AxisConfiguration; 29 import org.apache.axis2.engine.AxisEngine; 30 import org.apache.axis2.engine.AxisFault; 31 import org.apache.wsdl.WSDLConstants; 32 33 import javax.xml.namespace.QName ; 34 35 public class InOnlyMEPClient extends MEPClient { 36 protected MessageInformationHeadersCollection messageInformationHeaders; 37 protected TransportOutDescription senderTransport; 38 39 40 public InOnlyMEPClient(ServiceContext service) { 41 super(service,WSDLConstants.MEP_URI_IN_ONLY); 42 messageInformationHeaders = new MessageInformationHeadersCollection(); 43 } 44 45 public void send(OperationDescription axisop, final MessageContext msgctx) throws AxisFault { 46 verifyInvocation(axisop,msgctx); 47 msgctx.setSoapAction(soapAction); 48 msgctx.setMessageInformationHeaders(messageInformationHeaders); 49 msgctx.setServiceContext(serviceContext); 50 ConfigurationContext syscontext = serviceContext.getEngineContext(); 51 52 if(senderTransport == null ){ 53 senderTransport = inferTransport(messageInformationHeaders.getTo()); 54 } 55 56 msgctx.setTransportOut(senderTransport); 57 58 ConfigurationContext sysContext = serviceContext.getEngineContext(); 59 AxisConfiguration registry = sysContext.getAxisConfiguration(); 60 61 AxisEngine engine = new AxisEngine(sysContext); 62 msgctx.setOperationContext(axisop.findOperationContext(msgctx,serviceContext)); 63 64 engine.send(msgctx); 65 } 66 67 70 public void setWsaAction(String action) { 71 messageInformationHeaders.setAction(action); 72 } 73 74 77 public void setFaultTo(EndpointReference faultTo) { 78 messageInformationHeaders.setFaultTo(faultTo); 79 } 80 81 84 public void setFrom(EndpointReference from) { 85 messageInformationHeaders.setFrom(from); 86 } 87 88 91 public void setMessageId(String messageId) { 92 messageInformationHeaders.setMessageId(messageId); 93 } 94 95 98 public void setRelatesTo(RelatesTo relatesTo) { 99 messageInformationHeaders.setRelatesTo(relatesTo); 100 } 101 102 105 public void setReplyTo(EndpointReference replyTo) { 106 messageInformationHeaders.setReplyTo(replyTo); 107 } 108 109 112 public void setTo(EndpointReference to) { 113 messageInformationHeaders.setTo(to); 114 } 115 116 public void engageModule(QName name) throws AxisFault{ 117 serviceContext.getEngineContext().getAxisConfiguration().engageModule(name); 118 } 119 120 public void setSenderTransport(String senderTransport) throws AxisFault{ 121 this.senderTransport = serviceContext.getEngineContext().getAxisConfiguration().getTransportOut(new QName (senderTransport)); 122 } 123 } 124 | Popular Tags |