I am trying to create a java program that will interact with jUDDI to publish and inquiry web-services. I am using jUDDI Client API. I am continuously getting this error and googling doesn't help. Can anyone please tell me how to solve this problem.
Error :
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();
}
}
}
Figured out the problem
I was using juddi-tomcat-bundle-3.0.4 and juddi-client-3.1.0.jar. Because of different versions client code was unable to find UDDI_Security_Port.
Solved it using 3.0.4 versions of both juddi server and juddi-client api.