package org.jboss.soa.bpel.tests.samples.purchase;

import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;

/**
 * This class was generated by the JAX-WS RI. JAX-WS RI 2.1.6 Generated source
 * version: 2.1
 */
@WebServiceClient(name = PurchaseSVC.SERVICE_NAME, targetNamespace = PurchaseSVC.TARGET_NAMESPACE, wsdlLocation = PurchaseSVC.WSDL_LOCATION)
public class PurchaseSVC extends Service {

	static final String SERVICE_NAME = "purchaseSVC";
	static final String TARGET_NAMESPACE =
			"http://manufacturing.org/wsdl/purchase";
	static final String WSDL_LOCATION =
			"http://127.0.0.1:8080/Tutorial_bpel_purchase_purchaseOrder?wsdl";
	private static final String PURCHASE_ORDER_PORT_NAME = "purchaseOrderSP";

	private static final URL WSDL_URL = createURL(WSDL_LOCATION);

	private static URL createURL(String location) {
		try {
			return new URL(location);
		}
		catch (MalformedURLException e) {
			throw new IllegalArgumentException(location, e);
		}
	}

	public PurchaseSVC(URL wsdlLocation, QName serviceName) {
		super(wsdlLocation, serviceName);
	}

	public PurchaseSVC() {
		super(WSDL_URL, new QName(TARGET_NAMESPACE, SERVICE_NAME));
	}

	/**
	 * @return returns PurchaseOrderPT
	 */
	@WebEndpoint(name = PURCHASE_ORDER_PORT_NAME)
	public PurchaseOrderPT getPurchaseOrderSP() {
		return super.getPort(new QName(TARGET_NAMESPACE, PURCHASE_ORDER_PORT_NAME),
				PurchaseOrderPT.class);
	}

	/**
	 * @param features A list of {@link javax.xml.ws.WebServiceFeature} to
	 * configure on the proxy. Supported features not in the <code>features</code>
	 * parameter will have their default values.
	 * @return returns PurchaseOrderPT
	 */
	@WebEndpoint(name = PURCHASE_ORDER_PORT_NAME)
	public PurchaseOrderPT getPurchaseOrderSP(WebServiceFeature... features) {
		return super.getPort(new QName(TARGET_NAMESPACE, PURCHASE_ORDER_PORT_NAME),
				PurchaseOrderPT.class, features);
	}
}
