我正在尝试创建一个java程序,该程序将与jUDDI交互以发布和查询web服务。我正在使用jUDDI客户端API。我不断得到这个错误和谷歌没有帮助。谁能告诉我怎样解决这个问题?
错误:org.apache.juddi.v3.client.transport.TransportException: Cannot create Service instance, service {urn:uddi-org:v3_service}UDDI_Security_Port not found in the WSDL http://localhost:8080/juddiv3/services/security?wsdl
A aparut o eroare :Cannot create Service instance, service {urn:uddi-org:v3_service}UDDI_Security_Port not found in the WSDL http://localhost:8080/juddiv3/services/security?wsdl
----------------------------------------------------------------
at org.apache.juddi.v3.client.transport.JAXWSTransport.getUDDISecurityService(JAXWSTransport.java:104)
at org.apache.juddi.v3.client.transport.Transport.getUDDISecurityService(Transport.java:43)
at javaapplication22.JuddiPublish.publish(JuddiPublish.java:56)
at javaapplication22.JuddiPublish.main(JuddiPublish.java:40)
Caused by: Cannot create Service instance, service {urn:uddi-org:v3_service}UDDI_Security_Port not found in the WSDL http://localhost:8080/juddiv3/services/security?wsdl
at com.sun.xml.internal.ws.client.ServiceContextBuilder.build(ServiceContextBuilder.java:66)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:125)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:52)
at javax.xml.ws.Service.<init>(Service.java:57)
at javax.xml.ws.Service.create(Service.java:302)
at org.apache.juddi.v3.client.transport.JAXWSTransport.getUDDISecurityService(JAXWSTransport.java:101)
... 3 more
JuddiPublish.java
import org.apache.juddi.api_v3.Publisher;
import org.apache.juddi.api_v3.SavePublisher;
import org.apache.juddi.v3.client.ClassUtil;
import org.apache.juddi.v3.client.config.UDDIClientContainer;
import org.apache.juddi.v3.client.transport.JAXWSTransport;
import org.apache.juddi.v3.client.transport.Transport;
import org.apache.juddi.v3_service.JUDDIApiPortType;
import org.uddi.api_v3.BindingDetail;
import org.uddi.api_v3.BusinessDetail;
import org.uddi.api_v3.BusinessEntity;
import org.uddi.api_v3.BusinessService;
import org.uddi.api_v3.CategoryBag;
import org.uddi.api_v3.Description;
import org.uddi.api_v3.GetAuthToken;
import org.uddi.api_v3.GetServiceDetail;
import org.uddi.api_v3.KeyedReference;
import org.uddi.api_v3.Name;
import org.uddi.api_v3.SaveBinding;
import org.uddi.api_v3.SaveBusiness;
import org.uddi.api_v3.SaveService;
import org.uddi.api_v3.ServiceDetail;
import org.uddi.v3_service.UDDIPublicationPortType;
import org.uddi.v3_service.UDDISecurityPortType;
import org.uddi.v3_service.UDDIInquiryPortType;
import org.uddi.api_v3.BindingTemplates;
//import org.apache.juddi.model.BindingTemplate;
import org.uddi.api_v3.BindingTemplate;
import org.uddi.api_v3.AccessPoint;
import org.uddi.api_v3.FindQualifiers;
import org.uddi.api_v3.FindService;
import org.uddi.api_v3.ServiceList;
import org.uddi.api_v3.ServiceInfo;
import org.uddi.api_v3.FindTModel;
public class JuddiPublish {
public static void main(String[] args) {
publish("service name", "Calculare cmmdc", "wsdl locatie");
}
public static void publish(String serviceNameStr, String serviceDescriptionStr, String wsdlLocation) {
try {
String clazz = UDDIClientContainer.getUDDIClerkManager(null).
getClientConfig().getUDDINode("default").getProxyTransport();
Class<?> transportClass = ClassUtil.forName(clazz, Transport.class);
if (transportClass != null) {
Transport transport = (Transport) transportClass.getConstructor(String.class).newInstance("default");
UDDISecurityPortType security = transport.getUDDISecurityService();
JUDDIApiPortType juddiApi = transport.getJUDDIApiService();
UDDIPublicationPortType publish = transport.getUDDIPublishService();
UDDIInquiryPortType inquiry = transport.getUDDIInquiryService();
// Setting up the values to get an authentication token for the 'root' user ('root' user
// has admin privileges and can save other publishers).
GetAuthToken getAuthTokenRoot = new GetAuthToken();
getAuthTokenRoot.setUserID("root");
getAuthTokenRoot.setCred("");
// Making API call that retrieves the authentication token for the 'root' user.
org.uddi.api_v3.AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
System.out.println("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
} catch (Exception e) {
System.out.println(
"n----------------------------------------------------------------");
System.out.println(
"A aparut o eroare :" + e.getMessage()
+ "n----------------------------------------------------------------n");
e.printStackTrace();
}
}
}
解决问题
我使用juddi-tomcat-bundle-3.0.4和juddi-client-3.1.0.jar。由于版本不同,客户端代码无法找到UDDI_Security_Port.
使用3.0.4版本的juddi server和juddi-client api解决了这个问题