package com.test;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.deployment.DeploymentException;

public class TestClient {
	public static void main(String args[])  {
		String s = "C:\\test";
		System.out.println(s);
		try {
			//ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(args[1], args[1] + "/conf/axis2.xml");
			ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(s, s + "/conf/axis2.xml");
		}catch(DeploymentException e) {
			//System.out.println(e.getFaultDetailElement().getLineNumber());
			System.out.println("__________________1");
			e.printStackTrace();
			System.out.println("__________________1");
			System.exit(0);
		}catch(AxisFault fe) {
			//System.out.println(fe.getFaultDetailElement().getLineNumber());
			System.out.println("__________________2");
			fe.printStackTrace();
			System.out.println("__________________2");
			System.exit(0);
		}
		com.test.PWCallback d = new com.test.PWCallback();
		System.out.print("dd" + d);
		//CardholderServicePortStub stub = new CardholderServicePortStub("http://localhost:7001/cardholderservice/cardholderservice.asmx");
		//CardholderServicePortStub stub = new CardholderServicePortStub(context,"http://localhost:7001/cardholderservice/cardholderservice.asmx");		
		//ServiceClient client = stub._getServiceClient();
		//Options opts = client.getOptions();
		//opts.setAction("urn:myaction");
		//opts.setProperty(arg0, arg1)
		//client.setOptions(opts);
		//stub._getServiceClient().getOptions().setAction("helloWorld");
		//client.sendReceive(getHelloOMElement());
		//stub.helloWorld(getHelloOMElement());
	}
	
	private static OMElement getHelloOMElement() {
		OMFactory factory = OMAbstractFactory.getOMFactory();
		OMNamespace ns = factory.createOMNamespace("http://services.bennycentral.com/my/v1/messages","");

		OMElement documentElement = factory.createOMElement("helloWorldRequest", ns);
		OMElement secondEle =  factory.createOMElement("OptionalMessage",null);
		secondEle.setText("test");
		documentElement.addChild(secondEle);
		return documentElement;
	}
	
	private static OMElement getHeaderOMElement() {
		OMFactory factory = OMAbstractFactory.getOMFactory();
		
		return null;
	}
	
	public void setWsaAction(String string) {
		System.out.println("_________");
	}
}
