📄 testclient.java
字号:
Vector vbe = new Vector();
vbe.add(be);
System.out.print("Saving Business .....");
// create a save business structure
SaveBusiness sb = new SaveBusiness();
// set all the arguments and attributes of the message
// follow the uddi.org specification for details.
sb.setAuthInfo(ai);
sb.setBusinessEntityVector(vbe);
BusinessDetail bdtls = p.saveBusiness(sb);
System.out.println("Done.");
be = (BusinessEntity)bdtls.getBusinessEntityVector().elementAt(0);
System.out.println("Info on business saved :");
System.out.println("Name = " + be.getName().getValue() + "\nKey = " + be.getBusinessKey());
// log out
System.out.print("Logging out ..... ");
testLogout(ai);
System.out.println("Done.");
}
catch(UDDIException ue)
{
System.out.println("");
System.out.println("**** UDDIEXception ***");
System.out.println("Fault Actor : " + ue.getFaultActor());
System.out.println("Fault Error : " + ue.getFaultCode());
DispositionReport dr = ue.getDispositionReport();
Vector res = dr.getResultVector();
Result r = (Result)res.elementAt(0);
ErrInfo ei = r.getErrInfo();
System.out.println("ErrInfo : "+ ei.getValue());
}
catch (XML_SoapException exp){
System.out.println("XML_SoapException");
System.out.println(exp.getMessage());
exp.printStackTrace();
}
catch(Exception e)
{
System.out.println("Exception");
e.printStackTrace();
}
}
private void testSaveBusinessUploadRegister()
{
try
{
// log in
System.out.print("Logging in ..... ");
AuthInfo ai = testLogin();
System.out.println("Done : "+ ai.getValue());
Vector vbe = new Vector();
vbe.add(new UploadRegister("http://www-3.ibm.com/services/uddi/uddiget?businessKey=A63F7B30-2B94-11D5-BFAF-AB3B31212312"));
System.out.print("Saving Business .....");
// create a save business structure
SaveBusiness sb = new SaveBusiness();
// set all the arguments and attributes of the message
// follow the uddi.org specification for details.
sb.setAuthInfo(ai);
sb.setUploadRegisterVector(vbe);
BusinessDetail bdtls = p.saveBusiness(sb);
System.out.println("Done.");
BusinessEntity be = (BusinessEntity)bdtls.getBusinessEntityVector().elementAt(0);
System.out.println("Info on business saved :");
System.out.println("Name = " + be.getName().getValue() + "\nKey = " + be.getBusinessKey());
// log out
System.out.print("Logging out ..... ");
testLogout(ai);
System.out.println("Done.");
}
catch(UDDIException ue)
{
System.out.println("");
System.out.println("**** UDDIEXception ***");
System.out.println("Fault Actor : " + ue.getFaultActor());
System.out.println("Fault Error : " + ue.getFaultCode());
DispositionReport dr = ue.getDispositionReport();
Vector res = dr.getResultVector();
Result r = (Result)res.elementAt(0);
ErrInfo ei = r.getErrInfo();
System.out.println("ErrInfo : "+ ei.getValue());
}
catch (XML_SoapException exp){
System.out.println("XML_SoapException");
System.out.println(exp.getMessage());
exp.printStackTrace();
}
catch(Exception e)
{
System.out.println("Exception");
e.printStackTrace();
}
}
private void testDelService()
{
try
{
// log in
System.out.print("Logging in ..... ");
AuthInfo ai = testLogin();
System.out.println("Done : "+ ai.getValue());
Vector vbkeys = new Vector();
//vbkeys.add(new ServiceKey("2F06C420-38E0-11D5-9E50-002035229C64"));
//vbkeys.add(new ServiceKey("7EFF8A30-2B97-11D5-BFAF-AB3B31212312"));
vbkeys.add(new ServiceKey("64E149A0-4013-11D5-98BF-002035229C64"));
System.out.print("Deleting Service .....");
// create a delete service structure
DeleteService ds = new DeleteService();
// set all the arguments and attributes of the message
// follow the uddi.org specification for details.
ds.setAuthInfo(ai);
ds.setServiceKeyVector(vbkeys);
DispositionReport drpts = p.deleteService(ds);
System.out.println("Done.");
// log out
System.out.print("Logging out ..... ");
testLogout(ai);
System.out.println("Done.");
}
catch(UDDIException ue)
{
System.out.println("");
System.out.println("**** UDDIEXception ***");
System.out.println("Fault Actor : " + ue.getFaultActor());
System.out.println("Fault Error : " + ue.getFaultCode());
DispositionReport dr = ue.getDispositionReport();
Vector res = dr.getResultVector();
Result r = (Result)res.elementAt(0);
ErrInfo ei = r.getErrInfo();
System.out.println("ErrInfo : "+ ei.getValue());
}
catch (XML_SoapException exp){
System.out.println("XML_SoapException");
System.out.println(exp.getMessage());
exp.printStackTrace();
}
catch(Exception e)
{
System.out.println("Exception");
e.printStackTrace();
}
}
private void testSaveService()
{
try
{
// log in
System.out.print("Logging in ..... ");
AuthInfo ai = testLogin();
System.out.println("Done : "+ ai.getValue());
BusinessService bs = new BusinessService();
bs.setBusinessKey("BF9E5450-3AAF-11D5-80DC-002035229C64");
//bs.setServiceKey("2F06C420-38E0-11D5-9E50-002035229C64");
bs.setServiceKey("");
bs.setName(new Name("Msdn Msdn Msdn Testing Service for UDDI one"));
bs.addDescription("Empowering people.Use this service.");
BindingTemplate btemp = new BindingTemplate();
btemp.addDescription("Testing binding template");
btemp.setBindingKey("");
AccessPoint acpt = new AccessPoint("www.testudditest.com", "https");
btemp.setAccessPoint(acpt);
BindingTemplates btemps = new BindingTemplates();
TModelInstanceInfo tminfo = new TModelInstanceInfo();
tminfo.addDescription("Sample TModelInstanceInfo Description");
tminfo.setTModelKey("UUID:68DE9E80-AD09-469D-8A37-088422BFBC36");
TModelInstanceDetails tmidls = new TModelInstanceDetails();
tmidls.addTModelInstanceInfo(tminfo);
btemp.setTModelInstanceDetails(tmidls);
btemps.addBindingTemplate(btemp);
bs.setBindingTemplates(btemps);
Vector bss = new Vector();
bss.add(bs);
System.out.print("Saving Service ..... ");
// create a save service structure
SaveService ss = new SaveService();
// set all the arguments and attributes of the message
// follow the uddi.org specification for details.
ss.setAuthInfo(ai);
ss.setBusinessServiceVector(bss);
ServiceDetail sd = p.saveService(ss);
System.out.println("Done.");
// log out
System.out.print("Logging out ..... ");
testLogout(ai);
System.out.println("Done.");
}
catch(UDDIException ue)
{
System.out.println("");
System.out.println("**** UDDIEXception ***");
System.out.println("Fault Actor : " + ue.getFaultActor());
System.out.println("Fault Error : " + ue.getFaultCode());
DispositionReport dr = ue.getDispositionReport();
Vector res = dr.getResultVector();
Result r = (Result)res.elementAt(0);
ErrInfo ei = r.getErrInfo();
System.out.println("ErrInfo : "+ ei.getValue());
}
catch (XML_SoapException exp){
System.out.println("XML_SoapException");
System.out.println(exp.getMessage());
exp.printStackTrace();
}
catch(Exception e)
{
System.out.println("Exception");
e.printStackTrace();
}
}
private void testDelBinding()
{
try
{
// log in
System.out.print("Logging in ..... ");
AuthInfo ai = testLogin();
System.out.println("Done : "+ ai.getValue());
Vector vbkeys = new Vector();
//vbkeys.add(new BindingKey("AE0A7B90-38E0-11D5-9E50-002035229C64"));
//vbkeys.add(new BindingKey("57D4A7D0-2B9A-11D5-BFAF-AB3B31212312"));
vbkeys.add(new BindingKey("6E312520-3AAF-11D5-80DC-002035229C64"));
System.out.print("Deleting Binding .....");
// create a delete binding structure
DeleteBinding db = new DeleteBinding();
// set all the arguments and attributes of the message
// follow the uddi.org specification for details.
db.setAuthInfo(ai);
db.setBindingKeyVector(vbkeys);
DispositionReport drpts = p.deleteBinding(db);
System.out.println("Done.");
// log out
System.out.print("Logging out ..... ");
testLogout(ai);
System.out.println("Done.");
}
catch(UDDIException ue)
{
System.out.println("");
System.out.println("**** UDDIEXception ***");
System.out.println("Fault Actor : " + ue.getFaultActor());
System.out.println("Fault Error : " + ue.getFaultCode());
DispositionReport dr = ue.getDispositionReport();
Vector res = dr.getResultVector();
Result r = (Result)res.elementAt(0);
ErrInfo ei = r.getErrInfo();
System.out.println("ErrInfo : "+ ei.getValue());
}
catch (XML_SoapException exp){
System.out.println("XML_SoapException");
System.out.println(exp.getMessage());
exp.printStackTrace();
}
catch(Exception e)
{
System.out.println("Exception");
e.printStackTrace();
}
}
private void testSaveBinding()
{
try
{
// log in
System.out.print("Logging in ..... ");
AuthInfo ai = testLogin();
System.out.println("Done : "+ ai.getValue());
BindingTemplate btemp = new BindingTemplate();
btemp.addDescription("Test binding template for saving binding 1");
//btemp.setBindingKey("58951520-38E1-11D5-9E50-002035229C64");
//btemp.setBindingKey("5565FC70-4AD2-4A67-BAF1-A718D7CAFFA2");
btemp.setServiceKey("82C89950-3AAF-11D5-80DC-002035229C64");
AccessPoint acpt = new AccessPoint("www.udditesttest.com", "https");
btemp.setAccessPoint(acpt);
TModelInstanceInfo tminfo = new TModelInstanceInfo();
tminfo.addDescription("TModelInstanceInfo Description qwer qwerty");
tminfo.setTModelKey("UUID:68DE9E80-AD09-469D-8A37-088422BFBC36");
TModelInstanceDetails tmidls = new TModelInstanceDetails();
tmidls.addTModelInstanceInfo(tminfo);
btemp.setTModelInstanceDetails(tmidls);
Vector bss = new Vector();
bss.add(btemp);
System.out.print("Saving Binding ..... ");
// create a save binding structure
SaveBinding sb = new SaveBinding();
// set all the arguments and attributes of the message
// follow the uddi.org specification for details.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -