Work-in-progress checkin of web services proxy implementation. New files.

This commit is contained in:
vidur%netscape.com 2001-10-09 23:54:51 +00:00
Родитель 1b230be078
Коммит 11abb9d092
10 изменённых файлов: 1065 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,31 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = public src
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,165 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (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.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Bandhauer (jband@netscape.com)
* Vidur Apparao (vidur@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __wspprivate_h__
#define __wspprivate_h__
#include "nsIWebServiceProxy.h"
#include "nsIWSDL.h"
// interface info includes
#include "xptcall.h"
#include "nsIInterfaceInfo.h"
// XPCOM includes
#include "nsCOMPtr.h"
#include "nsSupportsArray.h"
#include "nsIPropertyBag.h"
class nsISOAPCall;
class nsISOAPResponse;
class nsISOAPParameter;
class WSPFactory : public nsIWebServiceProxyFactory
{
public:
WSPFactory();
virtual ~WSPFactory();
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBSERVICEPROXYFACTORY
};
class WSPProxy : public nsXPTCStubBase,
public nsIWebServiceProxy,
public nsIClassInfo
{
public:
WSPProxy();
virtual ~WSPProxy();
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBSERVICEPROXY
NS_DECL_NSICLASSINFO
// Would be nice to have a NS_DECL_NSXPTCSTUBBASE
NS_IMETHOD CallMethod(PRUint16 methodIndex,
const nsXPTMethodInfo* info,
nsXPTCMiniVariant* params);
NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info);
static nsresult Create(nsIWSDLPort* aPort,
nsIInterfaceInfo* aPrimaryInterface,
const nsAReadableString& aNamespace,
PRBool aIsAsync, WSPProxy** aProxy);
protected:
nsCOMPtr<nsIWSDLPort> mPort;
nsCOMPtr<nsIInterfaceInfo> mPrimaryInterface;
nsString mNamespace;
PRBool mIsAsync;
nsSupportsArray mPendingCalls;
};
class WSPCallContext : public nsIWebServiceCallContext
// public nsISOAPResponseListener
{
public:
WSPCallContext();
virtual ~WSPCallContext();
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBSERVICECALLCONTEXT
static nsresult Create(WSPProxy* aProxy,
nsISOAPCall* aSOAPCall,
const nsAReadableString& aMethodName,
nsIWSDLOperation* aOperation,
WSPCallContext** aCallContext);
protected:
nsCOMPtr<WSPProxy> mProxy;
// nsCOMPtr<nsISOAPCall> mSOAPCall;
nsString mMethodName;
nsCOMPtr<nsIWSDLOperation> mOperation;
};
class WSPComplexTypeWrapper : public nsIPropertyBag
{
public:
WSPComplexTypeWrapper();
virtual ~WSPComplexTypeWrapper();
NS_DECL_ISUPPORTS
NS_DECL_NSIPROPERTYBAG
static nsresult Create(nsISupports* aComplexTypeInstance,
nsIInterfaceInfo* aInterfaceInfo,
WSPComplexTypeWrapper** aWrapper);
protected:
nsCOMPtr<nsISupports> mComplexTypeInstance;
nsCOMPtr<nsIInterfaceInfo> mInterfaceInfo;
};
class WSPPropertyBagWrapper : public nsXPTCStubBase
{
public:
WSPPropertyBagWrapper();
virtual ~WSPPropertyBagWrapper();
NS_DECL_ISUPPORTS
// Would be nice to have a NS_DECL_NSXPTCSTUBBASE
NS_IMETHOD CallMethod(PRUint16 methodIndex,
const nsXPTMethodInfo* info,
nsXPTCMiniVariant* params);
NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info);
static nsresult Create(nsIPropertyBag* aPropertyBag,
nsIInterfaceInfo* aInterfaceInfo,
WSPPropertyBagWrapper** aWrapper);
protected:
nsCOMPtr<nsIPropertyBag> mPropertyBag;
nsCOMPtr<nsIInterfaceInfo> mInterfaceInfo;
};
#endif // __wspprivate_h__

Просмотреть файл

@ -0,0 +1,292 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (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.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Bandhauer (jband@netscape.com)
* Vidur Apparao (vidur@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIWSDL.idl"
#include "nsIEnumerator.idl"
#include "nsIException.idl"
%{ C++
#include "nsAWritableString.h"
%}
interface nsIWebServiceProxy;
interface nsIWebServiceProxyListener;
// XXX Should be replaced with an include
interface nsISOAPResponse;
interface nsISOAPParameter;
[scriptable, uuid(693611be-bb38-40e0-a98e-b46ff8a5bcca)]
interface nsIWebServiceProxyFactory : nsISupports {
/**
* Create a service proxy. Loading of the WSDL URL will occur
* in a synchronous manner. Calls to web service can be made as
* soon as this method completes.
*
* @param wsdlURL The URL of the WSDL service description. This
* description will be loaded and used as the basis
* for the service proxy.
* @param portname The name of the port of the service that this
* service proxy represents. Currently the port
* must represent a SOAP binding.
* @param qualifier The user-specified qualifier is incorporated into
* the names of XPCOM interfaces created for the
* service proxy. For C++ callers, this qualifier
* should be the same one used in creating the IDL
* used at compile time. Script callers need not
* specify a qualifier.
* @param isAsync If PR_TRUE, the method signatures of the service
* proxy represent an asynchronous calling convention.
* A callback instance must be registered with the proxy.
* A method call to a web service is only completed when
* the corresponding callback method is invoked.
* If PR_FALSE, the method signatures of the service
* proxy represent a synchronous callling convention.
* A method call to a web service is completed when the
* method call to the proxy returns.
*/
nsIWebServiceProxy createProxy(in AString wsdlURL, in AString portname,
in AString qualifier, in boolean isAsync);
/**
* Create a service proxy. Loading of the WSDL URL will occur
* in an asynchronous manner. Methods on the listener instance will
* be invoked when the proxy has been created. Any method invocations
* on the service proxy prior to asynchronous completion of the
* intialization step will fail. The caller is guaranteed that this
* method will return before the listener is invoked.
*
* @param wsdlURL The URL of the WSDL service description. This
* description will be loaded and used as the basis
* for the service proxy.
* @param portname The name of the port of the service that this
* service proxy represents. Currently the port
* must represent a SOAP binding.
* @param qualifier The user-specified qualifier is incorporated into
* the names of XPCOM interfaces created for the
* service proxy. For C++ callers, this qualifier
* should be the same one used in creating the IDL
* used at compile time. Script callers need not
* specify a qualifier.
* @param isAsync If PR_TRUE, the method signatures of the service
* proxy represent an asynchronous calling convention.
* A callback instance must be registered with the proxy.
* A method call to a web service is only completed when
* the corresponding callback method is invoked.
* If PR_FALSE, the method signatures of the service
* proxy represent a synchronous callling convention.
* A method call to a web service is completed when the
* method call to the proxy returns.
* @param listener The callback instance which will be invoked when
* the proxy is completely initialized.
*/
void createProxyAsync(in AString wsdlURL, in AString portname,
in AString qualifier, in boolean isAsync,
in nsIWebServiceProxyListener listener);
};
[scriptable, uuid(2122421c-1326-41db-87f8-25519d8a12cb)]
interface nsIWebServiceProxy : nsISupports {
/**
* The WSDL port that this service proxy represents.
*
* @see nsIWSDLPort
*/
readonly attribute nsIWSDLPort port;
/**
* PR_TRUE if the service proxy methods represent an asynchronous
* calling convention. PR_FALSE if the methods are synchronous.
*/
readonly attribute boolean isAsync;
/**
* The qualifier used for interface names related to
* this service proxy.
*/
readonly attribute AString qualifier;
/**
* The collection of interfaces related to this service proxy. This
* will include the primary interface implemented by the service
* proxy as well as any listener or complex type interfaces required
* for method parameters and return values.
*/
// readonly attribute nsIXPCComponents_Interfaces interfaces;
/**
* An enumerator that returns the set of pending calls for the
* service proxy. Each call is an instance of the
* <code>nsIWebServiceCallContext</code> interface.
*
* @see nsIWebServiceCallContext
*/
readonly attribute nsISimpleEnumerator pendingCalls;
};
/**
* This interface should be implemented by a user who creates
* a web service proxy in an asynchronous manner. An instance
* of this interface is passed into the <code>initAsync</code>
* method of the proxy.
*/
[scriptable, uuid(a711250b-47da-4f16-a1fd-593de16375a1)]
interface nsIWebServiceProxyListener : nsISupports {
/**
* Invoked when the proxy is completely initialized. Method
* calls on the proxy can be made once this method is called.
*
* @param proxy The initialized web service proxy
*/
void onLoad(in nsIWebServiceProxy proxy);
/**
* Invoked if an error occurs during web service proxy
* initialization. This error code be a result of attempting
* to load the specified WSDL URL or a result of processing
* the WSDL and creating the interface information for the
* proxy.
*
* @param error The exception generated as a result of the
* error. This object can be introspected
* for further information.
*/
void onError(in nsIException error);
};
/**
* A representation of a method invocation on a web service.
* An instance of this interface is returned as a result of making
* an asynchronous call and can be queried for status of the
* call.
*/
[scriptable, uuid(87d87900-f102-4a15-b345-7b77a49d2df2)]
interface nsIWebServiceCallContext : nsISupports {
/**
* Possible values of the <code>status</code> attribute. A pending
* call has a status of PENDING. A completed call has a status of
* SUCCEEDED or FAILED depending on the result of the call.
*/
const PRUint32 PENDING = 0;
const PRUint32 SUCCEEDED = 1;
const PRUint32 FAILED = 2;
const PRUint32 ABORTED = 3;
/**
* The proxy object on which the call was made.
*
* @see nsIWebServiceProxy
*/
readonly attribute nsIWebServiceProxy proxy;
/**
* The name of the method that was invoked.
*/
readonly attribute AString methodName;
/**
* The status of the call, whether pending, completed successfully
* or completed with a fault.
*/
readonly attribute PRUint32 status;
/**
* The exception generated by the call if the status is FAILURE.
* The exception object can be introspected for more information.
* The <code>data</code> member can be QIed to a
* <code>nsISOAPFault</code> instance for calls that use a
* SOAP binding.
*/
readonly attribute nsIException pendingException;
/**
* The WSDL operation that correpsonds to the method being invoked.
*
* @see nsIWSDLOperation
*/
readonly attribute nsIWSDLOperation operation;
/**
* For users who want access to the lower-level constructs that
* are used for the method invocation, this attributes provides
* the SOAP response once the call has completed.
*
* @see nsISOAPResponse
*/
readonly attribute nsISOAPResponse soapResponse;
/**
* For user who want access to the lower-level constructs that
* are used for the method invocation, this method provides
* the SOAP parameters that were passed to the lower-level API.
*
* @see nsISOAPParameter
* @param paramCount The number of parameters in the array.
* @param params The array of parameters passed to the
* lower-level API.
*/
void getParameters(out PRUint32 paramCount, [retval, array, size_is(paramCount)] out nsISOAPParameter params);
/**
* For user who want access to the lower-level constructs that
* are used for the method invocation, this method provides
* the SOAP parameters that were returned from the call
* to the lower-level API. This list is only available after
* the call completes successfully.
*
* @see nsISOAPParameter
* @param resultCount The number of results in the array.
* @param results The array of results returned from the
* lower-level API.
*/
void getResults(out PRUint32 resultCount, [retval, array, size_is(resultCount)] out nsISOAPParameter results);
/**
* Called to abort a pending call. If the call is still pending,
* its callback instance's <code>onError</code> will be invoked,
* passing in the specified exception.
*
* @param error The exception passed to the callback instance's
* <code>onError</code> method.
*/
void abort(in nsIException error);
};

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,36 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = xmlextras
XPIDL_MODULE = wsproxy
XPIDLSRCS = \
nsIWebServiceProxy.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,30 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (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.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..\..\..
XPIDLSRCS = .\nsIWebServiceProxy.idl \
$(NULL)
MODULE=xmlextras
XPIDL_MODULE=wsproxy
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -0,0 +1,292 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (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.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Bandhauer (jband@netscape.com)
* Vidur Apparao (vidur@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIWSDL.idl"
#include "nsIEnumerator.idl"
#include "nsIException.idl"
%{ C++
#include "nsAWritableString.h"
%}
interface nsIWebServiceProxy;
interface nsIWebServiceProxyListener;
// XXX Should be replaced with an include
interface nsISOAPResponse;
interface nsISOAPParameter;
[scriptable, uuid(693611be-bb38-40e0-a98e-b46ff8a5bcca)]
interface nsIWebServiceProxyFactory : nsISupports {
/**
* Create a service proxy. Loading of the WSDL URL will occur
* in a synchronous manner. Calls to web service can be made as
* soon as this method completes.
*
* @param wsdlURL The URL of the WSDL service description. This
* description will be loaded and used as the basis
* for the service proxy.
* @param portname The name of the port of the service that this
* service proxy represents. Currently the port
* must represent a SOAP binding.
* @param qualifier The user-specified qualifier is incorporated into
* the names of XPCOM interfaces created for the
* service proxy. For C++ callers, this qualifier
* should be the same one used in creating the IDL
* used at compile time. Script callers need not
* specify a qualifier.
* @param isAsync If PR_TRUE, the method signatures of the service
* proxy represent an asynchronous calling convention.
* A callback instance must be registered with the proxy.
* A method call to a web service is only completed when
* the corresponding callback method is invoked.
* If PR_FALSE, the method signatures of the service
* proxy represent a synchronous callling convention.
* A method call to a web service is completed when the
* method call to the proxy returns.
*/
nsIWebServiceProxy createProxy(in AString wsdlURL, in AString portname,
in AString qualifier, in boolean isAsync);
/**
* Create a service proxy. Loading of the WSDL URL will occur
* in an asynchronous manner. Methods on the listener instance will
* be invoked when the proxy has been created. Any method invocations
* on the service proxy prior to asynchronous completion of the
* intialization step will fail. The caller is guaranteed that this
* method will return before the listener is invoked.
*
* @param wsdlURL The URL of the WSDL service description. This
* description will be loaded and used as the basis
* for the service proxy.
* @param portname The name of the port of the service that this
* service proxy represents. Currently the port
* must represent a SOAP binding.
* @param qualifier The user-specified qualifier is incorporated into
* the names of XPCOM interfaces created for the
* service proxy. For C++ callers, this qualifier
* should be the same one used in creating the IDL
* used at compile time. Script callers need not
* specify a qualifier.
* @param isAsync If PR_TRUE, the method signatures of the service
* proxy represent an asynchronous calling convention.
* A callback instance must be registered with the proxy.
* A method call to a web service is only completed when
* the corresponding callback method is invoked.
* If PR_FALSE, the method signatures of the service
* proxy represent a synchronous callling convention.
* A method call to a web service is completed when the
* method call to the proxy returns.
* @param listener The callback instance which will be invoked when
* the proxy is completely initialized.
*/
void createProxyAsync(in AString wsdlURL, in AString portname,
in AString qualifier, in boolean isAsync,
in nsIWebServiceProxyListener listener);
};
[scriptable, uuid(2122421c-1326-41db-87f8-25519d8a12cb)]
interface nsIWebServiceProxy : nsISupports {
/**
* The WSDL port that this service proxy represents.
*
* @see nsIWSDLPort
*/
readonly attribute nsIWSDLPort port;
/**
* PR_TRUE if the service proxy methods represent an asynchronous
* calling convention. PR_FALSE if the methods are synchronous.
*/
readonly attribute boolean isAsync;
/**
* The qualifier used for interface names related to
* this service proxy.
*/
readonly attribute AString qualifier;
/**
* The collection of interfaces related to this service proxy. This
* will include the primary interface implemented by the service
* proxy as well as any listener or complex type interfaces required
* for method parameters and return values.
*/
// readonly attribute nsIXPCComponents_Interfaces interfaces;
/**
* An enumerator that returns the set of pending calls for the
* service proxy. Each call is an instance of the
* <code>nsIWebServiceCallContext</code> interface.
*
* @see nsIWebServiceCallContext
*/
readonly attribute nsISimpleEnumerator pendingCalls;
};
/**
* This interface should be implemented by a user who creates
* a web service proxy in an asynchronous manner. An instance
* of this interface is passed into the <code>initAsync</code>
* method of the proxy.
*/
[scriptable, uuid(a711250b-47da-4f16-a1fd-593de16375a1)]
interface nsIWebServiceProxyListener : nsISupports {
/**
* Invoked when the proxy is completely initialized. Method
* calls on the proxy can be made once this method is called.
*
* @param proxy The initialized web service proxy
*/
void onLoad(in nsIWebServiceProxy proxy);
/**
* Invoked if an error occurs during web service proxy
* initialization. This error code be a result of attempting
* to load the specified WSDL URL or a result of processing
* the WSDL and creating the interface information for the
* proxy.
*
* @param error The exception generated as a result of the
* error. This object can be introspected
* for further information.
*/
void onError(in nsIException error);
};
/**
* A representation of a method invocation on a web service.
* An instance of this interface is returned as a result of making
* an asynchronous call and can be queried for status of the
* call.
*/
[scriptable, uuid(87d87900-f102-4a15-b345-7b77a49d2df2)]
interface nsIWebServiceCallContext : nsISupports {
/**
* Possible values of the <code>status</code> attribute. A pending
* call has a status of PENDING. A completed call has a status of
* SUCCEEDED or FAILED depending on the result of the call.
*/
const PRUint32 PENDING = 0;
const PRUint32 SUCCEEDED = 1;
const PRUint32 FAILED = 2;
const PRUint32 ABORTED = 3;
/**
* The proxy object on which the call was made.
*
* @see nsIWebServiceProxy
*/
readonly attribute nsIWebServiceProxy proxy;
/**
* The name of the method that was invoked.
*/
readonly attribute AString methodName;
/**
* The status of the call, whether pending, completed successfully
* or completed with a fault.
*/
readonly attribute PRUint32 status;
/**
* The exception generated by the call if the status is FAILURE.
* The exception object can be introspected for more information.
* The <code>data</code> member can be QIed to a
* <code>nsISOAPFault</code> instance for calls that use a
* SOAP binding.
*/
readonly attribute nsIException pendingException;
/**
* The WSDL operation that correpsonds to the method being invoked.
*
* @see nsIWSDLOperation
*/
readonly attribute nsIWSDLOperation operation;
/**
* For users who want access to the lower-level constructs that
* are used for the method invocation, this attributes provides
* the SOAP response once the call has completed.
*
* @see nsISOAPResponse
*/
readonly attribute nsISOAPResponse soapResponse;
/**
* For user who want access to the lower-level constructs that
* are used for the method invocation, this method provides
* the SOAP parameters that were passed to the lower-level API.
*
* @see nsISOAPParameter
* @param paramCount The number of parameters in the array.
* @param params The array of parameters passed to the
* lower-level API.
*/
void getParameters(out PRUint32 paramCount, [retval, array, size_is(paramCount)] out nsISOAPParameter params);
/**
* For user who want access to the lower-level constructs that
* are used for the method invocation, this method provides
* the SOAP parameters that were returned from the call
* to the lower-level API. This list is only available after
* the call completes successfully.
*
* @see nsISOAPParameter
* @param resultCount The number of results in the array.
* @param results The array of results returned from the
* lower-level API.
*/
void getResults(out PRUint32 resultCount, [retval, array, size_is(resultCount)] out nsISOAPParameter results);
/**
* Called to abort a pending call. If the call is still pending,
* its callback instance's <code>onError</code> will be invoked,
* passing in the specified exception.
*
* @param error The exception passed to the callback instance's
* <code>onError</code> method.
*/
void abort(in nsIException error);
};

Просмотреть файл

@ -0,0 +1,54 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (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.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..\..\..
LIBRARY_NAME=xmlextrasproxy_s
MODULE=xmlextras
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
REQUIRES = xpcom \
string \
xpconnect \
caps \
js \
necko \
$(NULL)
CPPSRCS= \
wspProxy.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\wspProxy.obj \
$(NULL)
EXPORTS = \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

Просмотреть файл

@ -0,0 +1,165 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (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.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Bandhauer (jband@netscape.com)
* Vidur Apparao (vidur@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __wspprivate_h__
#define __wspprivate_h__
#include "nsIWebServiceProxy.h"
#include "nsIWSDL.h"
// interface info includes
#include "xptcall.h"
#include "nsIInterfaceInfo.h"
// XPCOM includes
#include "nsCOMPtr.h"
#include "nsSupportsArray.h"
#include "nsIPropertyBag.h"
class nsISOAPCall;
class nsISOAPResponse;
class nsISOAPParameter;
class WSPFactory : public nsIWebServiceProxyFactory
{
public:
WSPFactory();
virtual ~WSPFactory();
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBSERVICEPROXYFACTORY
};
class WSPProxy : public nsXPTCStubBase,
public nsIWebServiceProxy,
public nsIClassInfo
{
public:
WSPProxy();
virtual ~WSPProxy();
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBSERVICEPROXY
NS_DECL_NSICLASSINFO
// Would be nice to have a NS_DECL_NSXPTCSTUBBASE
NS_IMETHOD CallMethod(PRUint16 methodIndex,
const nsXPTMethodInfo* info,
nsXPTCMiniVariant* params);
NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info);
static nsresult Create(nsIWSDLPort* aPort,
nsIInterfaceInfo* aPrimaryInterface,
const nsAReadableString& aNamespace,
PRBool aIsAsync, WSPProxy** aProxy);
protected:
nsCOMPtr<nsIWSDLPort> mPort;
nsCOMPtr<nsIInterfaceInfo> mPrimaryInterface;
nsString mNamespace;
PRBool mIsAsync;
nsSupportsArray mPendingCalls;
};
class WSPCallContext : public nsIWebServiceCallContext
// public nsISOAPResponseListener
{
public:
WSPCallContext();
virtual ~WSPCallContext();
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBSERVICECALLCONTEXT
static nsresult Create(WSPProxy* aProxy,
nsISOAPCall* aSOAPCall,
const nsAReadableString& aMethodName,
nsIWSDLOperation* aOperation,
WSPCallContext** aCallContext);
protected:
nsCOMPtr<WSPProxy> mProxy;
// nsCOMPtr<nsISOAPCall> mSOAPCall;
nsString mMethodName;
nsCOMPtr<nsIWSDLOperation> mOperation;
};
class WSPComplexTypeWrapper : public nsIPropertyBag
{
public:
WSPComplexTypeWrapper();
virtual ~WSPComplexTypeWrapper();
NS_DECL_ISUPPORTS
NS_DECL_NSIPROPERTYBAG
static nsresult Create(nsISupports* aComplexTypeInstance,
nsIInterfaceInfo* aInterfaceInfo,
WSPComplexTypeWrapper** aWrapper);
protected:
nsCOMPtr<nsISupports> mComplexTypeInstance;
nsCOMPtr<nsIInterfaceInfo> mInterfaceInfo;
};
class WSPPropertyBagWrapper : public nsXPTCStubBase
{
public:
WSPPropertyBagWrapper();
virtual ~WSPPropertyBagWrapper();
NS_DECL_ISUPPORTS
// Would be nice to have a NS_DECL_NSXPTCSTUBBASE
NS_IMETHOD CallMethod(PRUint16 methodIndex,
const nsXPTMethodInfo* info,
nsXPTCMiniVariant* params);
NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info);
static nsresult Create(nsIPropertyBag* aPropertyBag,
nsIInterfaceInfo* aInterfaceInfo,
WSPPropertyBagWrapper** aWrapper);
protected:
nsCOMPtr<nsIPropertyBag> mPropertyBag;
nsCOMPtr<nsIInterfaceInfo> mInterfaceInfo;
};
#endif // __wspprivate_h__