Back to index

lightning-sunbird  0.9+nobinonly
nsWSDLPrivate.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications.
00019  * Portions created by the Initial Developer are Copyright (C) 2001
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Vidur Apparao <vidur@netscape.com> (original author)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef __nsWSDLPrivate_h__
00040 #define __nsWSDLPrivate_h__
00041 
00042 #include "nsIWSDL.h"
00043 #include "nsIWSDLSOAPBinding.h"
00044 
00045 // DOM Includes
00046 #include "nsIDOMElement.h"
00047 
00048 // Schema includes
00049 #include "nsISchema.h"
00050 
00051 // XPCOM Includes
00052 #include "nsCOMPtr.h"
00053 #include "nsCOMArray.h"
00054 #include "nsString.h"
00055 #include "nsReadableUtils.h"
00056 #include "nsWeakReference.h"
00057 
00058 // Typelib includes
00059 #include "nsIInterfaceInfo.h"
00060 #include "nsIInterfaceInfoManager.h"
00061 #include "xpt_struct.h"
00062 #include "xptcall.h"
00063 
00064 #define NS_WSDL_SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema"
00065 #define NS_WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/"
00066 #define NS_WSDL_SOAP_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/"
00067 
00072 #define NS_WSDLLOADER_FIRE_ERROR(status,statusMessage)     \
00073   PR_BEGIN_MACRO                                           \
00074   if (mErrorHandler) {                                     \
00075     mErrorHandler->OnError(status, statusMessage);         \
00076   }                                                        \
00077   PR_END_MACRO
00078 
00079 class nsSOAPPortBinding : public nsISOAPPortBinding
00080 {
00081 public:
00082   nsSOAPPortBinding(const nsAString& aName);
00083   virtual ~nsSOAPPortBinding();
00084 
00085   NS_DECL_ISUPPORTS
00086   NS_DECL_NSIWSDLBINDING
00087   NS_DECL_NSISOAPPORTBINDING
00088 
00089   nsresult SetDocumentationElement(nsIDOMElement* aElement);
00090   nsresult SetAddress(const nsAString& aAddress);
00091   nsresult SetStyle(PRUint16 aStyle);
00092   nsresult SetTransport(const nsAString& aTransport);
00093   nsresult SetSoapVersion(PRUint16 aSoapVersion);
00094 
00095 protected:
00096   nsString mName;
00097   nsString mAddress;
00098   nsString mTransport;
00099   nsCOMPtr<nsIDOMElement> mDocumentationElement;
00100   PRUint16 mSoapVersion;
00101   PRUint16 mStyle;
00102 };
00103 
00104 class nsWSDLPort : public nsIWSDLPort
00105 {
00106 public:
00107   nsWSDLPort(const nsAString &aName);
00108   virtual ~nsWSDLPort();
00109 
00110   NS_DECL_ISUPPORTS
00111   NS_DECL_NSIWSDLPORT
00112 
00113   nsresult SetDocumentationElement(nsIDOMElement* aElement);
00114   nsresult AddOperation(nsIWSDLOperation* aOperation);
00115   nsresult SetBinding(nsIWSDLBinding* aBinding);
00116 
00117 protected:
00118   nsString mName;
00119   nsCOMPtr<nsIDOMElement> mDocumentationElement;
00120   nsCOMArray<nsIWSDLOperation> mOperations;
00121   nsCOMPtr<nsIWSDLBinding> mBinding;
00122 };
00123 
00124 class nsSOAPOperationBinding : public nsISOAPOperationBinding
00125 {
00126 public:
00127   nsSOAPOperationBinding();
00128   virtual ~nsSOAPOperationBinding();
00129 
00130   NS_DECL_ISUPPORTS
00131   NS_DECL_NSIWSDLBINDING
00132   NS_DECL_NSISOAPOPERATIONBINDING
00133 
00134   nsresult SetDocumentationElement(nsIDOMElement* aElement);
00135   nsresult SetStyle(PRUint16 aStyle);
00136   nsresult SetSoapAction(const nsAString& aAction);
00137 
00138 protected:
00139   nsString mSoapAction;
00140   nsCOMPtr<nsIDOMElement> mDocumentationElement;
00141   PRUint16 mStyle;
00142 };
00143 
00144 class nsWSDLOperation : public nsIWSDLOperation
00145 {
00146 public:
00147   nsWSDLOperation(const nsAString &aName);
00148   virtual ~nsWSDLOperation();
00149 
00150   NS_DECL_ISUPPORTS
00151   NS_DECL_NSIWSDLOPERATION
00152 
00153   nsresult SetDocumentationElement(nsIDOMElement* aElement);
00154   nsresult SetInput(nsIWSDLMessage* aInputMessage);
00155   nsresult SetOutput(nsIWSDLMessage* aOutputMessage);
00156   nsresult AddFault(nsIWSDLMessage* aFaultMessage);
00157   nsresult AddParameter(const nsAString& aParameter);
00158   nsresult SetBinding(nsIWSDLBinding* aBinding);
00159 
00160 protected:
00161   nsString mName;
00162   nsCOMPtr<nsIDOMElement> mDocumentationElement;
00163   nsCOMPtr<nsIWSDLMessage> mInputMessage;
00164   nsCOMPtr<nsIWSDLMessage> mOutputMessage;
00165   nsCOMArray<nsIWSDLMessage> mFaultMessages;
00166   nsStringArray mParameters;
00167   nsCOMPtr<nsIWSDLBinding> mBinding;
00168 };
00169 
00170 class nsSOAPMessageBinding : public nsISOAPMessageBinding
00171 {
00172 public:
00173   nsSOAPMessageBinding(const nsAString& aNamespace);
00174   virtual ~nsSOAPMessageBinding();
00175 
00176   NS_DECL_ISUPPORTS
00177   NS_DECL_NSIWSDLBINDING
00178   NS_DECL_NSISOAPMESSAGEBINDING
00179 
00180 protected:
00181   nsString mNamespace;
00182 };
00183 
00184 class nsWSDLMessage : public nsIWSDLMessage
00185 {
00186 public:
00187   nsWSDLMessage(const nsAString& aName);
00188   virtual ~nsWSDLMessage();
00189 
00190   NS_DECL_ISUPPORTS
00191   NS_DECL_NSIWSDLMESSAGE
00192 
00193   nsresult SetDocumentationElement(nsIDOMElement* aElement);
00194   nsresult AddPart(nsIWSDLPart* aPart);
00195   nsresult SetBinding(nsIWSDLBinding* aBinding);
00196 
00197 protected:
00198   nsString mName;
00199   nsCOMPtr<nsIDOMElement> mDocumentationElement;
00200   nsCOMArray<nsIWSDLPart> mParts;
00201   nsCOMPtr<nsIWSDLBinding> mBinding;
00202 };
00203 
00204 class nsSOAPPartBinding : public nsISOAPPartBinding
00205 {
00206 public:
00207   nsSOAPPartBinding(PRUint16 aLocation, PRUint16 aUse,
00208                     const nsAString& aEncodingStyle,
00209                     const nsAString& aNamespace);
00210   virtual ~nsSOAPPartBinding();
00211 
00212   NS_DECL_ISUPPORTS
00213   NS_DECL_NSIWSDLBINDING
00214   NS_DECL_NSISOAPPARTBINDING
00215 
00216 protected:
00217   PRUint16 mLocation;
00218   PRUint16 mUse;
00219   nsString mEncodingStyle;
00220   nsString mNamespace;
00221 };
00222 
00223 class nsWSDLPart : public nsIWSDLPart
00224 {
00225 public:
00226   nsWSDLPart(const nsAString& aName);
00227   virtual ~nsWSDLPart();
00228 
00229   NS_DECL_ISUPPORTS
00230   NS_DECL_NSIWSDLPART
00231 
00232   nsresult SetTypeInfo(const nsAString& aType, const nsAString& aElementName,
00233                        nsISchemaComponent* aSchemaComponent);
00234   nsresult SetBinding(nsIWSDLBinding* aBinding);
00235 
00236 protected:
00237   nsString mName;
00238   nsString mType;
00239   nsString mElementName;
00240   nsCOMPtr<nsISchemaComponent> mSchemaComponent;
00241   nsCOMPtr<nsIWSDLBinding> mBinding;
00242 };
00243 
00244 #define NS_WSDLPORT_CID                           \
00245 { /* c1dfb250-0c19-4339-8211-24eabc0103e5 */      \
00246  0xc1dfb250, 0x0c19, 0x4339,                      \
00247  {0x82, 0x11, 0x24, 0xea, 0xbc, 0x01, 0x03, 0xe5}}
00248 
00249 #define NS_WSDLPORT_CONTRACTID   \
00250 "@mozilla/xmlextras/wsdl/wsdlport;1"
00251 
00252 #define NS_WSDLOPERATION_CID                      \
00253 { /* cf54bdf5-20de-45ef-b6c8-aa535007549a */      \
00254  0xcf54bdf5, 0x20de, 0x45ef,                      \
00255  {0xb6, 0xc8, 0xaa, 0x53, 0x50, 0x07, 0x54, 0x9a}}
00256 
00257 #define NS_WSDLOPERATION_CONTRACTID   \
00258 "@mozilla/xmlextras/wsdl/wsdloperation;1"
00259 
00260 #define NS_WSDLMESSAGE_CID                        \
00261 { /* 36b26cab-3eed-4c7c-81ad-94c8b1eb9ebe */      \
00262  0x36b26cab, 0x3eed, 0x4c7c,                      \
00263  {0x81, 0xad, 0x94, 0xc8, 0xb1, 0xeb, 0x9e, 0xbe}}
00264 
00265 #define NS_WSDLMESSAGE_CONTRACTID   \
00266 "@mozilla/xmlextras/wsdl/wsdlmessage;1"
00267 
00268 #define NS_WSDLPART_CID                           \
00269 { /* 1841ebe8-5bdc-4e79-bcf4-329785318491 */      \
00270  0x1841ebe8, 0x5bdc, 0x4e79,                      \
00271  {0xbc, 0xf4, 0x32, 0x97, 0x85, 0x31, 0x84, 0x91}}
00272 
00273 #define NS_WSDLPART_CONTRACTID   \
00274 "@mozilla/xmlextras/wsdl/wsdlpart;1"
00275 
00276 #define NS_SOAPPORTBINDING_CID                    \
00277 { /* a9155950-e49d-4123-93b7-e263a3af2b32 */      \
00278  0xa9155950, 0xe49d, 0x4123,                      \
00279  {0x93, 0xb7, 0xe2, 0x63, 0xa3, 0xaf, 0x2b, 0x32}}
00280 
00281 #define NS_SOAPPORTBINDING_CONTRACTID   \
00282 "@mozilla/xmlextras/wsdl/soapportbinding;1"
00283 
00284 #define NS_SOAPOPERATIONBINDING_CID               \
00285 { /* f5230937-4af6-43fb-9766-1890896632b2 */      \
00286  0xf5230937, 0x4af6, 0x43fb,                      \
00287  {0x97, 0x66, 0x18, 0x90, 0x89, 0x66, 0x32, 0xb2}}
00288 
00289 #define NS_SOAPOPERATIONBINDING_CONTRACTID   \
00290 "@mozilla/xmlextras/wsdl/soapoperationbinding;1"
00291 
00292 #define NS_SOAPMESSAGEBINDING_CID               \
00293 { /* 0adc6e39-49cd-42a2-a862-698e7885fcbd */      \
00294  0x0adc6e39, 0x49cd, 0x42a2,                      \
00295  {0xa8, 0x62, 0x69, 0x8e, 0x78, 0x85, 0xfc, 0xbd}}
00296 
00297 #define NS_SOAPMESSAGEBINDING_CONTRACTID   \
00298 "@mozilla/xmlextras/wsdl/soapmessagebinding;1"
00299 
00300 #define NS_SOAPPARTBINDING_CID                    \
00301 { /* b7698d5c-06cc-45fe-b6bc-88e32a9f970e */      \
00302  0xb7698d5c, 0x06cc, 0x45fe,                      \
00303  {0xb6, 0xbc, 0x88, 0xe3, 0x2a, 0x9f, 0x97, 0x0e}}
00304 
00305 #define NS_SOAPPARTBINDING_CONTRACTID   \
00306 "@mozilla/xmlextras/wsdl/soappartbinding;1"
00307 
00308 #endif // __nsWSDLPrivate_h__