You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@juddi.apache.org by Edgar Orduña <ed...@gmail.com> on 2013/03/08 16:42:14 UTC
Re: Find Services
Hi
Do you know how can i get the URL of the WSDL from the service?
i have this code but i get the name of the service and i want to get the
url from the wsdl
public class JuddiFind {
public static void main(String[] args) {
find("%");
}
public static void find(String serviceName) {
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();
GetAuthToken getAuthTokenRoot = new GetAuthToken();
getAuthTokenRoot.setUserID("root");
getAuthTokenRoot.setCred("root");
org.uddi.api_v3.AuthToken rootAuthToken =
security.getAuthToken(getAuthTokenRoot);
System.out.println ("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
FindService find=new FindService();
FindTModel findModel=new FindTModel();
Name findName=new Name();
findName.setValue(serviceName);
findModel.setListHead(0);
findModel.setMaxRows(5);
findModel.setAuthInfo(rootAuthToken.getAuthInfo());
find.getName().add(findName);
FindQualifiers qualifiers=new FindQualifiers();
qualifiers.getFindQualifier().add("approximateMatch");
findModel.setFindQualifiers(qualifiers);
find.setAuthInfo(rootAuthToken.getAuthInfo());
find.setMaxRows(5);
find.setListHead(0);
find.setFindQualifiers(qualifiers);
ServiceList foundList = inquiry.findService(find);
if(foundList.getServiceInfos()!=null)
{
if(foundList.getServiceInfos().getServiceInfo()!=null)
{
System.out.println(
"Services "+ foundList.getServiceInfos().getServiceInfo().size()+"\n");
for(ServiceInfo info:foundList.getServiceInfos().getServiceInfo())
{
System.out.println("\nName: "+info.getName().get(0).getValue());
}
}
else
{
System.out.println("\n Ooops: foundList.getServiceInfos().getServiceInfo()
este null!\n");
}
}
else
{
System.out.println("\n Ooops: foundList.getServiceInfos() este null!\n");
}
}
}
}
}
Thank you so much
Re: Find Services
Posted by Kurt T Stam <ku...@gmail.com>.
Hi Edgar,
The WSDL is not stored in the registry. A service can have multiple
BindingTemplates each of which contain a link to the either the endpoint
of the service itself or a link to where to obtain the WSDL (the
accessUrl in the BindingTemplate).
Hope this helps.
Cheers,
--Kurt
On 3/8/13 10:42 AM, Edgar Orduña wrote:
> Hi
>
> Do you know how can i get the URL of the WSDL from the service?
>
> i have this code but i get the name of the service and i want to get
> the url from the wsdl
>
>
>
> public class JuddiFind {
>
> public static void main(String[] args) {
> find("%");
> }
>
>
> public static void find(String serviceName) {
>
> 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();
>
>
> GetAuthToken getAuthTokenRoot = new GetAuthToken();
>
> getAuthTokenRoot.setUserID("root");
>
> getAuthTokenRoot.setCred("root");
>
> org.uddi.api_v3.AuthToken rootAuthToken =
> security.getAuthToken(getAuthTokenRoot);
>
> System.out.println ("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
> FindService find=new FindService();
> FindTModel findModel=new FindTModel();
> Name findName=new Name();
> findName.setValue(serviceName);
> findModel.setListHead(0);
> findModel.setMaxRows(5);
> findModel.setAuthInfo(rootAuthToken.getAuthInfo());
> find.getName().add(findName);
> FindQualifiers qualifiers=new FindQualifiers();
> qualifiers.getFindQualifier().add("approximateMatch");
> findModel.setFindQualifiers(qualifiers);
> find.setAuthInfo(rootAuthToken.getAuthInfo());
> find.setMaxRows(5);
> find.setListHead(0);
> find.setFindQualifiers(qualifiers);
> ServiceList foundList = inquiry.findService(find);
> if(foundList.getServiceInfos()!=null)
> {
> if(foundList.getServiceInfos().getServiceInfo()!=null)
> {
> System.out.println(
> "Services "+ foundList.getServiceInfos().getServiceInfo().size()+"\n");
> for(ServiceInfo info:foundList.getServiceInfos().getServiceInfo())
> {
> System.out.println("\nName: "+info.getName().get(0).getValue());
> }
> }
> else
> {
> System.out.println("\n Ooops:
> foundList.getServiceInfos().getServiceInfo() este null!\n");
> }
> }
> else
> {
> System.out.println("\n Ooops: foundList.getServiceInfos() este null!\n");
> }
> }
>
> }
> }
> }
>
>
>
>
> Thank you so much