Author: alexoree
Date: Tue Jan 14 03:39:39 2014
New Revision: 1557924
URL: http://svn.apache.org/r1557924
Log:
JUDDI-788 code part is done
Added:
juddi/trunk/juddi-examples/simple-publish-clerk/
juddi/trunk/juddi-examples/simple-publish-clerk/README.txt
juddi/trunk/juddi-examples/simple-publish-clerk/pom.xml
juddi/trunk/juddi-examples/simple-publish-clerk/src/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/resources/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/resources/META-INF/
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/resources/META-INF/uddi.xml
juddi/trunk/juddi-examples/simple-publish-clerk/src/test/
juddi/trunk/juddi-examples/simple-publish-clerk/src/test/java/
juddi/trunk/juddi-examples/simple-publish-clerk/src/test/resources/
juddi/trunk/juddi-examples/simple-publish-portable/
juddi/trunk/juddi-examples/simple-publish-portable/README.txt
juddi/trunk/juddi-examples/simple-publish-portable/pom.xml
juddi/trunk/juddi-examples/simple-publish-portable/src/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/apache/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/apache/juddi/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/apache/juddi/example/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/apache/juddi/example/publish/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/apache/juddi/example/publish/SimplePublishPortable.java
juddi/trunk/juddi-examples/simple-publish-portable/src/main/resources/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/resources/META-INF/
juddi/trunk/juddi-examples/simple-publish-portable/src/main/resources/META-INF/uddi.xml
juddi/trunk/juddi-examples/simple-publish-portable/src/test/
juddi/trunk/juddi-examples/simple-publish-portable/src/test/java/
juddi/trunk/juddi-examples/simple-publish-portable/src/test/resources/
Removed:
juddi/trunk/juddi-examples/simple-publish/
Modified:
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
juddi/trunk/juddi-examples/pom.xml
Modified:
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java?rev=1557924&r1=1557923&r2=1557924&view=diff
==============================================================================
---
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
(original)
+++
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
Tue Jan 14 03:39:39 2014
@@ -484,7 +484,7 @@ public class UDDIClerk implements Serial
/**
* Register a service, using the node of current clerk ('this'). Note,
- * if registration fails, no exception is thrown
+ * if registration fails, no exception is thrown and null is returned
*
* @param service
* @return
@@ -501,7 +501,7 @@ public class UDDIClerk implements Serial
* @param service the element returned by the server, it may be
modified
* from the original
* @param node
- * @return the potentially modified service by the UDDI server
+ * @return the potentially modified service by the UDDI server or NULL
if save failed
*/
public BusinessService register(BusinessService service, Node node) {
@@ -531,7 +531,7 @@ public class UDDIClerk implements Serial
* registers a UDDI business. This is a convenience wrapper
*
* @param business
- * @return a possibility modified business entity as registered
+ * @return a possibility modified business entity as registered or
NULL if the save failed
*/
public BusinessEntity register(BusinessEntity business) {
return register(business, this.getUDDINode().getApiNode());
@@ -543,7 +543,7 @@ public class UDDIClerk implements Serial
*
* @param business
* @param node
- * @return a possibility modified business entity as registered
+ * @return a possibility modified business entity as registered or
NULL if the save failed
*/
public BusinessEntity register(BusinessEntity business, Node node) {
Modified: juddi/trunk/juddi-examples/pom.xml
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/pom.xml?rev=1557924&r1=1557923&r2=1557924&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/pom.xml (original)
+++ juddi/trunk/juddi-examples/pom.xml Tue Jan 14 03:39:39 2014
@@ -22,20 +22,21 @@
<artifactId>juddi-examples</artifactId>
<name>jUDDI Examples</name>
<packaging>pom</packaging>
- <prerequisites>
- <maven>3.0.3</maven>
- </prerequisites>
- <modules>
- <module>create-partition</module>
- <module>hello-world</module>
- <module>hello-world-embedded</module>
- <module>simple-browse</module>
- <module>simple-publish</module>
- <module>uddi-annotations</module>
- <module>wsdl2uddi</module>
- <module>wsdl2uddi-lifecyle</module>
- <module>subscription-notification-amqp</module>
- <module>more-uddi-samples</module>
- <module>service-version</module>
- </modules>
+ <prerequisites>
+ <maven>3.0.3</maven>
+ </prerequisites>
+ <modules>
+ <module>create-partition</module>
+ <module>hello-world</module>
+ <module>hello-world-embedded</module>
+ <module>simple-browse</module>
+ <module>simple-publish-portable</module>
+ <module>simple-publish-clerk</module>
+ <module>uddi-annotations</module>
+ <module>wsdl2uddi</module>
+ <module>wsdl2uddi-lifecyle</module>
+ <module>subscription-notification-amqp</module>
+ <module>more-uddi-samples</module>
+ <module>service-version</module>
+ </modules>
</project>
\ No newline at end of file
Added: juddi/trunk/juddi-examples/simple-publish-clerk/README.txt
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish-clerk/README.txt?rev=1557924&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/simple-publish-clerk/README.txt (added)
+++ juddi/trunk/juddi-examples/simple-publish-clerk/README.txt Tue Jan 14
03:39:39 2014
@@ -0,0 +1,19 @@
+This example is a command line demonstration of how to interact with UDDI.
+
+Specifically, this code shows you how to perform the same functions as
simple-publish-portable, however using much less code by utilizing the
UDDIClerk and UDDIClient functions.
+
+1. Start the jUDDI-server (juddi-tomcat or juddi-bundle)
+
+2. Check the settings of the META-INF/uddi.xml, to make sure the serverName
and serverPort are set correctly.
+
+3. mvn -Pdemo test
+
+You should see the following output being written to the console:
+
+root AUTHTOKEN = authtoken:0494e382-1ad3-4c52-8806-ae70a0ed37ad
+myPub AUTHTOKEN = authtoken:bf973e5f-7361-4c57-92f7-7b499b886b6d
+myBusiness key: uddi:juddi.apache.org:6f3e4e62-e483-48ff-a1b3-6855310505c6
+myService key: uddi:juddi.apache.org:549a9580-cd7b-4969-9b77-527ab9f8f261
+
+However since the keys are being generated in this case your keys will differ.
+
Added: juddi/trunk/juddi-examples/simple-publish-clerk/pom.xml
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish-clerk/pom.xml?rev=1557924&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/simple-publish-clerk/pom.xml (added)
+++ juddi/trunk/juddi-examples/simple-publish-clerk/pom.xml Tue Jan 14 03:39:39
2014
@@ -0,0 +1,69 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.juddi.example</groupId>
+ <artifactId>juddi-examples</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>simple-publish-clerk</artifactId>
+ <name>jUDDI Example Simple Publish using clerks</name>
+ <description>Demonstrates the steps taken to publish a service using the
UDDI</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>uddi-ws</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>juddi-client</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>demo</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+
<mainClass>org.apache.juddi.example.publish.SimplePublishClerk</mainClass>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
+
Added:
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java?rev=1557924&view=auto
==============================================================================
---
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java
(added)
+++
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/java/org/apache/juddi/example/publish/SimplePublishClerk.java
Tue Jan 14 03:39:39 2014
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.juddi.example.publish;
+
+import org.uddi.api_v3.*;
+import org.apache.juddi.api_v3.*;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.v3_service.UDDISecurityPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+
+/**
+ * This shows you to interact with a UDDI server by publishing a Business,
+ * Service and Binding Template. It uses code that is specific to the jUDDI
+ * client jar's and represents an easier, simpler way to do things. (UDDIClient
+ * and UDDIClerk classes). Credentials and URLs are all set via uddi.xml
+ */
+public class SimplePublishClerk {
+
+ private static UDDISecurityPortType security = null;
+ private static JUDDIApiPortType juddiApi = null;
+ private static UDDIPublicationPortType publish = null;
+
+ private static UDDIClerk clerk = null;
+
+ public SimplePublishClerk() {
+ try {
+ // create a client and read the config in the archive;
+ // you can use your config file name
+ UDDIClient uddiClient = new
UDDIClient("META-INF/uddi.xml");
+ clerk = uddiClient.getClerk("default");
+ // a UddiClient can be a client to multiple UDDI
nodes, so
+ // supply the nodeName (defined in your uddi.xml.
+ // The transport can be WS, inVM, RMI etc which is
defined in the uddi.xml
+ Transport transport =
uddiClient.getTransport("default");
+ // Now you create a reference to the UDDI API
+ security = transport.getUDDISecurityService();
+ juddiApi = transport.getJUDDIApiService();
+ publish = transport.getUDDIPublishService();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This function shows you how to publish to UDDI using a fairly
generic
+ * mechanism that should be portable (meaning use any UDDI v3 library
+ * with this code)
+ */
+ public void publish() {
+ try {
+
+ // 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.
+ BusinessEntity register = clerk.register(myBusEntity);
+ if (register == null) {
+ System.out.println("Save failed!");
+ System.exit(1);
+ }
+ String myBusKey = register.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...
+ BindingTemplate myBindingTemplate = new
BindingTemplate();
+ AccessPoint accessPoint = new AccessPoint();
+
accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
+
accessPoint.setValue("http://example.org/services/myservice?wsdl");
+ myBindingTemplate.setAccessPoint(accessPoint);
+ BindingTemplates myBindingTemplates = new
BindingTemplates();
+ //optional but recommended step, this annotations our
binding with all the standard SOAP tModel instance infos
+ myBindingTemplate =
UDDIClient.addSOAPtModels(myBindingTemplate);
+
myBindingTemplates.getBindingTemplate().add(myBindingTemplate);
+ myService.setBindingTemplates(myBindingTemplates);
+ // Adding the service to the "save" structure, using
our publisher's authentication info and saving away.
+ BusinessService svc = clerk.register(myService);
+ if (svc==null){
+ System.out.println("Save failed!");
+ System.exit(1);
+ }
+
+ String myServKey = svc.getServiceKey();
+ System.out.println("myService key: " + myServKey);
+
+ clerk.discardAuthToken();
+ // Now you have a business and service via
+ // the jUDDI API!
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String args[]) {
+ SimplePublishClerk sp = new SimplePublishClerk();
+ sp.publish();
+ }
+}
Added:
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/resources/META-INF/uddi.xml
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish-clerk/src/main/resources/META-INF/uddi.xml?rev=1557924&view=auto
==============================================================================
---
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/resources/META-INF/uddi.xml
(added)
+++
juddi/trunk/juddi-examples/simple-publish-clerk/src/main/resources/META-INF/uddi.xml
Tue Jan 14 03:39:39 2014
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<uddi xmlns="urn:juddi-apache-org:v3_client"
xsi:schemaLocation="classpath:/xsd/uddi-client.xsd">
+ <reloadDelay>5000</reloadDelay>
+ <client name="example-client">
+ <nodes>
+ <node>
+ <!-- required 'default' node -->
+ <name>default</name>
+ <properties>
+ <property name="serverName" value="localhost"/>
+ <property name="serverPort" value="8080"/>
+ <!-- for UDDI nodes that use HTTP u/p,
using the following
+ <property name="basicAuthUsername"
value="root" />
+ <property name="basicAuthPassword"
value="password" />
+ <property
name="basicAuthPasswordIsEncrypted" value="false" />
+ <property
name="basicAuthPasswordCryptoProvider"
value="org.apache.juddi.v3.client.crypto.AES128Cryptor (an example)" />-->
+ </properties>
+ <description>Main jUDDI node</description>
+ <!-- JAX-WS Transport -->
+
<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+
<custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer</custodyTransferUrl>
+
<inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry</inquiryUrl>
+
<inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+
<publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish</publishUrl>
+
<securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security</securityUrl>
+
<subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription</subscriptionUrl>
+
<subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener</subscriptionListenerUrl>
+
<juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
+ </node>
+ </nodes>
+ </client>
+</uddi>
Added: juddi/trunk/juddi-examples/simple-publish-portable/README.txt
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish-portable/README.txt?rev=1557924&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/simple-publish-portable/README.txt (added)
+++ juddi/trunk/juddi-examples/simple-publish-portable/README.txt Tue Jan 14
03:39:39 2014
@@ -0,0 +1,19 @@
+This example is a command line demonstration of how to interact with UDDI.
+
+Specifically, this code gives you a fairly vanilla mechanism for interaction
with any UDDIv3 server.
+
+1. Start the jUDDI-server (juddi-tomcat or juddi-bundle)
+
+2. Check the settings of the META-INF/uddi.xml, to make sure the serverName
and serverPort are set correctly.
+
+3. mvn -Pdemo test
+
+You should see the following output being written to the console:
+
+root AUTHTOKEN = authtoken:0494e382-1ad3-4c52-8806-ae70a0ed37ad
+myPub AUTHTOKEN = authtoken:bf973e5f-7361-4c57-92f7-7b499b886b6d
+myBusiness key: uddi:juddi.apache.org:6f3e4e62-e483-48ff-a1b3-6855310505c6
+myService key: uddi:juddi.apache.org:549a9580-cd7b-4969-9b77-527ab9f8f261
+
+However since the keys are being generated in this case your keys will differ.
+
Added: juddi/trunk/juddi-examples/simple-publish-portable/pom.xml
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish-portable/pom.xml?rev=1557924&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/simple-publish-portable/pom.xml (added)
+++ juddi/trunk/juddi-examples/simple-publish-portable/pom.xml Tue Jan 14
03:39:39 2014
@@ -0,0 +1,69 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.juddi.example</groupId>
+ <artifactId>juddi-examples</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>simple-publish-portable</artifactId>
+ <name>jUDDI Example Simple Publish Portable</name>
+ <description>Demonstrates the steps taken to publish a service using the
UDDI in a portable manner</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>uddi-ws</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.juddi</groupId>
+ <artifactId>juddi-client</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>demo</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+
<mainClass>org.apache.juddi.example.publish.SimplePublishPortable</mainClass>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
+
Added:
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/apache/juddi/example/publish/SimplePublishPortable.java
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/apache/juddi/example/publish/SimplePublishPortable.java?rev=1557924&view=auto
==============================================================================
---
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/apache/juddi/example/publish/SimplePublishPortable.java
(added)
+++
juddi/trunk/juddi-examples/simple-publish-portable/src/main/java/org/apache/juddi/example/publish/SimplePublishPortable.java
Tue Jan 14 03:39:39 2014
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.juddi.example.publish;
+
+import org.uddi.api_v3.*;
+import org.apache.juddi.api_v3.*;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.juddi.v3.client.transport.Transport;
+import org.uddi.v3_service.UDDISecurityPortType;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+
+/**
+ * This shows you to interact with a UDDI server by publishing a Business,
+ * Service and Binding Template. It uses some fairly generic code that should
be
+ * mostly portable to any other UDDI client library and is therefore consider
+ * "portable". URLs are set in uddi.xml
+ *
+ */
+public class SimplePublishPortable {
+
+ private static UDDISecurityPortType security = null;
+ private static JUDDIApiPortType juddiApi = null;
+ private static UDDIPublicationPortType publish = null;
+
+ public SimplePublishPortable() {
+ try {
+ // create a client and read the config in the archive;
+ // you can use your config file name
+ UDDIClient uddiClient = new
UDDIClient("META-INF/uddi.xml");
+ // a UddiClient can be a client to multiple UDDI
nodes, so
+ // supply the nodeName (defined in your uddi.xml.
+ // The transport can be WS, inVM, RMI etc which is
defined in the uddi.xml
+ Transport transport =
uddiClient.getTransport("default");
+ // Now you create a reference to the UDDI API
+ security = transport.getUDDISecurityService();
+ juddiApi = transport.getJUDDIApiService();
+ publish = transport.getUDDIPublishService();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This function shows you how to publish to UDDI using a fairly
generic
+ * mechanism that should be portable (meaning use any UDDI v3 library
+ * with this code)
+ */
+ public void publish() {
+ try {
+
+ // Login aka retrieve its authentication token
+ GetAuthToken getAuthTokenMyPub = new GetAuthToken();
+ getAuthTokenMyPub.setUserID("uddi");
//your username
+ getAuthTokenMyPub.setCred("");
//your password
+ AuthToken myPubAuthToken =
security.getAuthToken(getAuthTokenMyPub);
+ System.out.println("myPub AUTHTOKEN = " + "*******
never log auth tokens!");
+
+ // 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...
+ BindingTemplate myBindingTemplate = new
BindingTemplate();
+ AccessPoint accessPoint = new AccessPoint();
+
accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
+
accessPoint.setValue("http://example.org/services/myservice?wsdl");
+ myBindingTemplate.setAccessPoint(accessPoint);
+ BindingTemplates myBindingTemplates = new
BindingTemplates();
+ //optional but recommended step, this annotations our
binding with all the standard SOAP tModel instance infos
+ myBindingTemplate =
UDDIClient.addSOAPtModels(myBindingTemplate);
+
myBindingTemplates.getBindingTemplate().add(myBindingTemplate);
+
+ myService.setBindingTemplates(myBindingTemplates);
+
+ // 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);
+
+ security.discardAuthToken(new
DiscardAuthToken(myPubAuthToken.getAuthInfo()));
+ // Now you have published a business and service via
+ // the jUDDI API!
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String args[]) {
+ SimplePublishPortable sp = new SimplePublishPortable();
+ sp.publish();
+ }
+}
Added:
juddi/trunk/juddi-examples/simple-publish-portable/src/main/resources/META-INF/uddi.xml
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish-portable/src/main/resources/META-INF/uddi.xml?rev=1557924&view=auto
==============================================================================
---
juddi/trunk/juddi-examples/simple-publish-portable/src/main/resources/META-INF/uddi.xml
(added)
+++
juddi/trunk/juddi-examples/simple-publish-portable/src/main/resources/META-INF/uddi.xml
Tue Jan 14 03:39:39 2014
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<uddi xmlns="urn:juddi-apache-org:v3_client"
xsi:schemaLocation="classpath:/xsd/uddi-client.xsd">
+ <reloadDelay>5000</reloadDelay>
+ <client name="example-client">
+ <nodes>
+ <node>
+ <!-- required 'default' node -->
+ <name>default</name>
+ <properties>
+ <property name="serverName" value="localhost"/>
+ <property name="serverPort" value="8080"/>
+ <!-- for UDDI nodes that use HTTP u/p,
using the following
+ <property name="basicAuthUsername"
value="root" />
+ <property name="basicAuthPassword"
value="password" />
+ <property
name="basicAuthPasswordIsEncrypted" value="false" />
+ <property
name="basicAuthPasswordCryptoProvider"
value="org.apache.juddi.v3.client.crypto.AES128Cryptor (an example)" />-->
+ </properties>
+ <description>Main jUDDI node</description>
+ <!-- JAX-WS Transport -->
+
<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+
<custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer</custodyTransferUrl>
+
<inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry</inquiryUrl>
+
<inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+
<publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish</publishUrl>
+
<securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security</securityUrl>
+
<subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription</subscriptionUrl>
+
<subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener</subscriptionListenerUrl>
+
<juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
+ </node>
+ </nodes>
+ </client>
+</uddi>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]