我們正在升級我們的一些系統,包括從V2升級到jUDDI V3。過去,我們在我們的java代碼中使用uddi4j來訪問UDDI服務器,但是uddi4j似乎沒有延續到V3。廣泛的谷歌時間讓我覺得沒有替代品。是這樣嗎?如果有替代品可以推薦嗎?從V2升級,我們可以使用什麼java api連接jUDDI V3?
0
A
回答
1
就我所知,jUDDIv3帶來了自己的UDDI客戶端。
我沒有發現的lib作爲一個單獨的下載,但它包含在JUDDI門戶束。
0
是的,jUDDI擁有自己的UDDIv3客戶端。
這裏的行家細節 <依賴> <的groupId > org.apache.juddi < /的groupId > <的artifactId > JUDDI客戶端</artifactId的> <版本3.1.5 > < /版本> < /依賴關係>
有很多ex在當前的源主幹中有足夠的寬度,所有這些都將與未來的版本捆綁在一起。這些例子可以在這裏找到: http://svn.apache.org/repos/asf/juddi/trunk/juddi-examples/
jUDDI用戶指南也是一個很好的參考。
0
我嘗試下面的代碼在3.0.4 JUDDI門戶束
/*
* Copyright 2001-2010 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
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.Transport;
import org.apache.juddi.v3_service.JUDDIApiPortType;
import org.uddi.api_v3.AuthToken;
import org.uddi.api_v3.BusinessDetail;
import org.uddi.api_v3.BusinessEntity;
import org.uddi.api_v3.BusinessService;
import org.uddi.api_v3.GetAuthToken;
import org.uddi.api_v3.Name;
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;
public class SimplePublish {
private static UDDISecurityPortType security = null;
private static JUDDIApiPortType juddiApi = null;
private static UDDIPublicationPortType publish = null;
public SimplePublish() {
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");
security = transport.getUDDISecurityService();
juddiApi = transport.getJUDDIApiService();
publish = transport.getUDDIPublishService();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void publish() {
try {
// 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.
AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
System.out.println ("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
// Creating a new publisher that we will use to publish our entities to.
Publisher p = new Publisher();
p.setAuthorizedName("my-publisher");
p.setPublisherName("My Publisher");
// Adding the publisher to the "save" structure, using the 'root' user authentication info and saving away.
SavePublisher sp = new SavePublisher();
sp.getPublisher().add(p);
sp.setAuthInfo(rootAuthToken.getAuthInfo());
juddiApi.savePublisher(sp);
// Our publisher is now saved, so now we want to retrieve its authentication token
GetAuthToken getAuthTokenMyPub = new GetAuthToken();
getAuthTokenMyPub.setUserID("my-publisher");
getAuthTokenMyPub.setCred("");
AuthToken myPubAuthToken = security.getAuthToken(getAuthTokenMyPub);
System.out.println ("myPub AUTHTOKEN = " + myPubAuthToken.getAuthInfo());
// Creating the parent business entity that will contain our service.
BusinessEntity myBusEntity = new BusinessEntity();
Name myBusName = new Name();
myBusName.setValue("My Business");
myBusEntity.getName().add(myBusName);
// Adding the business entity to the "save" structure, using our publisher's authentication info and saving away.
SaveBusiness sb = new SaveBusiness();
sb.getBusinessEntity().add(myBusEntity);
sb.setAuthInfo(myPubAuthToken.getAuthInfo());
BusinessDetail bd = publish.saveBusiness(sb);
String myBusKey = bd.getBusinessEntity().get(0).getBusinessKey();
System.out.println("myBusiness key: " + myBusKey);
// Creating a service to save. Only adding the minimum data: the parent business key retrieved from saving the business
// above and a single name.
BusinessService myService = new BusinessService();
myService.setBusinessKey(myBusKey);
Name myServName = new Name();
myServName.setValue("My Service");
myService.getName().add(myServName);
// Add binding templates, etc...
// Adding the service to the "save" structure, using our publisher's authentication info and saving away.
SaveService ss = new SaveService();
ss.getBusinessService().add(myService);
ss.setAuthInfo(myPubAuthToken.getAuthInfo());
ServiceDetail sd = publish.saveService(ss);
String myServKey = sd.getBusinessService().get(0).getServiceKey();
System.out.println("myService key: " + myServKey);
// Now you have a publisher saved who in turn published a business and service via the jUDDI API!
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void main (String args[]) {
SimplePublish sp = new SimplePublish();
sp.publish();
}
}
,並使用以下庫
行家depandency
<dependency>
<groupId>org.apache.juddi</groupId>
<artifactId>juddi-client</artifactId>
<version>3.0.2</version>
</dependency>
和這個jar文件
axis2-adb-1.5.4.jar
完蛋了,我的代碼是工作的罰款
相關問題
- 1. Intuit V2至V3 API升級
- 2. 從V2升級谷歌,地圖API V3
- 3. Capistrano v2升級至v3升級困惑
- 4. 如何將google api v2升級到v3?
- 5. 將Google Maps API V2升級到V3
- 6. 從.net和java使用jUddi v3
- 7. 升級到從V2谷歌地圖API的V3,建議
- 8. 如何/我可以從Eclipse升級Java?
- 9. 我可以使用Squid升級客戶端TLS連接嗎?
- 10. 我們可以在Google Map API v3中使用Mapstaction API嗎?
- 11. Google Drive Java API V2 vs V3
- 12. 我們可以使用UCWA API(Lync)做什麼?以及我們無法使用UCWA API做什麼?
- 13. 使用.NET 4將Ninject v2升級到v3 System.ServiceProcess.ServiceBase
- 14. 我們可以使用EWS託管API連接到Exchange 2016嗎?
- 15. 爲什麼我們可以用telnet連接http或memcached?
- 16. 我們可以將iphone sdk 3.1升級到更高級別嗎?
- 17. 我們可以使用odbc只與java連接數據庫嗎?
- 18. 我們可以從apache LDAP API連接到活動目錄嗎?
- 19. 我們還可以使用Android M的指紋API做什麼?
- 20. 我可以使用C#連接到Java API嗎?
- 21. 使用PHP連接FourSquare API V2
- 22. 什麼樣的問題將Silverlight從v3升級到v4
- 23. 爲什麼我們可以直接使用遊標?
- 24. 無法將Google API升級到V3
- 25. 影響上升級驅動V2時V3(使用谷歌登錄功能)
- 26. 我們可以更改iOS應用程序進行升級嗎?
- 27. 使用Digital Ocean api v2升級到Ansible 2.0問題
- 28. 什麼是BigInteger,我們什麼時候可以使用它?
- 29. 我可以直接將DataStax Enterprise從4.5.1升級到4.8.9嗎?
- 30. 我可以使用什麼軟件來模擬蜂窩連接
我實際上已經找過那很頁面,但我不能爲我的生活弄清楚如何編程訪問UDDI數據庫來獲取和服務到位。 – Adam 2010-01-30 00:57:42
在5.7節中有一個如何驗證uddi v3服務器的示例代碼。 您可以使用此示例並使用transport對象來擴展它以訪問Inquery和PublishService。 應該是這樣的: UDDIInquiryPortType query = transport.getInquiryService(); UDDIPublicationPortType publish = transport.getPublishService(); 現在我不能給你完整的代碼示例,因爲我手頭沒有正常的服務器。我現在唯一能給你的是鏈接到Javadoc也許這有助於: http://ws.apache.org/juddi/apidocs3/index.html – 2010-01-31 22:08:28
感謝smartypants,現在很清楚。 – Adam 2010-02-01 16:22:50