not part of build. Fix line endings

This commit is contained in:
jband%netscape.com 2001-10-10 02:13:25 +00:00
Родитель 0bf39d4052
Коммит b1510adad5
9 изменённых файлов: 3786 добавлений и 3786 удалений

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

@ -1,165 +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__
/* -*- 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__

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

@ -1,292 +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);
};
/* -*- 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);
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,211 +1,211 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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.
*
* The Initial Developer of the Original Code is Netscape
* Communications. Portions created by Netscape Communications are
* Copyright (C) 2001 by Netscape Communications. All
* Rights Reserved.
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
#ifndef __nsWSDLLoader_h__
#define __nsWSDLLoader_h__
#include "nsIWSDLLoader.h"
#include "nsWSDLPrivate.h"
#include "nsDOMUtils.h"
// XPCOM Includes
#include "nsCOMPtr.h"
#include "nsSupportsArray.h"
#include "nsString.h"
#include "nsIAtom.h"
#include "nsHashtable.h"
#include "nsError.h"
// Loading includes
#include "nsIURI.h"
#include "nsIXMLHTTPRequest.h"
#include "nsIDOMEventListener.h"
// schema includes
#include "nsISchemaLoader.h"
// DOM includes
#include "nsIDOMDocument.h"
#define NS_ERROR_WSDL_LOADPENDING NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 1)
class nsWSDLAtoms {
public:
static void CreateWSDLAtoms();
static void DestroyWSDLAtoms();
static nsIAtom* sDefinitions_atom;
static nsIAtom* sTypes_atom;
static nsIAtom* sMessage_atom;
static nsIAtom* sPortType_atom;
static nsIAtom* sBinding_atom;
static nsIAtom* sService_atom;
static nsIAtom* sPort_atom;
static nsIAtom* sOperation_atom;
static nsIAtom* sPart_atom;
static nsIAtom* sDocumentation_atom;
static nsIAtom* sImport_atom;
static nsIAtom* sInput_atom;
static nsIAtom* sOutput_atom;
static nsIAtom* sFault_atom;
static nsIAtom* sBody_atom;
static nsIAtom* sHeader_atom;
static nsIAtom* sHeaderFault_atom;
static nsIAtom* sAddress_atom;
};
class nsWSDLLoader : public nsIWSDLLoader {
public:
nsWSDLLoader();
virtual ~nsWSDLLoader();
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLLOADER
protected:
nsresult GetResolvedURI(const nsAReadableString& aSchemaURI,
const char* aMethod,
nsIURI** aURI);
protected:
nsWSDLPort* mPort;
};
class nsWSDLLoadingContext {
public:
nsWSDLLoadingContext(nsIDOMDocument* aDocument,
const nsAReadableString& aLocation) :
mDocument(aDocument), mChildIndex(0), mDocumentLocation(aLocation) {
}
~nsWSDLLoadingContext() {
}
void GetRootElement(nsIDOMElement** aElement) {
mDocument->GetDocumentElement(aElement);
}
PRUint32 GetChildIndex() { return mChildIndex; }
void SetChildIndex(PRUint32 aChildIndex) { mChildIndex = aChildIndex; }
void GetTargetNamespace(nsAWritableString& aNamespace) {
nsCOMPtr<nsIDOMElement> element;
GetRootElement(getter_AddRefs(element));
if (element) {
element->GetAttribute(NS_LITERAL_STRING("targetNamespace"),
aNamespace);
}
else {
aNamespace.Truncate();
}
}
void GetDocumentLocation(nsAWritableString& aLocation) {
aLocation.Assign(mDocumentLocation);
}
protected:
// XXX hold onto the document till issues related to dangling
// document pointers in content are fixed. After that, just
// hold onto the root element.
nsCOMPtr<nsIDOMDocument> mDocument;
PRUint32 mChildIndex;
nsString mDocumentLocation;
};
class nsWSDLLoadRequest : public nsIDOMEventListener
{
public:
nsWSDLLoadRequest(PRBool aIsSync,
nsIWSDLLoadListener* aListener,
const nsAReadableString& aPortName);
virtual ~nsWSDLLoadRequest();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
nsresult LoadDefinition(const nsAReadableString& aURI);
nsresult ResumeProcessing();
nsresult ContineProcessingTillDone();
nsresult GetPort(nsIWSDLPort** aPort);
nsresult PushContext(nsIDOMDocument* aDocument,
const nsAReadableString& aLocation);
nsWSDLLoadingContext* GetCurrentContext();
void PopContext();
nsresult GetSchemaElement(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsISchemaElement** aSchemaComponent);
nsresult GetSchemaType(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsISchemaType** aSchemaComponent);
nsresult GetMessage(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsIWSDLMessage** aMessage);
nsresult GetPortType(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsIWSDLPort** aPort);
nsresult ProcessImportElement(nsIDOMElement* aElement,
PRUint32 aIndex);
nsresult ProcessTypesElement(nsIDOMElement* aElement);
nsresult ProcessMessageElement(nsIDOMElement* aElement);
nsresult ProcessAbstractPartElement(nsIDOMElement* aElement,
nsWSDLMessage* aMessage);
nsresult ProcessPortTypeElement(nsIDOMElement* aElement);
nsresult ProcessAbstractOperation(nsIDOMElement* aElement,
nsWSDLPort* aPort);
nsresult ProcessOperationComponent(nsIDOMElement* aElement,
nsIWSDLMessage** aMessage);
nsresult ProcessMessageBinding(nsIDOMElement* aElement,
nsIWSDLMessage* aMessage);
nsresult ProcessOperationBinding(nsIDOMElement* aElement,
nsIWSDLPort* aPort);
nsresult ProcessBindingElement(nsIDOMElement* aElement);
nsresult ProcessPortBinding(nsIDOMElement* aElement);
nsresult ProcessServiceElement(nsIDOMElement* aElement);
protected:
nsCOMPtr<nsIWSDLLoadListener> mListener;
nsCOMPtr<nsIXMLHttpRequest> mRequest;
nsCOMPtr<nsISchemaLoader> mSchemaLoader;
PRBool mIsSync;
nsCOMPtr<nsIWSDLPort> mPort;
nsString mPortName;
nsString mBindingName;
nsString mBindingNamespace;
nsString mAddress;
nsVoidArray mContextStack;
nsSupportsHashtable mTypes;
nsSupportsHashtable mMessages;
nsSupportsHashtable mPortTypes;
};
#endif // __nsWSDLLoader_h__
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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.
*
* The Initial Developer of the Original Code is Netscape
* Communications. Portions created by Netscape Communications are
* Copyright (C) 2001 by Netscape Communications. All
* Rights Reserved.
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
#ifndef __nsWSDLLoader_h__
#define __nsWSDLLoader_h__
#include "nsIWSDLLoader.h"
#include "nsWSDLPrivate.h"
#include "nsDOMUtils.h"
// XPCOM Includes
#include "nsCOMPtr.h"
#include "nsSupportsArray.h"
#include "nsString.h"
#include "nsIAtom.h"
#include "nsHashtable.h"
#include "nsError.h"
// Loading includes
#include "nsIURI.h"
#include "nsIXMLHTTPRequest.h"
#include "nsIDOMEventListener.h"
// schema includes
#include "nsISchemaLoader.h"
// DOM includes
#include "nsIDOMDocument.h"
#define NS_ERROR_WSDL_LOADPENDING NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 1)
class nsWSDLAtoms {
public:
static void CreateWSDLAtoms();
static void DestroyWSDLAtoms();
static nsIAtom* sDefinitions_atom;
static nsIAtom* sTypes_atom;
static nsIAtom* sMessage_atom;
static nsIAtom* sPortType_atom;
static nsIAtom* sBinding_atom;
static nsIAtom* sService_atom;
static nsIAtom* sPort_atom;
static nsIAtom* sOperation_atom;
static nsIAtom* sPart_atom;
static nsIAtom* sDocumentation_atom;
static nsIAtom* sImport_atom;
static nsIAtom* sInput_atom;
static nsIAtom* sOutput_atom;
static nsIAtom* sFault_atom;
static nsIAtom* sBody_atom;
static nsIAtom* sHeader_atom;
static nsIAtom* sHeaderFault_atom;
static nsIAtom* sAddress_atom;
};
class nsWSDLLoader : public nsIWSDLLoader {
public:
nsWSDLLoader();
virtual ~nsWSDLLoader();
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLLOADER
protected:
nsresult GetResolvedURI(const nsAReadableString& aSchemaURI,
const char* aMethod,
nsIURI** aURI);
protected:
nsWSDLPort* mPort;
};
class nsWSDLLoadingContext {
public:
nsWSDLLoadingContext(nsIDOMDocument* aDocument,
const nsAReadableString& aLocation) :
mDocument(aDocument), mChildIndex(0), mDocumentLocation(aLocation) {
}
~nsWSDLLoadingContext() {
}
void GetRootElement(nsIDOMElement** aElement) {
mDocument->GetDocumentElement(aElement);
}
PRUint32 GetChildIndex() { return mChildIndex; }
void SetChildIndex(PRUint32 aChildIndex) { mChildIndex = aChildIndex; }
void GetTargetNamespace(nsAWritableString& aNamespace) {
nsCOMPtr<nsIDOMElement> element;
GetRootElement(getter_AddRefs(element));
if (element) {
element->GetAttribute(NS_LITERAL_STRING("targetNamespace"),
aNamespace);
}
else {
aNamespace.Truncate();
}
}
void GetDocumentLocation(nsAWritableString& aLocation) {
aLocation.Assign(mDocumentLocation);
}
protected:
// XXX hold onto the document till issues related to dangling
// document pointers in content are fixed. After that, just
// hold onto the root element.
nsCOMPtr<nsIDOMDocument> mDocument;
PRUint32 mChildIndex;
nsString mDocumentLocation;
};
class nsWSDLLoadRequest : public nsIDOMEventListener
{
public:
nsWSDLLoadRequest(PRBool aIsSync,
nsIWSDLLoadListener* aListener,
const nsAReadableString& aPortName);
virtual ~nsWSDLLoadRequest();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
nsresult LoadDefinition(const nsAReadableString& aURI);
nsresult ResumeProcessing();
nsresult ContineProcessingTillDone();
nsresult GetPort(nsIWSDLPort** aPort);
nsresult PushContext(nsIDOMDocument* aDocument,
const nsAReadableString& aLocation);
nsWSDLLoadingContext* GetCurrentContext();
void PopContext();
nsresult GetSchemaElement(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsISchemaElement** aSchemaComponent);
nsresult GetSchemaType(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsISchemaType** aSchemaComponent);
nsresult GetMessage(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsIWSDLMessage** aMessage);
nsresult GetPortType(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsIWSDLPort** aPort);
nsresult ProcessImportElement(nsIDOMElement* aElement,
PRUint32 aIndex);
nsresult ProcessTypesElement(nsIDOMElement* aElement);
nsresult ProcessMessageElement(nsIDOMElement* aElement);
nsresult ProcessAbstractPartElement(nsIDOMElement* aElement,
nsWSDLMessage* aMessage);
nsresult ProcessPortTypeElement(nsIDOMElement* aElement);
nsresult ProcessAbstractOperation(nsIDOMElement* aElement,
nsWSDLPort* aPort);
nsresult ProcessOperationComponent(nsIDOMElement* aElement,
nsIWSDLMessage** aMessage);
nsresult ProcessMessageBinding(nsIDOMElement* aElement,
nsIWSDLMessage* aMessage);
nsresult ProcessOperationBinding(nsIDOMElement* aElement,
nsIWSDLPort* aPort);
nsresult ProcessBindingElement(nsIDOMElement* aElement);
nsresult ProcessPortBinding(nsIDOMElement* aElement);
nsresult ProcessServiceElement(nsIDOMElement* aElement);
protected:
nsCOMPtr<nsIWSDLLoadListener> mListener;
nsCOMPtr<nsIXMLHttpRequest> mRequest;
nsCOMPtr<nsISchemaLoader> mSchemaLoader;
PRBool mIsSync;
nsCOMPtr<nsIWSDLPort> mPort;
nsString mPortName;
nsString mBindingName;
nsString mBindingNamespace;
nsString mAddress;
nsVoidArray mContextStack;
nsSupportsHashtable mTypes;
nsSupportsHashtable mMessages;
nsSupportsHashtable mPortTypes;
};
#endif // __nsWSDLLoader_h__

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

@ -1,292 +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);
};
/* -*- 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);
};

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

@ -1,165 +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__
/* -*- 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__

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,211 +1,211 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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.
*
* The Initial Developer of the Original Code is Netscape
* Communications. Portions created by Netscape Communications are
* Copyright (C) 2001 by Netscape Communications. All
* Rights Reserved.
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
#ifndef __nsWSDLLoader_h__
#define __nsWSDLLoader_h__
#include "nsIWSDLLoader.h"
#include "nsWSDLPrivate.h"
#include "nsDOMUtils.h"
// XPCOM Includes
#include "nsCOMPtr.h"
#include "nsSupportsArray.h"
#include "nsString.h"
#include "nsIAtom.h"
#include "nsHashtable.h"
#include "nsError.h"
// Loading includes
#include "nsIURI.h"
#include "nsIXMLHTTPRequest.h"
#include "nsIDOMEventListener.h"
// schema includes
#include "nsISchemaLoader.h"
// DOM includes
#include "nsIDOMDocument.h"
#define NS_ERROR_WSDL_LOADPENDING NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 1)
class nsWSDLAtoms {
public:
static void CreateWSDLAtoms();
static void DestroyWSDLAtoms();
static nsIAtom* sDefinitions_atom;
static nsIAtom* sTypes_atom;
static nsIAtom* sMessage_atom;
static nsIAtom* sPortType_atom;
static nsIAtom* sBinding_atom;
static nsIAtom* sService_atom;
static nsIAtom* sPort_atom;
static nsIAtom* sOperation_atom;
static nsIAtom* sPart_atom;
static nsIAtom* sDocumentation_atom;
static nsIAtom* sImport_atom;
static nsIAtom* sInput_atom;
static nsIAtom* sOutput_atom;
static nsIAtom* sFault_atom;
static nsIAtom* sBody_atom;
static nsIAtom* sHeader_atom;
static nsIAtom* sHeaderFault_atom;
static nsIAtom* sAddress_atom;
};
class nsWSDLLoader : public nsIWSDLLoader {
public:
nsWSDLLoader();
virtual ~nsWSDLLoader();
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLLOADER
protected:
nsresult GetResolvedURI(const nsAReadableString& aSchemaURI,
const char* aMethod,
nsIURI** aURI);
protected:
nsWSDLPort* mPort;
};
class nsWSDLLoadingContext {
public:
nsWSDLLoadingContext(nsIDOMDocument* aDocument,
const nsAReadableString& aLocation) :
mDocument(aDocument), mChildIndex(0), mDocumentLocation(aLocation) {
}
~nsWSDLLoadingContext() {
}
void GetRootElement(nsIDOMElement** aElement) {
mDocument->GetDocumentElement(aElement);
}
PRUint32 GetChildIndex() { return mChildIndex; }
void SetChildIndex(PRUint32 aChildIndex) { mChildIndex = aChildIndex; }
void GetTargetNamespace(nsAWritableString& aNamespace) {
nsCOMPtr<nsIDOMElement> element;
GetRootElement(getter_AddRefs(element));
if (element) {
element->GetAttribute(NS_LITERAL_STRING("targetNamespace"),
aNamespace);
}
else {
aNamespace.Truncate();
}
}
void GetDocumentLocation(nsAWritableString& aLocation) {
aLocation.Assign(mDocumentLocation);
}
protected:
// XXX hold onto the document till issues related to dangling
// document pointers in content are fixed. After that, just
// hold onto the root element.
nsCOMPtr<nsIDOMDocument> mDocument;
PRUint32 mChildIndex;
nsString mDocumentLocation;
};
class nsWSDLLoadRequest : public nsIDOMEventListener
{
public:
nsWSDLLoadRequest(PRBool aIsSync,
nsIWSDLLoadListener* aListener,
const nsAReadableString& aPortName);
virtual ~nsWSDLLoadRequest();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
nsresult LoadDefinition(const nsAReadableString& aURI);
nsresult ResumeProcessing();
nsresult ContineProcessingTillDone();
nsresult GetPort(nsIWSDLPort** aPort);
nsresult PushContext(nsIDOMDocument* aDocument,
const nsAReadableString& aLocation);
nsWSDLLoadingContext* GetCurrentContext();
void PopContext();
nsresult GetSchemaElement(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsISchemaElement** aSchemaComponent);
nsresult GetSchemaType(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsISchemaType** aSchemaComponent);
nsresult GetMessage(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsIWSDLMessage** aMessage);
nsresult GetPortType(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsIWSDLPort** aPort);
nsresult ProcessImportElement(nsIDOMElement* aElement,
PRUint32 aIndex);
nsresult ProcessTypesElement(nsIDOMElement* aElement);
nsresult ProcessMessageElement(nsIDOMElement* aElement);
nsresult ProcessAbstractPartElement(nsIDOMElement* aElement,
nsWSDLMessage* aMessage);
nsresult ProcessPortTypeElement(nsIDOMElement* aElement);
nsresult ProcessAbstractOperation(nsIDOMElement* aElement,
nsWSDLPort* aPort);
nsresult ProcessOperationComponent(nsIDOMElement* aElement,
nsIWSDLMessage** aMessage);
nsresult ProcessMessageBinding(nsIDOMElement* aElement,
nsIWSDLMessage* aMessage);
nsresult ProcessOperationBinding(nsIDOMElement* aElement,
nsIWSDLPort* aPort);
nsresult ProcessBindingElement(nsIDOMElement* aElement);
nsresult ProcessPortBinding(nsIDOMElement* aElement);
nsresult ProcessServiceElement(nsIDOMElement* aElement);
protected:
nsCOMPtr<nsIWSDLLoadListener> mListener;
nsCOMPtr<nsIXMLHttpRequest> mRequest;
nsCOMPtr<nsISchemaLoader> mSchemaLoader;
PRBool mIsSync;
nsCOMPtr<nsIWSDLPort> mPort;
nsString mPortName;
nsString mBindingName;
nsString mBindingNamespace;
nsString mAddress;
nsVoidArray mContextStack;
nsSupportsHashtable mTypes;
nsSupportsHashtable mMessages;
nsSupportsHashtable mPortTypes;
};
#endif // __nsWSDLLoader_h__
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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.
*
* The Initial Developer of the Original Code is Netscape
* Communications. Portions created by Netscape Communications are
* Copyright (C) 2001 by Netscape Communications. All
* Rights Reserved.
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
#ifndef __nsWSDLLoader_h__
#define __nsWSDLLoader_h__
#include "nsIWSDLLoader.h"
#include "nsWSDLPrivate.h"
#include "nsDOMUtils.h"
// XPCOM Includes
#include "nsCOMPtr.h"
#include "nsSupportsArray.h"
#include "nsString.h"
#include "nsIAtom.h"
#include "nsHashtable.h"
#include "nsError.h"
// Loading includes
#include "nsIURI.h"
#include "nsIXMLHTTPRequest.h"
#include "nsIDOMEventListener.h"
// schema includes
#include "nsISchemaLoader.h"
// DOM includes
#include "nsIDOMDocument.h"
#define NS_ERROR_WSDL_LOADPENDING NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 1)
class nsWSDLAtoms {
public:
static void CreateWSDLAtoms();
static void DestroyWSDLAtoms();
static nsIAtom* sDefinitions_atom;
static nsIAtom* sTypes_atom;
static nsIAtom* sMessage_atom;
static nsIAtom* sPortType_atom;
static nsIAtom* sBinding_atom;
static nsIAtom* sService_atom;
static nsIAtom* sPort_atom;
static nsIAtom* sOperation_atom;
static nsIAtom* sPart_atom;
static nsIAtom* sDocumentation_atom;
static nsIAtom* sImport_atom;
static nsIAtom* sInput_atom;
static nsIAtom* sOutput_atom;
static nsIAtom* sFault_atom;
static nsIAtom* sBody_atom;
static nsIAtom* sHeader_atom;
static nsIAtom* sHeaderFault_atom;
static nsIAtom* sAddress_atom;
};
class nsWSDLLoader : public nsIWSDLLoader {
public:
nsWSDLLoader();
virtual ~nsWSDLLoader();
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLLOADER
protected:
nsresult GetResolvedURI(const nsAReadableString& aSchemaURI,
const char* aMethod,
nsIURI** aURI);
protected:
nsWSDLPort* mPort;
};
class nsWSDLLoadingContext {
public:
nsWSDLLoadingContext(nsIDOMDocument* aDocument,
const nsAReadableString& aLocation) :
mDocument(aDocument), mChildIndex(0), mDocumentLocation(aLocation) {
}
~nsWSDLLoadingContext() {
}
void GetRootElement(nsIDOMElement** aElement) {
mDocument->GetDocumentElement(aElement);
}
PRUint32 GetChildIndex() { return mChildIndex; }
void SetChildIndex(PRUint32 aChildIndex) { mChildIndex = aChildIndex; }
void GetTargetNamespace(nsAWritableString& aNamespace) {
nsCOMPtr<nsIDOMElement> element;
GetRootElement(getter_AddRefs(element));
if (element) {
element->GetAttribute(NS_LITERAL_STRING("targetNamespace"),
aNamespace);
}
else {
aNamespace.Truncate();
}
}
void GetDocumentLocation(nsAWritableString& aLocation) {
aLocation.Assign(mDocumentLocation);
}
protected:
// XXX hold onto the document till issues related to dangling
// document pointers in content are fixed. After that, just
// hold onto the root element.
nsCOMPtr<nsIDOMDocument> mDocument;
PRUint32 mChildIndex;
nsString mDocumentLocation;
};
class nsWSDLLoadRequest : public nsIDOMEventListener
{
public:
nsWSDLLoadRequest(PRBool aIsSync,
nsIWSDLLoadListener* aListener,
const nsAReadableString& aPortName);
virtual ~nsWSDLLoadRequest();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
nsresult LoadDefinition(const nsAReadableString& aURI);
nsresult ResumeProcessing();
nsresult ContineProcessingTillDone();
nsresult GetPort(nsIWSDLPort** aPort);
nsresult PushContext(nsIDOMDocument* aDocument,
const nsAReadableString& aLocation);
nsWSDLLoadingContext* GetCurrentContext();
void PopContext();
nsresult GetSchemaElement(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsISchemaElement** aSchemaComponent);
nsresult GetSchemaType(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsISchemaType** aSchemaComponent);
nsresult GetMessage(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsIWSDLMessage** aMessage);
nsresult GetPortType(const nsAReadableString& aName,
const nsAReadableString& aNamespace,
nsIWSDLPort** aPort);
nsresult ProcessImportElement(nsIDOMElement* aElement,
PRUint32 aIndex);
nsresult ProcessTypesElement(nsIDOMElement* aElement);
nsresult ProcessMessageElement(nsIDOMElement* aElement);
nsresult ProcessAbstractPartElement(nsIDOMElement* aElement,
nsWSDLMessage* aMessage);
nsresult ProcessPortTypeElement(nsIDOMElement* aElement);
nsresult ProcessAbstractOperation(nsIDOMElement* aElement,
nsWSDLPort* aPort);
nsresult ProcessOperationComponent(nsIDOMElement* aElement,
nsIWSDLMessage** aMessage);
nsresult ProcessMessageBinding(nsIDOMElement* aElement,
nsIWSDLMessage* aMessage);
nsresult ProcessOperationBinding(nsIDOMElement* aElement,
nsIWSDLPort* aPort);
nsresult ProcessBindingElement(nsIDOMElement* aElement);
nsresult ProcessPortBinding(nsIDOMElement* aElement);
nsresult ProcessServiceElement(nsIDOMElement* aElement);
protected:
nsCOMPtr<nsIWSDLLoadListener> mListener;
nsCOMPtr<nsIXMLHttpRequest> mRequest;
nsCOMPtr<nsISchemaLoader> mSchemaLoader;
PRBool mIsSync;
nsCOMPtr<nsIWSDLPort> mPort;
nsString mPortName;
nsString mBindingName;
nsString mBindingNamespace;
nsString mAddress;
nsVoidArray mContextStack;
nsSupportsHashtable mTypes;
nsSupportsHashtable mMessages;
nsSupportsHashtable mPortTypes;
};
#endif // __nsWSDLLoader_h__