JiveJdon Community Forums
在线469人   首页   主题表   培训咨询   标签   精华   查搜   注册    登陆 RSS
首页 » 论坛 » J2EE/JavaEE/JEE/EJB/JSF等技术讨论
???en_US.forumThreadPrev.name??? 上一主题
  Go back to the topic 返回本主题   Go back to the topic listing返回主题列表
???en_US.forumThreadNext.name??? 下一主题
Go 总共有 2 回复 / 1
 发表新帖子   回复该主题贴
xuechen0721

悄悄话
发表文章: 24
注册时间: 2006年01月04日 22:50
请教banq大哥:一个j2ee web service问题,困扰很久了 2006年01月06日 20:09 到本帖网址 加入本帖到收藏夹 发送到手机 回复该主题
标签列表
我在https://uddi.ibm.com注册了一个uddi测试账户
以下是一段我编写的代码(参考的),意在尝试在账户中添加一个组织Chengguang
import javax.xml.registry.Connection;
import javax.xml.registry.ConnectionFactory;
import javax.xml.registry.RegistryService;
import javax.xml.registry.BusinessLifeCycleManager;
import javax.xml.registry.JAXRException;
import javax.xml.registry.JAXRResponse;
import javax.xml.registry.BulkResponse;
import javax.xml.registry.infomodel.Organization;
import javax.xml.registry.infomodel.InternationalString;
import java.net.PasswordAuthentication;
import java.util.Properties;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;

public class uddiRegistry {
public static void main(String[] args) throws JAXRException {
String companyName = "ChengGuang"; //添加的组织
String username = "xc81_2005@yahoo.com.cn";
String password = "05107300684";

Connection connection = connectionToRegistry(username,password);

//Access the RegistryService objects;
RegistryService registry = connection.getRegistryService();
BusinessLifeCycleManager lifeCycleMngr = registry.getBusinessLifeCycleManager();

//create an organization object and assign it a name;
Organization myOrganization = lifeCycleMngr.createOrganization(companyName);

//save the organization to the uddi directory;
Set organizationSet = new HashSet();
organizationSet.add(myOrganization);
BulkResponse response = lifeCycleMngr.saveOrganizations(organizationSet);

doException(response);


connection.close();
}

public static Connection connectionToRegistry(String username,String password) throws JAXRException {
javax.xml.registry.ConnectionFactory factory = javax.xml.registry.ConnectionFactory.newInstance();

Properties props = new Properties();
props.setProperty("javax.xml.registry.LifeCycleManagerURL",
"http://uddi.ibm.com/testregistry/publishapi");
props.setProperty("javax.xml.registry.queryManagerURL",
"http://uddi.ibm.com/testregistry/inquiryapi");
props.setProperty("javax.xml.registry.security.authenticationMethod",
"UDDI_GET_AUTHTOKEN");

factory.setProperties(props);

Connection connection = factory.createConnection();

PasswordAuthentication credential = new PasswordAuthentication(username,password.toCharArray());
Set credentials = new HashSet();
credentials.add(credential);
connection.setCredentials(credentials);

return connection;
}

public static void doException(BulkResponse rspns) throws JAXRException {
if(rspns.getStatus() == JAXRResponse.STATUS_SUCCESS) {
System.out.println("No problems reported!");
}else {
Iterator exceptions = rspns.getExceptions().iterator();
while(exceptions.hasNext()) {
Exception je = (Exception)exceptions.next();
System.out.println("- - - Exception - - -");
je.printStackTrace();
System.out.println("******************");
}
}
}
}

相关的类库(jaxr类库:jaxr-api.jar、jaxr-apisrc.jar)都已导入到环境变量中。
程序编译没有出现任何错误,而在运行时出现以下报错:

请问banq大哥,这是什么问题啊?研究了很久没弄明白,望赐教!谢谢
banq

悄悄话
发表文章: 9528
注册时间: 2002年08月03日 17:08
Re: 请教banq大哥:一个j2ee web service问题,困扰很久了 2006年01月09日 15:39 到本帖网址 加入本帖到收藏夹 发送到手机 回复该主题
连接问题,从网络和安全方面考虑
xuechen0721

悄悄话
发表文章: 24
注册时间: 2006年01月04日 22:50
Re: 请教banq大哥:一个j2ee web service问题,困扰很久了 2006年01月09日 20:03 到本帖网址 加入本帖到收藏夹 发送到手机 回复该主题
能说的详细一点嘛?
我现在不知道怎样修改程序。我根本不清楚问题具体出在哪里?
这个主题有 2 回复 / 1Go
???en_US.forumThreadPrev.name??? 上一主题
  Go back to the topic 返回本主题   Go back to the topic listing返回主题列表    返回页首返回页首
???en_US.forumThreadNext.name??? 下一主题
热点TAG: AOP cache 缓存 DDD EJB 集群 设计模式 Hibernate IOC JiveJdon OO RBAC Seam Spring Struts
正在读取,请等待...
google yahoo 新浪ViVi 365Key网摘 天极网摘 CSDN网摘 添加到百度搜藏 POCO网摘 博采网摘
查询本论坛内 回复超过的热门帖子
     回复该主题贴
标题
 
粗体 斜体 下划线 插入图片 插入代码 插入url链接 插入附件
内容
  每2分种自动备份发贴内容Ctrl-V粘贴取出,提问题前先查询标签列表

RSS 手机阅读 add to google add to yahoo
解惑之道在J道 ,打造中国最具影响力的的企业软件社区
OpenSource JIVEJDON v3.0 Powered by JdonFramework Code © 2002-08 jdon.com

anti spam