1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Netscape Public License
6
* Version 1.1 (the "License"); you may not use this file except in
7
* compliance with the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/NPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is mozilla.org code.
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 2001
20
* the Initial Developer. All Rights Reserved.
23
* Vidur Apparao (vidur@netscape.com) (Original author)
24
* John Bandhauer (jband@netscape.com)
27
* Alternatively, the contents of this file may be used under the terms of
28
* either the GNU General Public License Version 2 or later (the "GPL"), or
29
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30
* in which case the provisions of the GPL or the LGPL are applicable instead
31
* of those above. If you wish to allow use of your version of this file only
32
* under the terms of either the GPL or the LGPL, and not to allow others to
33
* use your version of this file under the terms of the NPL, indicate your
34
* decision by deleting the provisions above and replace them with the notice
35
* and other provisions required by the GPL or the LGPL. If you do not delete
36
* the provisions above, a recipient may use your version of this file under
37
* the terms of any one of the NPL, the GPL or the LGPL.
39
* ***** END LICENSE BLOCK ***** */
41
#ifndef __wspprivate_h__
42
#define __wspprivate_h__
46
#include "nsCOMArray.h"
47
#include "nsIPropertyBag.h"
48
#include "nsIException.h"
49
#include "nsIExceptionService.h"
50
#include "nsIServiceManager.h"
51
#include "nsAString.h"
54
#include "nsISOAPCall.h"
55
#include "nsISOAPResponse.h"
56
#include "nsISOAPResponseListener.h"
57
#include "nsISOAPCallCompletion.h"
58
#include "nsISOAPFault.h"
59
#include "nsSOAPUtils.h"
61
// interface info includes
63
#include "nsIInterfaceInfo.h"
67
#include "nsIWSDLLoader.h"
68
#include "nsIWSDLSOAPBinding.h"
71
#include "nsIGenericInterfaceInfoSet.h"
74
#include "nsIWebServiceProxy.h"
75
#include "nsIWSPInterfaceInfoService.h"
80
class WSPFactory : public nsIWebServiceProxyFactory
84
virtual ~WSPFactory();
87
NS_DECL_NSIWEBSERVICEPROXYFACTORY
89
static nsresult C2XML(const nsACString& aCIdentifier,
90
nsAString& aXMLIdentifier);
91
static void XML2C(const nsAString& aXMLIndentifier,
92
nsACString& aCIdentifier);
95
class WSPProxy : public nsXPTCStubBase,
96
public nsIWebServiceProxy,
104
NS_DECL_NSIWEBSERVICEPROXY
107
// Would be nice to have a NS_DECL_NSXPTCSTUBBASE
108
NS_IMETHOD CallMethod(PRUint16 methodIndex,
109
const nsXPTMethodInfo* info,
110
nsXPTCMiniVariant* params);
111
NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info);
113
void GetListenerInterfaceInfo(nsIInterfaceInfo** aInfo);
114
void CallCompleted(WSPCallContext* aContext);
117
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
119
static nsresult XPTCMiniVariantToVariant(uint8 aTypeTag,
120
nsXPTCMiniVariant aResult,
121
nsIInterfaceInfo* aInterfaceInfo,
122
nsIVariant** aVariant);
123
static nsresult ArrayXPTCMiniVariantToVariant(uint8 aTypeTag,
124
nsXPTCMiniVariant aResult,
126
nsIInterfaceInfo* aIfaceInfo,
127
nsIVariant** aVariant);
129
static nsresult VariantToValue(uint8 aTypeTag,
131
nsIInterfaceInfo* aInterfaceInfo,
132
nsIVariant* aProperty);
133
static nsresult VariantToArrayValue(uint8 aTypeTag,
134
nsXPTCMiniVariant* aResult,
135
nsIInterfaceInfo* aInterfaceInfo,
136
nsIVariant* aProperty);
138
static nsresult ParameterToVariant(nsIInterfaceInfo* aInterfaceInfo,
139
PRUint32 aMethodIndex,
140
const nsXPTParamInfo* aParamInfo,
141
nsXPTCMiniVariant aMiniVariant,
142
PRUint32 aArrayLength,
143
nsIVariant** aVariant);
144
static nsresult VariantToInParameter(nsIInterfaceInfo* aInterfaceInfo,
145
PRUint32 aMethodIndex,
146
const nsXPTParamInfo* aParamInfo,
147
nsIVariant* aVariant,
148
nsXPTCVariant* aXPTCVariant);
149
static nsresult VariantToOutParameter(nsIInterfaceInfo* aInterfaceInfo,
150
PRUint32 aMethodIndex,
151
const nsXPTParamInfo* aParamInfo,
152
nsIVariant* aVariant,
153
nsXPTCMiniVariant* aMiniVariant);
154
static nsresult WrapInPropertyBag(nsISupports* aInstance,
155
nsIInterfaceInfo* aInterfaceInfo,
156
nsIPropertyBag** aPropertyBag);
157
static nsresult WrapInComplexType(nsIPropertyBag* aPropertyBag,
158
nsIInterfaceInfo* aInterfaceInfo,
159
nsISupports** aComplexType);
163
nsresult GetInterfaceName(PRBool listener, char** retval);
166
nsCOMPtr<nsIWSDLPort> mPort;
167
nsCOMPtr<nsIInterfaceInfo> mPrimaryInterface;
168
nsCOMPtr<nsIInterfaceInfoManager> mInterfaceInfoManager;
171
nsCOMArray<nsIWebServiceCallContext> mPendingCalls;
173
nsCOMPtr<nsISupports> mAsyncListener;
174
nsCOMPtr<nsIInterfaceInfo> mListenerInterfaceInfo;
175
nsCOMPtr<nsIScriptableInterfaces> mInterfaces;
178
class WSPCallContext : public nsIWebServiceSOAPCallContext,
179
public nsISOAPResponseListener
182
WSPCallContext(WSPProxy* aProxy,
183
nsISOAPCall* aSOAPCall,
184
const nsAString& aMethodName,
185
nsIWSDLOperation* aOperation);
186
virtual ~WSPCallContext();
189
NS_DECL_NSIWEBSERVICECALLCONTEXT
190
NS_DECL_NSIWEBSERVICESOAPCALLCONTEXT
191
NS_DECL_NSISOAPRESPONSELISTENER
193
nsresult CallAsync(PRUint32 aListenerMethodIndex,
194
nsISupports* aListener);
195
nsresult CallSync(PRUint32 aMethodIndex,
196
nsXPTCMiniVariant* params);
199
nsresult CallCompletionListener();
203
nsCOMPtr<nsISOAPCall> mCall;
204
nsString mMethodName;
205
nsCOMPtr<nsIWSDLOperation> mOperation;
206
nsCOMPtr<nsISOAPCallCompletion> mCompletion;
207
nsCOMPtr<nsISOAPResponse> mResponse;
209
nsCOMPtr<nsIException> mException;
210
nsCOMPtr<nsISupports> mAsyncListener;
211
PRUint32 mListenerMethodIndex;
214
class WSPException : public nsIException
217
WSPException(nsISOAPFault* aFault, nsresult aStatus);
218
WSPException(nsresult aStatus, const char* aMsg, nsISupports* aData);
219
virtual ~WSPException();
225
nsCOMPtr<nsISOAPFault> mFault;
226
nsCOMPtr<nsISupports> mData;
231
class WSPComplexTypeWrapper : public nsIWebServiceComplexTypeWrapper,
232
public nsIPropertyBag
235
WSPComplexTypeWrapper();
236
virtual ~WSPComplexTypeWrapper();
239
NS_DECL_NSIPROPERTYBAG
240
NS_DECL_NSIWEBSERVICECOMPLEXTYPEWRAPPER
243
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
245
nsresult GetPropertyValue(PRUint32 aMethodIndex,
246
const nsXPTMethodInfo* aMethodInfo,
247
nsIVariant** _retval);
250
nsCOMPtr<nsISupports> mComplexTypeInstance;
251
nsCOMPtr<nsIInterfaceInfo> mInterfaceInfo;
254
class WSPPropertyBagWrapper : public nsXPTCStubBase,
255
public nsIWebServicePropertyBagWrapper,
259
WSPPropertyBagWrapper();
260
virtual ~WSPPropertyBagWrapper();
263
NS_DECL_NSIWEBSERVICEPROPERTYBAGWRAPPER
266
// Would be nice to have a NS_DECL_NSXPTCSTUBBASE
267
NS_IMETHOD CallMethod(PRUint16 methodIndex,
268
const nsXPTMethodInfo* info,
269
nsXPTCMiniVariant* params);
270
NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info);
273
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
276
nsCOMPtr<nsIPropertyBag> mPropertyBag;
277
nsCOMPtr<nsIInterfaceInfo> mInterfaceInfo;
281
class nsWSPInterfaceInfoService : public nsIWSPInterfaceInfoService
285
NS_DECL_NSIWSPINTERFACEINFOSERVICE
287
nsWSPInterfaceInfoService();
288
virtual ~nsWSPInterfaceInfoService();
291
#define NS_WEBSERVICECALLCONTEXT_CLASSID \
292
{ /* a42e9bf3-6bae-4c59-8f76-9dc175eec5b1 */ \
293
0xa42e9bf3, 0x6bae, 0x4c59, \
294
{0x8f, 0x76, 0x9d, 0xc1, 0x75, 0xee, 0xc5, 0xb1}}
295
#define NS_WEBSERVICECALLCONTEXT_CONTRACTID "@mozilla.org/xmlextras/proxy/webservicecallcontext;1"
296
#define NS_WEBSERVICEEXCEPTION_CLASSID \
297
{ /* 07c2bf7b-376e-4629-b9c0-dbb17630b98d */ \
298
0x07c2bf7b, 0x376e, 0x4629, \
299
{0xb9, 0xc0, 0xdb, 0xb1, 0x76, 0x30, 0xb9, 0x8d}}
300
#define NS_WEBSERVICEEXCEPTION_CONTRACTID "@mozilla.org/xmlextras/proxy/webserviceexception;1"
302
#endif // __wspprivate_h__