package SoaGW;
import org.apache.axis2.description.TransportOutDescription;
import com.risaris.axis2.entirex.transports.ExxTransportReceiver;
import com.risaris.axis2.entirex.transports.ExxTransportSender;
import SoaGW.AdabasEmployeesServiceStub.AdabasEmployeeKeyType;
import SoaGW.AdabasEmployeesServiceStub.AdabasEmployeeListReceiveElement;
import SoaGW.AdabasEmployeesServiceStub.AdabasEmployeeListSendElement;
import SoaGW.AdabasEmployeesServiceStub.AdabasEmployeeType;
import SoaGW.AdabasEmployeesServiceStub.AdabasEmployeesElement;
public class SOAPEntireXTut {
public static void main(String[] args) throws Exception, Fault {
AdabasEmployeesServiceStub stub = new AdabasEmployeesServiceStub();
TransportOutDescription txOut = new TransportOutDescription("http");
ExxTransportSender sender = new ExxTransportSender();
txOut.setSender(sender);
stub._getServiceClient().getOptions().setTransportOut(txOut);
AdabasEmployeeKeyType key = new AdabasEmployeeKeyType();
key.setPersonnel_id("11100107");
key.setName("");
key.setCity("");
AdabasEmployeeListSendElement lkey = new AdabasEmployeeListSendElement();
lkey.setAdabasEmployeeListSendElement( key );
stub.list_send( lkey , null, null);
Object convState1 = sender.getConvState();
key.setPersonnel_id("11100108");
key.setName("");
key.setCity("");
lkey.setAdabasEmployeeListSendElement( key );
stub.list_send( lkey , null, null);
Object convState2 = sender.getConvState();
key.setPersonnel_id("11100109");
key.setName("");
key.setCity("");
lkey.setAdabasEmployeeListSendElement( key );
stub.list_send( lkey , null, null);
Object convState3 = sender.getConvState();
AdabasEmployeeListReceiveElement input = new AdabasEmployeeListReceiveElement();
TransportOutDescription txOutR = new TransportOutDescription("http");
ExxTransportReceiver receiver = new ExxTransportReceiver();
receiver.setService( sender.getService() ); // This sets up the receiver to use the same logon and service as the sender
txOutR.setSender( receiver );
stub._getServiceClient().getOptions().setTransportOut(txOutR);
//
// Set the conversation state which we retrieved from the sender. We wish
// to get the response from our 2nd request i.e. 11100108 so use
// convState2.
//
receiver.setConvState(convState2);
AdabasEmployeesElement results = stub.list_receive(input, null, null);
AdabasEmployeeType [] res = results.getAdabasEmployeesElement().getAdabasEmployees().getAdabasEmployee();
for (AdabasEmployeeType emp : res)
{
System.out.println( "Employee: " + emp.getPersonnel_id() + " " + emp.getFirst_name() + " " + emp.getCity() );
}
//
// Set the conversation state which we retrieved from the sender. We wish
// to get the response from our 3rd request i.e. 11100109 so use
// convState3.
//
receiver.setConvState(convState3);
results = stub.list_receive(input, null, null);
res = results.getAdabasEmployeesElement().getAdabasEmployees().getAdabasEmployee();
for (AdabasEmployeeType emp : res)
{
System.out.println( "Employee: " + emp.getPersonnel_id() + " " + emp.getFirst_name() + " " + emp.getCity() );
}
//
// Set the conversation state which we retrieved from the sender. We wish
// to get the response from our 1st request i.e. 11100107 so use
// convState1.
//
receiver.setConvState(convState1);
results = stub.list_receive(input, null, null);
res = results.getAdabasEmployeesElement().getAdabasEmployees().getAdabasEmployee();
for (AdabasEmployeeType emp : res)
{
System.out.println( "Employee: " + emp.getPersonnel_id() + " " + emp.getFirst_name() + " " + emp.getCity() );
}
sender.logoff();
}
}