You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by sc...@apache.org on 2005/06/02 21:59:47 UTC

svn commit: r179633 - in /incubator/muse/trunk/src/ieeedemo/src: java/org/wsdmdemo/service/ java/org/wsdmdemo/service/weatherStationDir/ test/

Author: scamp
Date: Thu Jun  2 12:59:47 2005
New Revision: 179633

URL: http://svn.apache.org/viewcvs?rev=179633&view=rev
Log: (empty)

Modified:
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java
    incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java
    incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java?rev=179633&r1=179632&r2=179633&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropConstants.java Thu Jun  2 12:59:47 2005
@@ -34,4 +34,7 @@
     double MIN_VISIBILITY = 45.0;
     int MAX_TEMP = 120;
     int MIN_TEMP = 0;
+    String WS1_EPR_URL = "WS1_EPR_URL";
+    String WS_DIR_SERVICE_URL = "WS_DIR_SERVICE_URL";
+    String WS_CLIENT_CONFIG_EPR_URL = "WS_CLIENT_CONFIG_EPR_URL";
 }

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java?rev=179633&r1=179632&r2=179633&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/InteropRequestUtils.java Thu Jun  2 12:59:47 2005
@@ -32,21 +32,21 @@
         return envelopeDoc;
     }
 
-    public static XmlObject sendRequest( XmlObject requestDoc, String action, EndpointReference epr )
+    public static XmlObject sendRequest(XmlObject requestDoc, String action, EndpointReference epr)
     {
         EnvelopeDocument requestEnvelopeDoc = createEnvelope();
         Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
-        addAddressingHeaders( requestEnvelope.getHeader(), action , epr);
-        XmlBeanUtils.addChildElement( requestEnvelope.getBody(), requestDoc );
+        addAddressingHeaders(requestEnvelope.getHeader(), action, epr);
+        XmlBeanUtils.addChildElement(requestEnvelope.getBody(), requestDoc);
         try
         {
-            URL endpointURL = new URL( epr.getAddress() );
-            URI actionURI = new URI( action );
-            String response = SoapClient.sendRequest( endpointURL, requestEnvelopeDoc.newInputStream(), actionURI );
-            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse( response );
+            URL endpointURL = new URL(epr.getAddress());
+            URI actionURI = new URI(action);
+            String response = SoapClient.sendRequest(endpointURL, requestEnvelopeDoc.newInputStream(), actionURI);
+            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse(response);
             Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
-            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements( responseEnvelope.getBody() );
-            if ( responseBodyElems.length == 0 )
+            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements(responseEnvelope.getBody());
+            if (responseBodyElems.length == 0)
             {
                 return null;
             }
@@ -55,18 +55,18 @@
                 return responseBodyElems[0];
             }
         }
-        catch ( Exception e )
+        catch (Exception e)
         {
-            throw new RuntimeException( e );
+            throw new RuntimeException(e);
         }
     }
 
-    public static void addAddressingHeaders( Header header, String action , EndpointReference epr)
+    public static void addAddressingHeaders(Header header, String action, EndpointReference epr)
     {
-        XmlObject eprXBean = ((XmlObjectWrapper)epr).getXmlObject();
+        XmlObject eprXBean = ((XmlObjectWrapper) epr).getXmlObject();
         XmlObject toElem;
         XmlObject actionElem;
-        if ( eprXBean.schemaType().getName().getNamespaceURI().equals( Constants.NS_URI_ADDRESSING_2003_03 ) )
+        if (eprXBean.schemaType().getName().getNamespaceURI().equals(Constants.NS_URI_ADDRESSING_2003_03))
         {
             org.xmlsoap.schemas.ws.x2003.x03.addressing.ToDocument toDoc = org.xmlsoap.schemas.ws.x2003.x03.addressing.ToDocument.Factory.newInstance();
             org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI attributedURI = toDoc.addNewTo();
@@ -74,7 +74,7 @@
             toElem = toDoc;
             org.xmlsoap.schemas.ws.x2003.x03.addressing.ActionDocument actionDoc = org.xmlsoap.schemas.ws.x2003.x03.addressing.ActionDocument.Factory.newInstance();
             org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI actionType = actionDoc.addNewAction();
-            actionType.setStringValue( action );
+            actionType.setStringValue(action);
             actionElem = actionDoc;
         }
         else
@@ -85,11 +85,11 @@
             toElem = toDoc;
             org.xmlsoap.schemas.ws.x2004.x08.addressing.ActionDocument actionDoc = org.xmlsoap.schemas.ws.x2004.x08.addressing.ActionDocument.Factory.newInstance();
             org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI actionType = actionDoc.addNewAction();
-            actionType.setStringValue( action );
+            actionType.setStringValue(action);
             actionElem = actionDoc;
         }
-        XmlBeanUtils.addChildElement( header, toElem );
-        XmlBeanUtils.addChildElement( header, actionElem );
+        XmlBeanUtils.addChildElement(header, toElem);
+        XmlBeanUtils.addChildElement(header, actionElem);
         if (epr.getReferenceProperties() != null)
         {
             XmlObject[] refPropElems = (XmlObject[]) epr.getReferenceProperties();
@@ -104,17 +104,17 @@
     {
         EnvelopeDocument requestEnvelopeDoc = createEnvelope();
         Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
-
-        XmlBeanUtils.addChildElement( requestEnvelope.getBody(), requestDoc );
+        addAddressingHeaders(requestEnvelope.getHeader(), action, address);
+        XmlBeanUtils.addChildElement(requestEnvelope.getBody(), requestDoc);
         try
         {
-            URL endpointURL = new URL( address );
-            URI actionURI = new URI( action );
-            String response = SoapClient.sendRequest( endpointURL, requestEnvelopeDoc.newInputStream(), actionURI );
-            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse( response );
+            URL endpointURL = new URL(address);
+            URI actionURI = new URI(action);
+            String response = SoapClient.sendRequest(endpointURL, requestEnvelopeDoc.newInputStream(), actionURI);
+            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse(response);
             Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
-            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements( responseEnvelope.getBody() );
-            if ( responseBodyElems.length == 0 )
+            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements(responseEnvelope.getBody());
+            if (responseBodyElems.length == 0)
             {
                 return null;
             }
@@ -123,9 +123,26 @@
                 return responseBodyElems[0];
             }
         }
-        catch ( Exception e )
+        catch (Exception e)
         {
-            throw new RuntimeException( e );
+            throw new RuntimeException(e);
         }
+    }
+
+    private static void addAddressingHeaders(Header header, String action, String address)
+    {
+        XmlObject toElem;
+        XmlObject actionElem;
+        org.xmlsoap.schemas.ws.x2004.x08.addressing.ToDocument toDoc = org.xmlsoap.schemas.ws.x2004.x08.addressing.ToDocument.Factory.newInstance();
+        org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI attributedURI = toDoc.addNewTo();
+        attributedURI.setStringValue(address);
+        toElem = toDoc;
+        org.xmlsoap.schemas.ws.x2004.x08.addressing.ActionDocument actionDoc = org.xmlsoap.schemas.ws.x2004.x08.addressing.ActionDocument.Factory.newInstance();
+        org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI actionType = actionDoc.addNewAction();
+        actionType.setStringValue(action);
+        actionElem = actionDoc;
+
+        XmlBeanUtils.addChildElement(header, toElem);
+        XmlBeanUtils.addChildElement(header, actionElem);
     }
 }

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java?rev=179633&r1=179632&r2=179633&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirResource.java Thu Jun  2 12:59:47 2005
@@ -85,9 +85,9 @@
 
             // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Relationship Resource Property
             resourceProperty = resourcePropertySet.get(WeatherStationDirPropertyQNames.RELATIONSHIP);
-            org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDocument prop_relationship = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDocument.Factory.newInstance();
+            //org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDocument prop_relationship = org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDocument.Factory.newInstance();
             resourceProperty.addChangeListener(relationshipCapability);
-            resourceProperty.add(prop_relationship);
+            //resourceProperty.add(prop_relationship);
 
             /** END RESOURCE PROPERTIES **/
         }

Modified: incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java?rev=179633&r1=179632&r2=179633&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/java/org/wsdmdemo/service/weatherStationDir/WeatherStationDirService.java Thu Jun  2 12:59:47 2005
@@ -159,7 +159,7 @@
     {
         GetResourcePropertyDocument getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
         getResourcePropertyDocument.setGetResourceProperty(IdentityCapability.PROP_NAME_RESOURCE_ID);
-        XmlObject xmlObject = InteropRequestUtils.sendRequest(endpointReferenceType, "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl/GetResourceProperty", new XmlBeansEndpointReference(endpointReferenceType));
+        XmlObject xmlObject = InteropRequestUtils.sendRequest(getResourcePropertyDocument, "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl/GetResourceProperty", new XmlBeansEndpointReference(endpointReferenceType));
         if (xmlObject instanceof GetResourcePropertyResponseDocument)
         {
             GetResourcePropertyResponseDocument response = (GetResourcePropertyResponseDocument) xmlObject;

Modified: incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java?rev=179633&r1=179632&r2=179633&view=diff
==============================================================================
--- incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java (original)
+++ incubator/muse/trunk/src/ieeedemo/src/test/IEEEDemoTest.java Thu Jun  2 12:59:47 2005
@@ -4,6 +4,7 @@
 import org.apache.xmlbeans.XmlObject;
 import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
 import org.wsdmdemo.service.InteropRequestUtils;
+import org.wsdmdemo.service.InteropConstants;
 import org.wsdmdemo.service.weatherClientConfig.WeatherClientConfigPropertyQNames;
 import org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
@@ -15,8 +16,9 @@
  */
 public class IEEEDemoTest extends AbstractOneAxisTestCase
 {
-    private static final String WEATHER_STATION_1_EPR_URL = "http://localhost:8080/muse/epr/weather-station-1-epr.xml";
-    private static final String WEATHER_STATION_DIR_SERVICE_URL = "http://localhost:8080/muse/services/WeatherStationDir";
+    private static final String WEATHER_STATION_1_EPR_URL = System.getProperty(InteropConstants.WS1_EPR_URL,"http://localhost:8080/muse/epr/weather-station-1-epr.xml");
+    private static final String WEATHER_STATION_DIR_SERVICE_URL = System.getProperty(InteropConstants.WS_DIR_SERVICE_URL,"http://localhost:8080/muse/services/WeatherStationDir");
+    private static final String WEATHER_STATION_CLIENT_CONFIG_EPR_URL = System.getProperty(InteropConstants.WS_CLIENT_CONFIG_EPR_URL,"http://localhost:8080/muse/epr/weather-client-config-epr.xml");;
 
     public void testDemo() throws Exception
     {
@@ -24,13 +26,14 @@
         AddWeatherStationDocument addWeatherStationDocument = AddWeatherStationDocument.Factory.newInstance();
         org.wsdmdemo.service.weatherStationDir.AddWeatherStationDocument.AddWeatherStation addWeatherStation = addWeatherStationDocument.addNewAddWeatherStation();
         EndpointReferenceDocument weatherStationEprDoc = getEndpointReference( new URL( WEATHER_STATION_1_EPR_URL ) );
+        EndpointReferenceDocument clientConfigEpr = getEndpointReference( new URL( WEATHER_STATION_CLIENT_CONFIG_EPR_URL ) );
         addWeatherStation.setEndpointReference(weatherStationEprDoc.getEndpointReference());
         XmlObject addResponse = InteropRequestUtils.sendRequest(addWeatherStationDocument,"http://wsdmdemo.org/service/weather-station-dir/AddWeatherStation",WEATHER_STATION_DIR_SERVICE_URL);
 
         //retrieve the epr for weather station 1 from wc
         GetResourcePropertyDocument getResourcePropertyDocument = GetResourcePropertyDocument.Factory.newInstance();
         getResourcePropertyDocument.setGetResourceProperty(WeatherClientConfigPropertyQNames.WEATHERSTATIONREFERENCE);
-        XmlObject getResp = InteropRequestUtils.sendRequest(getResourcePropertyDocument,"http://wsdmdemo.org/service/weather-station-dir/GetResourceProperties",new XmlBeansEndpointReference(weatherStationEprDoc.getEndpointReference()));
+        XmlObject getResp = InteropRequestUtils.sendRequest(getResourcePropertyDocument,"http://wsdmdemo.org/service/weather-station-dir/GetResourceProperties",new XmlBeansEndpointReference(clientConfigEpr.getEndpointReference()));
 
        /* //retrieve the metrics
         GetMultipleResourcePropertiesDocument getMultipleResourcePropertiesDocument = GetMultipleResourcePropertiesDocument.Factory.newInstance();



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org