KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > engine > util > MyInOutMEPClient


1 package org.apache.axis2.engine.util;
2
3 import org.apache.axis2.clientapi.Call;
4 import org.apache.axis2.context.MessageContext;
5 import org.apache.axis2.description.OperationDescription;
6 import org.apache.axis2.engine.AxisFault;
7 import org.apache.axis2.om.OMElement;
8 import org.apache.axis2.soap.SOAPEnvelope;
9
10 import javax.xml.namespace.QName JavaDoc;
11
12 /*
13  * Copyright 2004,2005 The Apache Software Foundation.
14  *
15  * Licensed under the Apache License, Version 2.0 (the "License");
16  * you may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at
18  *
19  * http://www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  *
27  * author : Eran Chinthaka (chinthaka@apache.org)
28  */

29
30 public class MyInOutMEPClient extends Call{
31
32     public MyInOutMEPClient() throws AxisFault {
33         super(assumeServiceContext(null));
34     }
35
36     public SOAPEnvelope invokeBlockingWithEnvelopeOut(String JavaDoc axisop, OMElement toSend) throws AxisFault {
37         OperationDescription axisConfig =
38             serviceContext.getServiceConfig().getOperation(new QName JavaDoc(axisop));
39          if (axisConfig == null) {
40             axisConfig = new OperationDescription(new QName JavaDoc(axisop));
41             axisConfig.setRemainingPhasesInFlow(operationTemplate.getRemainingPhasesInFlow());
42             axisConfig.setPhasesOutFlow(operationTemplate.getPhasesOutFlow());
43             axisConfig.setPhasesInFaultFlow(operationTemplate.getPhasesInFaultFlow());
44             axisConfig.setPhasesOutFaultFlow(operationTemplate.getPhasesOutFaultFlow());
45             serviceContext.getServiceConfig().addOperation(axisConfig);
46         }
47
48 // if (axisConfig == null) {
49
// axisConfig = new OperationDescription(new QName(axisop));
50
// serviceContext.getServiceConfig().addOperation(axisConfig);
51
// }
52
MessageContext msgctx = prepareTheSystem(toSend);
53
54         MessageContext responseContext = super.invokeBlocking(axisConfig, msgctx);
55         SOAPEnvelope envelope = responseContext.getEnvelope();
56         return envelope;
57     }
58 }
59
Popular Tags