/**
* EcardSystemStub.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.4.1 Built on : Aug 19, 2008 (10:13:39 LKT)
*/
package com.chenxi.ecardsystem_client;
/*
* EcardSystemStub java implementation
*/
public class EcardSystemStub extends org.apache.axis2.client.Stub
{
protected org.apache.axis2.description.AxisOperation[] _operations;
//hashmaps to keep the fault mapping
private java.util.HashMap faultExceptionNameMap = new java.util.HashMap();
private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
private java.util.HashMap faultMessageMap = new java.util.HashMap();
private static int counter = 0;
private static synchronized String getUniqueSuffix(){
// reset the counter if it is greater than 99999
if (counter > 99999){
counter = 0;
}
counter = counter + 1;
return Long.toString(System.currentTimeMillis()) + "_" + counter;
}
private void populateAxisService() throws org.apache.axis2.AxisFault {
//creating the Service with a unique name
_service = new org.apache.axis2.description.AxisService("EcardSystem" + getUniqueSuffix());
addAnonymousOperations();
//creating the operations
org.apache.axis2.description.AxisOperation __operation;
_operations = new org.apache.axis2.description.AxisOperation[3];
__operation = new org.apache.axis2.description.OutInAxisOperation();
__operation.setName(new javax.xml.namespace.QName("http://ecardsystem_server.chenxi.com", "login"));
_service.addOperation(__operation);
_operations[0]=__operation;
__operation = new org.apache.axis2.description.OutInAxisOperation();
__operation.setName(new javax.xml.namespace.QName("http://ecardsystem_server.chenxi.com", "checkAccount"));
_service.addOperation(__operation);
_operations[1]=__operation;
__operation = new org.apache.axis2.description.OutInAxisOperation();
__operation.setName(new javax.xml.namespace.QName("http://ecardsystem_server.chenxi.com", "charge"));
_service.addOperation(__operation);
_operations[2]=__operation;
}
//populates the faults
private void populateFaults(){
}
/**
*Constructor that takes in a configContext
*/
public EcardSystemStub(org.apache.axis2.context.ConfigurationContext configurationContext,
java.lang.String targetEndpoint)
throws org.apache.axis2.AxisFault {
this(configurationContext,targetEndpoint,false);
}
/**
* Constructor that takes in a configContext and useseperate listner
*/
public EcardSystemStub(org.apache.axis2.context.ConfigurationContext configurationContext,
java.lang.String targetEndpoint, boolean useSeparateListener)
throws org.apache.axis2.AxisFault {
//To populate AxisService
populateAxisService();
populateFaults();
_serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);
configurationContext = _serviceClient.getServiceContext().getConfigurationContext();
_serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(
targetEndpoint));
_serviceClient.getOptions().setUseSeparateListener(useSeparateListener);
//Set the soap version
_serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
}
/**
* Default Constructor
*/
public EcardSystemStub(org.apache.axis2.context.ConfigurationContext configurationContext) throws org.apache.axis2.AxisFault {
this(configurationContext,"http://localhost:8080/axis2/services/EcardSystem.EcardSystemHttpSoap12Endpoint/" );
}
/**
* Default Constructor
*/
public EcardSystemStub() throws org.apache.axis2.AxisFault {
this("http://localhost:8080/axis2/services/EcardSystem.EcardSystemHttpSoap12Endpoint/" );
}
/**
* Constructor taking the target endpoint
*/
public EcardSystemStub(java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
this(null,targetEndpoint);
}
/**
* Auto generated method signature
*
* @see com.chenxi.ecardsystem_client.EcardSystem#login
* @param login0
*/
public com.chenxi.ecardsystem_client.EcardSystemStub.LoginResponse login(
com.chenxi.ecardsystem_client.EcardSystemStub.Login login0)
throws java.rmi.RemoteException
{
org.apache.axis2.context.MessageContext _messageContext = null;
try{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
_operationClient.getOptions().setAction("urn:login");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");
// create a message context
_messageContext = new org.apache.axis2.context.MessageContext();
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null;
env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
login0,
optimizeContent(new javax.xml.namespace.QName("http://ecardsystem_server.chenxi.com",
"login")));
//adding SOAP soap_headers
_serviceClient.addHeadersToEnvelope(env);
// set the message context with that soap envelope
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
//execute the operation client
_operationClient.execute(true);
org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
java.lang.Object object = fromOM(
_returnEnv.getBody().getFirstElement() ,
com.chenxi.ecardsystem_client.EcardSystemStub.LoginResponse.class,