Commit 46ffeabe authored by Quxl's avatar Quxl

x

parent 2b3c1ba0
......@@ -19,12 +19,16 @@ import com.egolm.sso.config.XRException;
public class ServiceFactory {
public static <T> T create(Class<T> requiredType, String wsdlLocation, String namespace, String serviceName, String username, String password, String passwordType) {
public static <T> T create(Class<T> requiredType, String wsdlLocation, String namespace, String serviceName, String username, String password) {
return create(requiredType, wsdlLocation, namespace, serviceName, username, password, PasswordType.PasswordText);
}
public static <T> T create(Class<T> requiredType, String wsdlLocation, String namespace, String serviceName, String username, String password, PasswordType passwordType) {
try {
Map<String, Object> pro = new HashMap<String, Object>();
pro.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
pro.put(WSHandlerConstants.USER, username);
pro.put(WSHandlerConstants.PASSWORD_TYPE, passwordType);
pro.put(WSHandlerConstants.PASSWORD_TYPE, passwordType == null ? PasswordType.PasswordText.name() : passwordType.name());
pro.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
public void handle(Callback[] callbacks) {
for (int i = 0; i < callbacks.length; i++) {
......@@ -44,4 +48,7 @@ public class ServiceFactory {
}
}
public enum PasswordType {
PasswordText, PasswordNone, PasswordDigest
}
}
......@@ -7,7 +7,6 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.ws.security.WSConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.system.ApplicationHome;
......@@ -44,7 +43,7 @@ public class ZMISD009SOCREATIONTask {
File folder = jarFile.getParentFile();
String absolutePath = folder.getAbsolutePath();
String wsdlLocation = "file:///" + absolutePath + "/WSDL/Z_MI_SD_009_SO_CREATION.wsdl";
ZMISD009SOCREATIONService service = ServiceFactory.create(ZMISD009SOCREATIONService.class, wsdlLocation, "http://schneider-distributor.com/", "Z_MI_SD_009_SO_CREATIONService", username, password, WSConstants.PW_TEXT);
ZMISD009SOCREATIONService service = ServiceFactory.create(ZMISD009SOCREATIONService.class, wsdlLocation, "http://schneider-distributor.com/", "Z_MI_SD_009_SO_CREATIONService", username, password);
this.sendData(service.getZMISD009SOCREATIONPort());
}
......
......@@ -12,7 +12,7 @@ public class ConfirmQuotationTest {
String wsdlLocation = "http://localhost:8080/api/services/confirm_quotation?wsdl";
String namespace = "http://confirm_quotation.sso.egolm.com";
String serviceName = "ConfirmQuotationService";
ConfirmQuotationService service = ServiceFactory.create(ConfirmQuotationService.class, wsdlLocation, namespace, serviceName, "test", "", "PasswordText");
ConfirmQuotationService service = ServiceFactory.create(ConfirmQuotationService.class, wsdlLocation, namespace, serviceName, "test", "", null);
String XML = StringUtil.readText("D:/data/sso/008-1.XML");
Z_MT_SD_008_SO_CONFIRM_QUOTATION Z_MT_SD_008_SO_CONFIRM_QUOTATION = XMLUtil.toBeanByJxab(XML, Z_MT_SD_008_SO_CONFIRM_QUOTATION.class);
service.execute(Z_MT_SD_008_SO_CONFIRM_QUOTATION);
......
......@@ -12,7 +12,7 @@ public class DeletionServiceTest {
String wsdlLocation = "http://localhost:8080/api/services/dn_deletion?wsdl";
String namespace = "http://dn_deletion.sso.egolm.com";
String serviceName = "DNDeletionService";
DNDeletionService service = ServiceFactory.create(DNDeletionService.class, wsdlLocation, namespace, serviceName, "test", "", "PasswordText");
DNDeletionService service = ServiceFactory.create(DNDeletionService.class, wsdlLocation, namespace, serviceName, "test", "", null);
String XML = StringUtil.readText("D:/data/sso/010.XML");
DELETED_DOCUMENTS DELETED_DOCUMENTS = XMLUtil.toBeanByJxab(XML, DELETED_DOCUMENTS.class);
service.execute(DELETED_DOCUMENTS);
......
......@@ -12,7 +12,7 @@ public class MaterialMasterServiceTest {
String wsdlLocation = "http://10.204.15.9:8080/api/services/material_master?wsdl";
String namespace = "http://material_master.sso.egolm.com";
String serviceName = "MaterialMasterService";
MaterialMasterService service = ServiceFactory.create(MaterialMasterService.class, wsdlLocation, namespace, serviceName, "test", "", "PasswordText");
MaterialMasterService service = ServiceFactory.create(MaterialMasterService.class, wsdlLocation, namespace, serviceName, "test", "", null);
String XML = StringUtil.readText("D:/data/sso/001.XML");
Z_MT_SD_001_MATERIAL_MASTER Z_MT_SD_001_MATERIAL_MASTER = XMLUtil.toBeanByJxab(XML, Z_MT_SD_001_MATERIAL_MASTER.class);
service.execute(Z_MT_SD_001_MATERIAL_MASTER);
......
......@@ -12,7 +12,7 @@ public class PrformaInvoiceServiceTest {
String wsdlLocation = "http://localhost:8080/api/services/prforma_invoice?wsdl";
String namespace = "http://prforma_invoice.sso.egolm.com";
String serviceName = "PrformaInvoiceService";
PrformaInvoiceService service = ServiceFactory.create(PrformaInvoiceService.class, wsdlLocation, namespace, serviceName, "test", "", "PasswordText");
PrformaInvoiceService service = ServiceFactory.create(PrformaInvoiceService.class, wsdlLocation, namespace, serviceName, "test", "");
String XML = StringUtil.readText("D:/data/sso/005.XML");
Z_MT_SD_005_PERFORM_INVOICE Z_MT_SD_005_PERFORM_INVOICE = XMLUtil.toBeanByJxab(XML, Z_MT_SD_005_PERFORM_INVOICE.class);
service.execute(Z_MT_SD_005_PERFORM_INVOICE);
......
......@@ -12,7 +12,7 @@ public class PriceListServiceTest {
String wsdlLocation = "http://localhost:8080/api/services/price_list?wsdl";
String namespace = "http://price_list.sso.egolm.com";
String serviceName = "PriceListService";
PriceListService service = ServiceFactory.create(PriceListService.class, wsdlLocation, namespace, serviceName, "test", "", "PasswordText");
PriceListService service = ServiceFactory.create(PriceListService.class, wsdlLocation, namespace, serviceName, "test", "");
String XML = StringUtil.readText("D:/data/sso/002.XML");
Z_MT_SD_002_PRICE_LIST Z_MT_SD_002_PRICE_LIST = XMLUtil.toBeanByJxab(XML, Z_MT_SD_002_PRICE_LIST.class);
service.execute(Z_MT_SD_002_PRICE_LIST);
......
......@@ -12,7 +12,7 @@ public class ShippingNotificationTest {
String wsdlLocation = "http://localhost:8080/api/services/shipping_notification?wsdl";
String namespace = "http://shipping_notfirmation.sso.egolm.com";
String serviceName = "ShippingNotificationService";
ShippingNotificationService service = ServiceFactory.create(ShippingNotificationService.class, wsdlLocation, namespace, serviceName, "test", "", "PasswordText");
ShippingNotificationService service = ServiceFactory.create(ShippingNotificationService.class, wsdlLocation, namespace, serviceName, "test", "");
String XML = StringUtil.readText("D:/data/sso/007.XML");
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE = XMLUtil.toBeanByJxab(XML, Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.class);
service.execute(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment