You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by wi...@apache.org on 2005/09/15 16:26:10 UTC
svn commit: r289240 - in
/webservices/muse/trunk/src/examples/ieeedemo/client: etc/
src/org/apache/interop/client/ src/org/apache/interop/common/ui/
src/org/apache/interop/smgr/ src/org/apache/interop/wcmgr/
src/org/apache/interop/wcmgr/impl/ src/tests/
Author: wire
Date: Thu Sep 15 07:26:00 2005
New Revision: 289240
URL: http://svn.apache.org/viewcvs?rev=289240&view=rev
Log:
Changes post EMW
Added:
webservices/muse/trunk/src/examples/ieeedemo/client/etc/wsclient.sh
webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ResourceStub.java
webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ServiceStub.java
Modified:
webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/MessagesJPanel.java
webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/StatusJPanel.java
webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java
webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp2.java
webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java
webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/impl/WsImpl.java
webservices/muse/trunk/src/examples/ieeedemo/client/src/tests/WsCompatabilityTest.java
Added: webservices/muse/trunk/src/examples/ieeedemo/client/etc/wsclient.sh
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/etc/wsclient.sh?rev=289240&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/etc/wsclient.sh (added)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/etc/wsclient.sh Thu Sep 15 07:26:00 2005
@@ -0,0 +1,44 @@
+export CP=addressing-SNAPSHOT.jar
+export CP=$CP:wsui.jar
+export CP=$CP:ant-1.6.2.jar
+export CP=$CP:apollo-incubating-1.0-SNAPSHOT.jar
+export CP=$CP:apollo-jndi-config-SNAPSHOT.jar
+export CP=$CP:commonj-twm-api-1.1.jar
+export CP=$CP:wsa-xbeans-SNAPSHOT.jar
+export CP=$CP:wsrf-xbeans-SNAPSHOT.jar
+export CP=$CP:axis-1.2.jar
+export CP=$CP:axis-jaxrpc-1.2.jar
+export CP=$CP:axis-saaj-1.2.jar
+export CP=$CP:commons-cli-1.0.jar
+export CP=$CP:commons-collections-3.1.jar
+export CP=$CP:commons-digester-1.6.jar
+export CP=$CP:commons-discovery-0.2.jar
+export CP=$CP:commons-httpclient-2.0.2.jar
+export CP=$CP:commons-io-1.0.jar
+export CP=$CP:commons-lang-2.0.jar
+export CP=$CP:commons-logging-1.0.4.jar
+export CP=$CP:concurrent-1.3.4.jar
+export CP=$CP:naming-core-0.8.jar
+export CP=$CP:naming-factory-0.8.jar
+export CP=$CP:naming-java-0.8.jar
+export CP=$CP:hermes-incubating-1.0-SNAPSHOT.jar
+export CP=$CP:wsn-xbeans-SNAPSHOT.jar
+export CP=$CP:jaxen-1.1-beta-3.jar
+export CP=$CP:gnujaxp-snapshot.jar
+export CP=$CP:jcommon-1.0.0-pre2.jar
+export CP=$CP:jfreechart-1.0.0-pre2.jar
+export CP=$CP:jgraph-5.5.1.jar
+export CP=$CP:junit-3.8.1.jar
+export CP=$CP:advertiser-xbeans-SNAPSHOT.jar
+export CP=$CP:muse-incubating-1.0-SNAPSHOT.jar
+export CP=$CP:servletapi-2.3.jar
+export CP=$CP:velocity-1.4.jar
+export CP=$CP:wsdl4j-1.5-SNAPSHOT.jar
+export CP=$CP:xalan-2.4.1.jar
+export CP=$CP:xbean-2.0.0-beta1.jar
+export CP=$CP:xmlbeans-jsr173-api-2.0-dev.jar
+export CP=$CP:weather-client-config-xbeans-SNAPSHOT.jar
+export CP=$CP:weather-station-dir-xbeans-SNAPSHOT.jar
+export CP=$CP:weather-station-xbeans-SNAPSHOT.jar
+export CP=$CP:wsdm-xbeans-SNAPSHOT.jar
+java -cp $CP org.apache.interop.wcdisplay.WcDisplayApp
Added: webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ResourceStub.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ResourceStub.java?rev=289240&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ResourceStub.java (added)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ResourceStub.java Thu Sep 15 07:26:00 2005
@@ -0,0 +1,285 @@
+/*=============================================================================*
+ * Copyright 2005 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.interop.client;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.Calendar;
+import java.util.Observable;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.message.addressing.Constants;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.soap.SoapClient;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeResponseDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.impl.DestroyResponseDocumentImpl;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesResponseDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.UpdateType;
+import org.xmlsoap.schemas.soap.envelope.Envelope;
+import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
+import org.xmlsoap.schemas.soap.envelope.Header;
+
+/**
+ * A stub for a WSDM Resource.
+ */
+public class ResourceStub extends Observable
+{
+ static Logger LOG = Logger.getLogger(ResourceStub.class.toString());
+
+ static final boolean DEBUG = false;//Boolean.getBoolean( "debug" );
+
+ private EndpointReference m_epr;
+ private EndpointReference m_epr2003;
+ private EndpointReference m_epr2004;
+
+ public static boolean USE_WRAPPED_NOTIFICATIONS = Boolean.valueOf(System.getProperty("wrapped_notifications", "true")).booleanValue();
+
+ public ResourceStub( EndpointReference epr )
+ {
+ XmlBeansEndpointReference xBeansEpr=(XmlBeansEndpointReference)epr;
+ m_epr = epr;
+ XmlObject eprXBean = ((XmlObjectWrapper)m_epr).getXmlObject();
+ if ( eprXBean.schemaType().getName().getNamespaceURI().equals( Constants.NS_URI_ADDRESSING_2003_03 ) )
+ {
+ m_epr2003=m_epr;
+ m_epr2004=new XmlBeansEndpointReference((org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType)xBeansEpr.getXmlObject(org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA));
+
+ } else {
+ m_epr2004=m_epr;
+ m_epr2003=new XmlBeansEndpointReference((org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType)xBeansEpr.getXmlObject(org.apache.ws.addressing.v2003_03.AddressingConstants.NSURI_ADDRESSING_SCHEMA));
+ }
+ }
+
+ public XmlObject[] getResourceProperty( QName propName ) throws FaultException
+ {
+ GetResourcePropertyDocument requestDoc = GetResourcePropertyDocument.Factory.newInstance();
+
+ requestDoc.setGetResourceProperty( propName );
+ XmlObject response = sendRequest( requestDoc, "http://xyz.com/action/GetResourceProperty","P" );
+ if ( ! ( response instanceof GetResourcePropertyResponseDocument.GetResourcePropertyResponse ) )
+ {
+ throw new FaultException( response.toString() );
+ }
+ return XmlBeanUtils.getChildElements( response );
+ }
+
+ public void updateResourceProperty( XmlObject[] propElems ) throws FaultException
+ {
+ SetResourcePropertiesDocument requestDoc = SetResourcePropertiesDocument.Factory.newInstance();
+ SetResourcePropertiesDocument.SetResourceProperties setResourceProperties = requestDoc.addNewSetResourceProperties();
+ UpdateType updateType = setResourceProperties.addNewUpdate();
+ for ( int i = 0; i < propElems.length; i++ )
+ {
+ XmlBeanUtils.addChildElement( updateType, propElems[i] );
+ }
+ XmlObject response = sendRequest( requestDoc, "http://xyz.com/action/SetResourceProperties","U" );
+ if ( ! ( response instanceof SetResourcePropertiesResponseDocument.SetResourcePropertiesResponse ) )
+ {
+ throw new FaultException( response.toString() );
+ }
+ }
+
+ public EndpointReference subscribe( String consumerURL, QName topic,long duration ) throws FaultException
+ {
+ SubscribeDocument requestDoc = SubscribeDocument.Factory.newInstance();
+ SubscribeDocument.Subscribe subscribe = requestDoc.addNewSubscribe();
+ subscribe.setUseNotify(USE_WRAPPED_NOTIFICATIONS);
+ Calendar instance = Calendar.getInstance();
+ instance.setTimeInMillis(instance.getTimeInMillis() + duration);
+ subscribe.setInitialTerminationTime( instance );
+ org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType consumerRef = subscribe.addNewConsumerReference();
+ org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI address = consumerRef.addNewAddress();
+ address.setStringValue( consumerURL );
+ TopicExpressionType topicExpr = subscribe.addNewTopicExpression();
+ topicExpr.setDialect( TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE );
+ XmlBeanUtils.setValueAsQName( topicExpr, topic );
+ XmlObject response = sendRequest( requestDoc, "http://xyz.com/action/Subscribe","S" );
+ if ( ! ( response instanceof SubscribeResponseDocument.SubscribeResponse ) )
+ {
+ throw new FaultException( response.toString() );
+ }
+ SubscribeResponseDocument.SubscribeResponse subscribeResponse = (SubscribeResponseDocument.SubscribeResponse) response;
+ return new XmlBeansEndpointReference( subscribeResponse.getSubscriptionReference() );
+
+ }
+
+ public void destroySubscription( ) throws FaultException
+ {
+ DestroyDocument requestDoc = DestroyDocument.Factory.newInstance();
+ requestDoc.addNewDestroy();
+ XmlObject response = sendRequest( requestDoc, "http://xyz.com/action/Destroy","D" );
+ if ( ! ( response instanceof DestroyResponseDocumentImpl.DestroyResponseImpl) )
+ {
+ throw new FaultException( response.toString() );
+ }
+ }
+
+ public EndpointReference subscribe( String consumerURL, QName topic ) throws FaultException
+ {
+ return subscribe( consumerURL, topic,7200000);
+ }
+
+ private EnvelopeDocument createEnvelope()
+ {
+ EnvelopeDocument envelopeDoc = EnvelopeDocument.Factory.newInstance();
+ Envelope envelope = envelopeDoc.addNewEnvelope();
+ envelope.addNewHeader();
+ envelope.addNewBody();
+ return envelopeDoc;
+ }
+
+ public XmlObject sendRequest( XmlObject requestDoc, String action ,String type )
+ {
+ // Hack for internal network
+ String addr=m_epr.getAddress();
+ //addr=addr.replaceAll("192\\.168\\.0\\.20","12.35.246.160");
+
+ EnvelopeDocument requestEnvelopeDoc = createEnvelope();
+ Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
+ addAddressingHeaders( requestEnvelope.getHeader(), action );
+ XmlBeanUtils.addChildElement( requestEnvelope.getBody(), requestDoc );
+ try
+ {
+ URL endpointURL = new URL( addr );//m_epr.getAddress()
+ URI actionURI = new URI( action );
+ LOG.log(Level.DEBUG, "Sending request: \n" + requestEnvelopeDoc );
+ String response = SoapClient.sendRequest( endpointURL, requestEnvelopeDoc.newInputStream(), actionURI );
+ setChanged();
+ XmlOptions xmlOpts = new XmlOptions().setSaveOuter();
+ xmlOpts.setSavePrettyPrint();
+
+ notifyObservers(new WcmMessage("<?xml version=\"1.0\" encoding=\"UTF8\" ?>"+requestEnvelopeDoc.xmlText(xmlOpts), response,type));
+ EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse( response );
+ LOG.log(Level.DEBUG, "Received response: \n" + responseEnvelopeDoc );
+ Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
+ XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements( responseEnvelope.getBody() );
+ if ( responseBodyElems.length == 0 )
+ {
+ return null;
+ }
+ else
+ {
+ return responseBodyElems[0];
+ }
+ }
+ catch ( Exception e )
+ {
+ LOG.log(Level.ERROR,e);
+ throw new RuntimeException( e );
+ }
+ }
+
+ /**
+ * All resource proerpties request must you 2003 addressing
+ * @param header
+ * @param action
+ */
+ private void addAddressingHeaders( Header header, String action )
+ {
+ XmlObject eprXBean = ((XmlObjectWrapper)m_epr).getXmlObject();
+ XmlObject toElem;
+ XmlObject actionElem;
+ 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();
+ attributedURI.setStringValue(m_epr.getAddress());
+ 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 );
+ actionElem = actionDoc;
+ }
+ else
+ {
+ 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(m_epr.getAddress());
+ 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 );
+ if (m_epr.getReferenceProperties() != null)
+ {
+ XmlObject[] refPropElems = (XmlObject[]) m_epr.getReferenceProperties();
+ for (int i = 0; i < refPropElems.length; i++)
+ {
+ XmlBeanUtils.addChildElement(header, refPropElems[i]);
+ }
+ }
+ }
+
+ private void addAddressingHeadersOld( Header header, String action )
+ {
+ XmlObject eprXBean = ((XmlObjectWrapper)m_epr).getXmlObject();
+ XmlObject toElem;
+ XmlObject actionElem;
+ 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();
+ attributedURI.setStringValue(m_epr.getAddress());
+ 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 );
+ actionElem = actionDoc;
+ }
+ else
+ {
+ 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(m_epr.getAddress());
+ 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 );
+ if (m_epr.getReferenceProperties() != null)
+ {
+ XmlObject[] refPropElems = (XmlObject[]) m_epr.getReferenceProperties();
+ for (int i = 0; i < refPropElems.length; i++)
+ {
+ XmlBeanUtils.addChildElement(header, refPropElems[i]);
+ }
+ }
+ }
+
+}
Added: webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ServiceStub.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ServiceStub.java?rev=289240&view=auto
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ServiceStub.java (added)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/client/ServiceStub.java Thu Sep 15 07:26:00 2005
@@ -0,0 +1,154 @@
+/*=============================================================================*
+ * Copyright 2005 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.interop.client;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.soap.SoapClient;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.GetManageabilityReferencesDocument;
+import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.GetManageabilityReferencesResponseDocument;
+import org.xmlsoap.schemas.soap.envelope.Envelope;
+import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
+import org.xmlsoap.schemas.soap.envelope.Header;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+
+import javax.xml.namespace.QName;
+import java.net.URI;
+import java.net.URL;
+import java.util.Observable;
+
+/**
+ * TODO
+ */
+public class ServiceStub extends Observable
+{
+ static Logger LOG = Logger.getLogger(ServiceStub.class.toString());
+ protected URL m_url;
+
+ public ServiceStub( URL url )
+ {
+ m_url = url;
+ }
+
+ protected EndpointReferenceType[] getManageabilityReferences() throws FaultException
+ {
+ GetManageabilityReferencesDocument requestDoc = GetManageabilityReferencesDocument.Factory.newInstance();
+ requestDoc.addNewGetManageabilityReferences();
+ XmlObject response = sendRequest( requestDoc, "http://xyz.com/action/GetManageabilityReferences", m_url);
+ if ( ! ( response instanceof GetManageabilityReferencesResponseDocument.GetManageabilityReferencesResponse ) )
+ {
+ throw new FaultException( response.toString() );
+ }
+ return ((GetManageabilityReferencesResponseDocument.GetManageabilityReferencesResponse)response).getManageabilityEndpointReferenceArray();
+ }
+
+
+
+ protected EnvelopeDocument createEnvelope()
+ {
+ EnvelopeDocument envelopeDoc = EnvelopeDocument.Factory.newInstance();
+ Envelope envelope = envelopeDoc.addNewEnvelope();
+ envelope.addNewHeader();
+ envelope.addNewBody();
+ return envelopeDoc;
+ }
+
+ public XmlObject sendRequest(XmlObject requestDoc, String action, URL url)
+ {
+ EnvelopeDocument requestEnvelopeDoc = createEnvelope();
+ Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
+ XmlBeanUtils.addChildElement( requestEnvelope.getBody(), requestDoc );
+ try
+ {
+ URI actionURI = new URI( action );
+ LOG.log(Level.DEBUG, "Sending request: \n" + requestEnvelopeDoc );
+
+
+ setChanged();
+ String response = SoapClient.sendRequest( url, requestEnvelopeDoc.newInputStream(), actionURI );
+ XmlOptions xmlOpts = new XmlOptions().setSaveOuter();
+ xmlOpts.setSavePrettyPrint();
+ EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse( response );
+ notifyObservers(new WcmMessage(requestDoc.xmlText(xmlOpts), responseEnvelopeDoc.xmlText(xmlOpts)));
+
+ LOG.log(Level.DEBUG, "Received response: \n" + responseEnvelopeDoc );
+ Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
+ XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements( responseEnvelope.getBody() );
+ if ( responseBodyElems.length == 0 )
+ {
+ return null;
+ }
+ else
+ {
+ return responseBodyElems[0];
+ }
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+ protected XmlObject sendRequest(EnvelopeDocument requestEnvelope, String action, URL url)
+ {
+
+ try
+ {
+ URI actionURI = new URI( action );
+ LOG.log(Level.DEBUG, "Sending request: \n" + requestEnvelope );
+ String response = SoapClient.sendRequest( url, requestEnvelope.newInputStream(), actionURI );
+ EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse( response );
+ LOG.log(Level.DEBUG, "Received response: \n" + responseEnvelopeDoc );
+ Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
+ XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements( responseEnvelope.getBody() );
+ if ( responseBodyElems.length == 0 )
+ {
+ return null;
+ }
+ else
+ {
+ return responseBodyElems[0];
+ }
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+
+ protected void addAddressingHeader(Header header, String action, String address, QName keyHeaderName, String weatherstationKey1)
+ {
+ 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);
+
+
+ XmlObject resourceKeyHeader = XmlBeanUtils.addChildElement(header, keyHeaderName);
+ XmlBeanUtils.setValue(resourceKeyHeader, weatherstationKey1);
+ }
+}
Modified: webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/MessagesJPanel.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/MessagesJPanel.java?rev=289240&r1=289239&r2=289240&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/MessagesJPanel.java (original)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/MessagesJPanel.java Thu Sep 15 07:26:00 2005
@@ -75,7 +75,7 @@
private JPanel jPanelTimePanel;
private JPanel jPanelMessageBody;
private DefaultListModel listModel;
- private static final int m_CountMessages2Retain=100;
+ private static final int m_CountMessages2Retain=1000;
// Net Beans Internationalization
private static final String SETTINGS = "org/apache/interop/common/ui/NBEditorBean";
private ResourceBundle settings = ResourceBundle.getBundle( SETTINGS );
Modified: webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/StatusJPanel.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/StatusJPanel.java?rev=289240&r1=289239&r2=289240&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/StatusJPanel.java (original)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/common/ui/StatusJPanel.java Thu Sep 15 07:26:00 2005
@@ -314,6 +314,7 @@
DefaultGraphModel model = (DefaultGraphModel)jGraphMain.getModel();
List theRoots = model.getRoots();
Vector changedStations=new Vector();
+ try{
for (final Iterator iter = theRoots.iterator(); iter.hasNext();) {
DefaultGraphCell element = (DefaultGraphCell) iter.next();
if(element instanceof WsGraphCell){
@@ -325,11 +326,13 @@
// }
}
}
-
// Refresh all stations with changes made in them
for (Iterator iter = changedStations.iterator(); iter.hasNext();) {
String wsName = (String) iter.next();
updateWs(wsName);
+ }
+ } catch (RuntimeException e) {
+ // Eat this because of concurrent exceptions
}
Modified: webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java?rev=289240&r1=289239&r2=289240&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java (original)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp.java Thu Sep 15 07:26:00 2005
@@ -1,20 +1,26 @@
package org.apache.interop.smgr;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.io.IOException;
+
+import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
+import javax.xml.namespace.QName;
-
-import org.apache.interop.smgr.SubsciberInfoJPanel;
-import org.apache.interop.smgr.BackberryJPanel;
+import org.apache.interop.client.FaultException;
+import org.apache.interop.client.NotificationListener;
+import org.apache.interop.client.ResourceStub;
+import org.apache.interop.common.LocationJPanel;
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.addressing.XmlBeansEndpointReference;
import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
import org.apache.ws.util.XmlBeanUtils;
-import org.apache.ws.util.soap.Envelope;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;
-import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventType;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.impl.ManagementEventTypeImpl;
import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType;
import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
@@ -22,22 +28,6 @@
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.ResourcePropertyValueChangeNotificationTypeImpl;
import org.xmlsoap.schemas.soap.envelope.Body;
import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
-
-import java.awt.Color;
-import java.awt.FlowLayout;
-import java.awt.BorderLayout;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.swing.JSplitPane;
-import javax.xml.namespace.QName;
-
-import org.apache.interop.client.FaultException;
-import org.apache.interop.client.NotificationListener;
-import org.apache.interop.client.ResourceStub;
-import org.apache.interop.client.ServiceStub;
-import org.apache.interop.common.LocationJPanel;
/**
* This code was generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
Modified: webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp2.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp2.java?rev=289240&r1=289239&r2=289240&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp2.java (original)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/smgr/BlackBerryApp2.java Thu Sep 15 07:26:00 2005
@@ -1,24 +1,25 @@
package org.apache.interop.smgr;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.io.IOException;
+
+import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
-
+import javax.xml.namespace.QName;
import org.apache.interop.client.FaultException;
import org.apache.interop.client.NotificationListener;
import org.apache.interop.client.ResourceStub;
-import org.apache.interop.client.ServiceStub;
-import org.apache.interop.smgr.SubsciberInfoJPanel;
-import org.apache.interop.smgr.BackberryJPanel;
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.addressing.XmlBeansEndpointReference;
import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
import org.apache.ws.util.XmlBeanUtils;
-import org.apache.ws.util.soap.Envelope;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;
-import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventType;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.impl.ManagementEventTypeImpl;
import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType;
import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
@@ -26,16 +27,6 @@
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.impl.ResourcePropertyValueChangeNotificationTypeImpl;
import org.xmlsoap.schemas.soap.envelope.Body;
import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
-
-import java.awt.Color;
-import java.awt.FlowLayout;
-import java.awt.BorderLayout;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.swing.JSplitPane;
-import javax.xml.namespace.QName;
/**
* This code was generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
Modified: webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java?rev=289240&r1=289239&r2=289240&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java (original)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/WcMgrApp.java Thu Sep 15 07:26:00 2005
@@ -1,5 +1,25 @@
package org.apache.interop.wcmgr;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSplitPane;
+import javax.swing.Timer;
+import javax.swing.WindowConstants;
+import javax.xml.namespace.QName;
+
import org.apache.interop.client.FaultException;
import org.apache.interop.client.NotificationListener;
import org.apache.interop.client.ResourceStub;
@@ -17,11 +37,9 @@
import org.apache.interop.wcmgr.model.IWs;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.apache.ws.Soap1_1Constants;
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.addressing.XmlBeansEndpointReference;
import org.apache.ws.addressing.v2004_08_10.AddressingConstants;
-import org.apache.ws.resource.handler.ResourceHandler;
import org.apache.ws.util.XmlBeanUtils;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlException;
@@ -41,20 +59,6 @@
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.impl.EndpointReferenceTypeImpl;
-import javax.swing.*;
-import javax.xml.namespace.QName;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
/**
* This code was generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
@@ -368,12 +372,17 @@
* @see org.apache.interop.smgr.ConnectionListener#onDisconnect()
*/
public void onDisconnect() {
+
if(m_messageWorker!=null)
m_messageWorker.stop();
if(m_listener!=null)
m_listener.stop();
- timer.stop();
+ if(timer!=null)
+ synchronized (timer) {
+ timer.stop();
+ }
+
// Blank out display
//aasd
Modified: webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/impl/WsImpl.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/impl/WsImpl.java?rev=289240&r1=289239&r2=289240&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/impl/WsImpl.java (original)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/src/org/apache/interop/wcmgr/impl/WsImpl.java Thu Sep 15 07:26:00 2005
@@ -10,7 +10,6 @@
import org.apache.interop.client.FaultException;
import org.apache.interop.client.ResourceStub;
-import org.apache.interop.wcmgr.WcMgrApp;
import org.apache.interop.wcmgr.model.IWs;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -24,8 +23,6 @@
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.impl.values.XmlStringImpl;
import org.oasisOpen.docs.wsdm.x2004.x12.mows.wsdmMows.impl.DurationMetricImpl;
-import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument;
-import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusPropertiesType;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipParticipantType;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.impl.OperationalStatusDocumentImpl;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.impl.RelationshipTypeImpl;
Modified: webservices/muse/trunk/src/examples/ieeedemo/client/src/tests/WsCompatabilityTest.java
URL: http://svn.apache.org/viewcvs/webservices/muse/trunk/src/examples/ieeedemo/client/src/tests/WsCompatabilityTest.java?rev=289240&r1=289239&r2=289240&view=diff
==============================================================================
--- webservices/muse/trunk/src/examples/ieeedemo/client/src/tests/WsCompatabilityTest.java (original)
+++ webservices/muse/trunk/src/examples/ieeedemo/client/src/tests/WsCompatabilityTest.java Thu Sep 15 07:26:00 2005
@@ -33,7 +33,6 @@
import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType;
import org.wsdmdemo.service.weatherStation.KickmeDocument;
import org.wsdmdemo.service.weatherStation.RecalibrateDocument;
-import org.wsdmdemo.service.weatherStation.impl.KickmeResponseDocumentImpl;
import org.wsdmdemo.service.weatherStation.impl.TemperatureMetricTypeImpl;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
@@ -112,6 +111,23 @@
m_listener=null;
}
}
+ /**
+ * Make sure a station name is returned.
+ * @throws FaultException
+ *
+ */
+ public void testGetStationName() throws FaultException{
+ XmlObject[] nameArry=m_wsResourceStub.getResourceProperty(weatherStationNameQname);
+ assertNotNull(nameArry);
+ assertTrue(nameArry.length>0);
+ assertTrue("The response document was not a XmlStringImpl. This may indicate that you are missing the xbean jars for the Weather Station. Confirm that they are on the classpath and try again.",
+ nameArry[0] instanceof XmlStringImpl);
+ XmlStringImpl nameDocument=(XmlStringImpl)nameArry[0];
+ String status = nameDocument.getStringValue();
+ assertNotNull(status);
+ assertTrue("Returned Station Name Should Not be the empty string. Try using your Resource ID.",status.length()>0);
+
+ }
/**
* Objective: Test for price in range of 0.01 to 0.99.
@@ -154,23 +170,6 @@
// TODO Not Done, Force it unavailable
}
- /**
- * Make sure a station name is returned.
- * @throws FaultException
- *
- */
- public void testGetStationName() throws FaultException{
- XmlObject[] nameArry=m_wsResourceStub.getResourceProperty(weatherStationNameQname);
- assertNotNull(nameArry);
- assertTrue(nameArry.length>0);
- assertTrue("The response document was not a XmlStringImpl. This may indicate that you are missing the xbean jars for the Weather Station. Confirm that they are on the classpath and try again.",
- nameArry[0] instanceof XmlStringImpl);
- XmlStringImpl nameDocument=(XmlStringImpl)nameArry[0];
- String status = nameDocument.getStringValue();
- assertNotNull(status);
- assertTrue("Returned Station Name Should Not be the empty string. Try using your Resource ID.",status.length()>0);
-
- }
/**
* Collect multiple temeratures.