数字签名无效的异常,请教各位,急!

chouab 2008-12-19 10:04:52
最近打算基于原BEA的aqualogic server registry做一个简单客户端的开发,实现服务发布、查询功能,但是在保存商业实体总报错(错误信息如下);我使用的是用户名/密码进行身份验证,感觉像是数字签名无效的异常,请教各位,急!解决了要多少分给多少分
部署环境:windows 2003 server;weblogic 服务器9.2;开发环境:myEclipse6.01;用的安全策略是weblogic.policy

程序源代码:
package com.nercita.registry.publication;

import com.nercita.registry.common.DemoProperties;
import com.nercita.registry.common.SystinetDemo;
import com.nercita.registry.common.UserInput;
import com.nercita.registry.common.DemoHeader;
import org.systinet.uddi.InvalidParameterException;
import org.systinet.uddi.client.v3.UDDIException;
import org.systinet.uddi.client.v3.UDDIPublishStub;
import org.systinet.uddi.client.v3.UDDISecurityStub;
import org.systinet.uddi.client.v3.UDDI_Publication_PortType;
import org.systinet.uddi.client.v3.UDDI_Security_PortType;
import org.systinet.uddi.client.v3.struct.AuthToken;
import org.systinet.uddi.client.v3.struct.Get_authToken;
import org.systinet.uddi.client.v3.struct.BusinessDetail;
import org.systinet.uddi.client.v3.struct.BusinessEntityArrayList;
import org.systinet.uddi.client.v3.struct.BusinessEntity;
import org.systinet.uddi.client.v3.struct.Discard_authToken;
import org.systinet.uddi.client.v3.struct.Save_business;
import org.systinet.uddi.client.v3.struct.Description;
import org.systinet.uddi.client.v3.struct.Name;

import javax.xml.soap.SOAPException;
import java.util.Iterator;

/**
* This demo shows, how to use Systinet's java API to UDDI v3 call save_business.
* For more information about this call, consult with UDDI v3 specification.
*/
public class SaveBusiness implements SystinetDemo {

public static final String URL_PUBLISHING = "uddi.demos.url.publishing";
public static final String URL_SECURITY = "uddi.demos.url.security";

public static final String USER_JOHN_NAME = "uddi.demos.user.john.name";
public static final String USER_JOHN_PASSWORD = "uddi.demos.user.john.password";

/**
* Creates and fills the Save_business structure.
* @param businessKey key, for which the user owns keyGenerator, null for server-assigned key.
* @param names array of names of Business entity to be saved.
* @param nameLangCodes array of language codes
* @param description its description
* @param authInfo Secret string
* @return Object, which represents Save_business UDDI call.
* @throws InvalidParameterException If the value is invalid.
*/
public Save_business createSaveBusiness(String businessKey, String[] names, String[] nameLangCodes, String description, String authInfo) throws InvalidParameterException {
System.out.println("businessKey = " + businessKey);
for (int i = 0; i < names.length; i++) {
System.out.println("lang = " + nameLangCodes[i] + ", name = " + names[i]);
}
System.out.println("description = " + description);

BusinessEntity businessEntity = new BusinessEntity();
if (businessKey!=null && businessKey.length()>0)
businessEntity.setBusinessKey(businessKey);
for (int i = 0; i < names.length; i++) {
if (nameLangCodes[i] == null) {
businessEntity.addName(new Name(names[i]));
} else
businessEntity.addName(new Name(names[i], nameLangCodes[i]));
}
businessEntity.addDescription(new Description(description));

Save_business save = new Save_business();
save.addBusinessEntity(businessEntity);
save.setAuthInfo(authInfo);

return save;
}

/**
* Executes save_business call with arguments stored in Save_business object.
* @param save Argument to UDDI call.
* @return BusinessDetail
* @throws SOAPException SOAP related problems.
* @throws UDDIException If the UDDI call fails.
*/
public BusinessDetail saveBusiness(Save_business save) throws UDDIException, SOAPException {
System.out.print("Check structure validity .. ");
try {
save.check();
} catch (InvalidParameterException e) {
System.out.println("Failed!");
throw new UDDIException(e);
}
System.out.println("OK");

UDDI_Publication_PortType publishing = getPublishingStub();
System.out.print("Save in progress ...");
BusinessDetail businessDetail = publishing.save_business(save);
System.out.println(" done");
return businessDetail;
}

/**
* Prints argument to the console.
* @param businessDetail parameter to be displayed
*/
public void printBusinessDetail(BusinessDetail businessDetail) {
System.out.println();

BusinessEntityArrayList businessEntityArrayList = businessDetail.getBusinessEntityArrayList();
int position = 1;
for (Iterator iterator = businessEntityArrayList.iterator(); iterator.hasNext();) {
BusinessEntity entity = (BusinessEntity) iterator.next();
System.out.println("Business " + position + " : " + entity.getBusinessKey());
System.out.println(entity.toXML());
System.out.println();
System.out.println("********************************************************");
position++;
}
}

/**
* Finds stub for UDDI Publishing API. The URL is read from properties.
* @return Publishing API stub
* @throws SOAPException If SOAP call fails.
*/
public UDDI_Publication_PortType getPublishingStub() throws SOAPException {
// you can specify your own URL in property - uddi.demos.url.publishing
String url = DemoProperties.getProperty(URL_PUBLISHING, "http://localhost:8080/uddi/publishing");
System.out.print("Using Publishing at url " + url + " ..");
UDDI_Publication_PortType publishing = UDDIPublishStub.getInstance(url);
System.out.println(" done");
return publishing;
}

...全文
1348 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Dantin 2009-01-31
  • 打赏
  • 举报
回复
不会,帮忙顶起来!
guoxyj 2009-01-06
  • 打赏
  • 举报
回复
up
qq8336 2009-01-06
  • 打赏
  • 举报
回复
ding
wap21 2008-12-20
  • 打赏
  • 举报
回复
帮顶
chouab 2008-12-19
  • 打赏
  • 举报
回复
对不起,一着急发了两遍,没有权限删除,请帮我把上面的重复回复删除一个,谢谢
chouab 2008-12-19
  • 打赏
  • 举报
回复
/**
* Finds stub for UDDI Security API. The URL is read from properties.
* @return Security API stub
* @throws SOAPException If SOAP call fails.
*/
public UDDI_Security_PortType getSecurityStub() throws SOAPException {
// you can specify your own URL in property - uddi.demos.url.security
String url = DemoProperties.getProperty(URL_SECURITY, "http://localhost:8080/uddi/security");
// 获得的url:https://192.168.2.128:7002/registry/uddi/security;确认url不会有错
System.out.print("Using Security at url " + url + " ..");
UDDI_Security_PortType security = UDDISecurityStub.getInstance(url);

if(security!=null){

System.out.println(" security done");
return security;
}else {
return null;
}

}

/**
* Gets authInfo for given credentials.
* @param userName name of the user
* @param password password
* @return Secret string.
* @throws InvalidParameterException If the value is not allowed.
* @throws UDDIException If the UDDI call fails.
*/
public String getAuthInfo(String userName, String password, UDDI_Security_PortType security) throws InvalidParameterException, UDDIException {
System.out.print("Logging in ..");
Get_authToken getauthToken=new Get_authToken(userName,password);
AuthToken authToken = security.get_authToken(getauthToken);
System.out.println("get authinfo done");
return authToken.getAuthInfo();
}

/**
* Discards authInfo, so it cannot be used for any further operation.
* @param authInfo
* @param security Secret string
* @throws InvalidParameterException If the value is not allowed.
* @throws UDDIException If the UDDI call fails with error.
*/
public void discardAuthInfo(String authInfo, UDDI_Security_PortType security) throws InvalidParameterException, UDDIException {
System.out.print("Logging out ..");
security.discard_authToken(new Discard_authToken(authInfo));
System.out.println(" done");
}

public void runDemo() throws UDDIException, InvalidParameterException, SOAPException {
String user = DemoProperties.getProperty(USER_JOHN_NAME);
String password = DemoProperties.getProperty(USER_JOHN_PASSWORD);

if ((user == null) || (password == null)) {
System.err.println("Username and password must be specified for publishing!");
System.err.println("Check your properties.");
return;
}

DemoHeader.printHeader("SaveBusiness");
System.out.println("Saving business entity where");

// hint: try to use businessKey "uddi:systinet.com:demo:marketing"
String businessKey = UserInput.readString("Enter (optional) businessKey", "");
int count = UserInput.readInt("Enter count of names", 1);
String[] names = new String[count];
String[] languageCodes = new String[count];
for (int i = 0; i < count; i++) {
String tmp = UserInput.readString("Enter language code", "");
languageCodes[i] = (tmp.length() > 0) ? tmp : null;
names[i] = UserInput.readString("Enter name in language " + tmp, "Marketing");
}
String description = UserInput.readString("Enter description", "Saved by SaveBusiness demo");

System.out.println();

UDDI_Security_PortType security = getSecurityStub();
String authInfo = getAuthInfo(user, password, security);
Save_business save = createSaveBusiness(businessKey, names, languageCodes, description, authInfo);
BusinessDetail result = saveBusiness(save);
printBusinessDetail(result);
discardAuthInfo(authInfo, security);
}

public static void main(String[] args) throws Exception {
SystinetDemo demo = new SaveBusiness();
demo.runDemo();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
异常(提示)部分:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Logging in ..Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy55.get_authToken(Unknown Source)
at com.nercita.registry.publication.SaveBusiness.getAuthInfo(SaveBusiness.java:165)
at com.nercita.registry.publication.SaveBusiness.runDemo(SaveBusiness.java:211)
at com.nercita.registry.publication.SaveBusiness.main(SaveBusiness.java:220)
Caused by: javax.xml.messaging.JAXMException: org.systinet.wasp.client.XMLInvocationException: Exception while creating connection
at com.systinet.jaxm.messaging.ProviderConnectionImpl.call(ProviderConnectionImpl.java:145)
at org.systinet.uddi.client.UDDIClientProxy.invoke(UDDIClientProxy.java:216)
... 4 more
Caused by: org.systinet.wasp.client.XMLInvocationException: Exception while creating connection
at com.systinet.wasp.client.XMLInvocationHelperImpl._connect(XMLInvocationHelperImpl.java:455)
at com.systinet.wasp.client.XMLInvocationHelperImpl._call(XMLInvocationHelperImpl.java:137)
at com.systinet.wasp.client.XMLInvocationHelperImpl.call(XMLInvocationHelperImpl.java:77)
at org.systinet.wasp.client.XMLInvocationHelper.call(XMLInvocationHelper.java:18)
at com.systinet.jaxm.messaging.ProviderConnectionImpl.call(ProviderConnectionImpl.java:141)
... 5 more
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Server certificate 'CN=gaoyunbing, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US' is not trusted!
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.idoox.transport.https.client.HttpsPool.newSocket(HttpsPool.java:113)
at com.idoox.transport.util.SocketPool$SocketExImpl.open(SocketPool.java:158)
at com.idoox.transport.util.SocketPool$SocketExImpl.open(SocketPool.java:145)
at com.idoox.transport.util.SocketPool.newSocketEx(SocketPool.java:401)
at com.idoox.transport.util.SocketPool.get(SocketPool.java:372)
at com.idoox.transport.https.client.HttpsClient.newConnection(HttpsClient.java:129)
at org.idoox.transport.client.Endpoint.newConnection(Endpoint.java:1062)
at com.systinet.wasp.client.RawInvocationHelperImpl.createConnection(RawInvocationHelperImpl.java:47)
at org.systinet.wasp.client.RAWInvocationHelper.createConnection(RAWInvocationHelper.java:28)
at com.systinet.wasp.client.XMLInvocationHelperImpl._connect(XMLInvocationHelperImpl.java:449)
... 9 more
Caused by: java.security.cert.CertificateException: Server certificate 'CN=gaoyunbing, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US' is not trusted!
at com.idoox.transport.https.impl.java14.X509TrustManager_Java14.checkServerTrusted(X509TrustManager_Java14.java:30)
at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Unknown Source)
... 27 more


chouab 2008-12-19
  • 打赏
  • 举报
回复
/**
* Finds stub for UDDI Security API. The URL is read from properties.
* @return Security API stub
* @throws SOAPException If SOAP call fails.
*/
public UDDI_Security_PortType getSecurityStub() throws SOAPException {
// you can specify your own URL in property - uddi.demos.url.security
String url = DemoProperties.getProperty(URL_SECURITY, "http://localhost:8080/uddi/security");
// 获得的url:https://192.168.2.128:7002/registry/uddi/security;确认url不会有错
System.out.print("Using Security at url " + url + " ..");
UDDI_Security_PortType security = UDDISecurityStub.getInstance(url);

if(security!=null){

System.out.println(" security done");
return security;
}else {
return null;
}

}

/**
* Gets authInfo for given credentials.
* @param userName name of the user
* @param password password
* @return Secret string.
* @throws InvalidParameterException If the value is not allowed.
* @throws UDDIException If the UDDI call fails.
*/
public String getAuthInfo(String userName, String password, UDDI_Security_PortType security) throws InvalidParameterException, UDDIException {
System.out.print("Logging in ..");
Get_authToken getauthToken=new Get_authToken(userName,password);
AuthToken authToken = security.get_authToken(getauthToken);
System.out.println("get authinfo done");
return authToken.getAuthInfo();
}

/**
* Discards authInfo, so it cannot be used for any further operation.
* @param authInfo
* @param security Secret string
* @throws InvalidParameterException If the value is not allowed.
* @throws UDDIException If the UDDI call fails with error.
*/
public void discardAuthInfo(String authInfo, UDDI_Security_PortType security) throws InvalidParameterException, UDDIException {
System.out.print("Logging out ..");
security.discard_authToken(new Discard_authToken(authInfo));
System.out.println(" done");
}

public void runDemo() throws UDDIException, InvalidParameterException, SOAPException {
String user = DemoProperties.getProperty(USER_JOHN_NAME);
String password = DemoProperties.getProperty(USER_JOHN_PASSWORD);

if ((user == null) || (password == null)) {
System.err.println("Username and password must be specified for publishing!");
System.err.println("Check your properties.");
return;
}

DemoHeader.printHeader("SaveBusiness");
System.out.println("Saving business entity where");

// hint: try to use businessKey "uddi:systinet.com:demo:marketing"
String businessKey = UserInput.readString("Enter (optional) businessKey", "");
int count = UserInput.readInt("Enter count of names", 1);
String[] names = new String[count];
String[] languageCodes = new String[count];
for (int i = 0; i < count; i++) {
String tmp = UserInput.readString("Enter language code", "");
languageCodes[i] = (tmp.length() > 0) ? tmp : null;
names[i] = UserInput.readString("Enter name in language " + tmp, "Marketing");
}
String description = UserInput.readString("Enter description", "Saved by SaveBusiness demo");

System.out.println();

UDDI_Security_PortType security = getSecurityStub();
String authInfo = getAuthInfo(user, password, security);
Save_business save = createSaveBusiness(businessKey, names, languageCodes, description, authInfo);
BusinessDetail result = saveBusiness(save);
printBusinessDetail(result);
discardAuthInfo(authInfo, security);
}

public static void main(String[] args) throws Exception {
SystinetDemo demo = new SaveBusiness();
demo.runDemo();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
异常(提示)部分:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Logging in ..Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy55.get_authToken(Unknown Source)
at com.nercita.registry.publication.SaveBusiness.getAuthInfo(SaveBusiness.java:165)
at com.nercita.registry.publication.SaveBusiness.runDemo(SaveBusiness.java:211)
at com.nercita.registry.publication.SaveBusiness.main(SaveBusiness.java:220)
Caused by: javax.xml.messaging.JAXMException: org.systinet.wasp.client.XMLInvocationException: Exception while creating connection
at com.systinet.jaxm.messaging.ProviderConnectionImpl.call(ProviderConnectionImpl.java:145)
at org.systinet.uddi.client.UDDIClientProxy.invoke(UDDIClientProxy.java:216)
... 4 more
Caused by: org.systinet.wasp.client.XMLInvocationException: Exception while creating connection
at com.systinet.wasp.client.XMLInvocationHelperImpl._connect(XMLInvocationHelperImpl.java:455)
at com.systinet.wasp.client.XMLInvocationHelperImpl._call(XMLInvocationHelperImpl.java:137)
at com.systinet.wasp.client.XMLInvocationHelperImpl.call(XMLInvocationHelperImpl.java:77)
at org.systinet.wasp.client.XMLInvocationHelper.call(XMLInvocationHelper.java:18)
at com.systinet.jaxm.messaging.ProviderConnectionImpl.call(ProviderConnectionImpl.java:141)
... 5 more
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Server certificate 'CN=gaoyunbing, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US' is not trusted!
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.idoox.transport.https.client.HttpsPool.newSocket(HttpsPool.java:113)
at com.idoox.transport.util.SocketPool$SocketExImpl.open(SocketPool.java:158)
at com.idoox.transport.util.SocketPool$SocketExImpl.open(SocketPool.java:145)
at com.idoox.transport.util.SocketPool.newSocketEx(SocketPool.java:401)
at com.idoox.transport.util.SocketPool.get(SocketPool.java:372)
at com.idoox.transport.https.client.HttpsClient.newConnection(HttpsClient.java:129)
at org.idoox.transport.client.Endpoint.newConnection(Endpoint.java:1062)
at com.systinet.wasp.client.RawInvocationHelperImpl.createConnection(RawInvocationHelperImpl.java:47)
at org.systinet.wasp.client.RAWInvocationHelper.createConnection(RAWInvocationHelper.java:28)
at com.systinet.wasp.client.XMLInvocationHelperImpl._connect(XMLInvocationHelperImpl.java:449)
... 9 more
Caused by: java.security.cert.CertificateException: Server certificate 'CN=gaoyunbing, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US' is not trusted!
at com.idoox.transport.https.impl.java14.X509TrustManager_Java14.checkServerTrusted(X509TrustManager_Java14.java:30)
at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Unknown Source)
... 27 more


wap21 2008-12-19
  • 打赏
  • 举报
回复
ding
qqlpp 2008-12-19
  • 打赏
  • 举报
回复
ding

50,549

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧