Back to index

lightning-sunbird  0.9+nobinonly
nsWSDLDefinitions.cpp
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 #include "nsWSDLPrivate.h"
00040 #include "nsISOAPMessage.h"
00041 
00043 //
00044 // nsWSDLPort implementation
00045 //
00047 nsWSDLPort::nsWSDLPort(const nsAString& aName)
00048   : mName(aName)
00049 {
00050 }
00051 
00052 nsWSDLPort::~nsWSDLPort()
00053 {
00054 }
00055 
00056 NS_IMPL_ISUPPORTS1_CI(nsWSDLPort, nsIWSDLPort)
00057 
00058 /* readonly attribute AString name; */
00059 NS_IMETHODIMP
00060 nsWSDLPort::GetName(nsAString & aName)
00061 {
00062   aName.Assign(mName);
00063 
00064   return NS_OK;
00065 }
00066 
00067 /* readonly attribute nsIDOMElement documentation; */
00068 NS_IMETHODIMP
00069 nsWSDLPort::GetDocumentation(nsIDOMElement * *aDocumentation)
00070 {
00071   NS_ENSURE_ARG_POINTER(aDocumentation);
00072 
00073   *aDocumentation = mDocumentationElement;
00074   NS_IF_ADDREF(*aDocumentation);
00075 
00076   return NS_OK;
00077 }
00078 
00079 /* readonly attribute PRUint32 operationCount; */
00080 NS_IMETHODIMP
00081 nsWSDLPort::GetOperationCount(PRUint32 *aOperationCount)
00082 {
00083   NS_ENSURE_ARG_POINTER(aOperationCount);
00084 
00085   *aOperationCount = mOperations.Count();
00086 
00087   return NS_OK;
00088 }
00089 
00090 /* nsIWSDLOperation getOperation (in PRUint32 index); */
00091 NS_IMETHODIMP
00092 nsWSDLPort::GetOperation(PRUint32 aIndex, nsIWSDLOperation **_retval)
00093 {
00094   NS_ENSURE_ARG_POINTER(_retval);
00095 
00096   if (aIndex < (PRUint32)mOperations.Count()) {
00097     *_retval = mOperations[aIndex];
00098     NS_IF_ADDREF(*_retval);
00099   } else {
00100     *_retval = nsnull;
00101   }
00102 
00103   return NS_OK;
00104 }
00105 
00106 /* nsIWSDLOperation getOperationByName(in AString name); */
00107 NS_IMETHODIMP
00108 nsWSDLPort::GetOperationByName(const nsAString& aName,
00109                                nsIWSDLOperation** aOperation)
00110 {
00111   *aOperation = nsnull;
00112 
00113   nsAutoString name;
00114 
00115   // XXX Do a linear search for now. If more efficiency is needed
00116   // we can store the opeartions in a hash as well.
00117   PRUint32 i, count = mOperations.Count();
00118 
00119   for (i = 0; i < count; i++) {
00120     nsIWSDLOperation *operation = mOperations[i];
00121 
00122     if (operation) {
00123       operation->GetName(name);
00124 
00125       if (name.Equals(aName)) {
00126         *aOperation = operation;
00127         NS_ADDREF(*aOperation);
00128         break;
00129       }
00130     }
00131   }
00132 
00133   return NS_OK;
00134 }
00135 
00136 NS_IMETHODIMP
00137 nsWSDLPort::GetBinding(nsIWSDLBinding** aBinding)
00138 {
00139   NS_ENSURE_ARG_POINTER(aBinding);
00140 
00141   *aBinding = mBinding;
00142   NS_IF_ADDREF(*aBinding);
00143 
00144   return NS_OK;
00145 }
00146 
00147 nsresult
00148 nsWSDLPort::SetDocumentationElement(nsIDOMElement* aElement)
00149 {
00150   mDocumentationElement = aElement;
00151 
00152   return NS_OK;
00153 }
00154 
00155 nsresult
00156 nsWSDLPort::AddOperation(nsIWSDLOperation* aOperation)
00157 {
00158   NS_ENSURE_ARG(aOperation);
00159 
00160   return mOperations.AppendObject(aOperation) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
00161 }
00162 
00163 nsresult
00164 nsWSDLPort::SetBinding(nsIWSDLBinding* aBinding)
00165 {
00166   mBinding = aBinding;
00167 
00168   return NS_OK;
00169 }
00170 
00172 //
00173 // nsSOAPPortBinding implementation
00174 //
00176 nsSOAPPortBinding::nsSOAPPortBinding(const nsAString& aName)
00177   : mName(aName), mSoapVersion(nsISOAPPortBinding::SOAP_VERSION_UNKNOWN),
00178     mStyle(STYLE_RPC)
00179 {
00180 }
00181 
00182 nsSOAPPortBinding::~nsSOAPPortBinding()
00183 {
00184 }
00185 
00186 NS_IMPL_ISUPPORTS3_CI(nsSOAPPortBinding, nsIWSDLBinding, nsIWSDLSOAPBinding,
00187                       nsISOAPPortBinding)
00188 
00189 /*  readonly attribute AString protocol; */
00190 NS_IMETHODIMP
00191 nsSOAPPortBinding::GetProtocol(nsAString& aProtocol)
00192 {
00193   aProtocol.AssignLiteral("soap");
00194 
00195   return NS_OK;
00196 }
00197 
00198 /*  readonly attribute nsIDOMElement documentation; */
00199 NS_IMETHODIMP
00200 nsSOAPPortBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
00201 {
00202   NS_ENSURE_ARG_POINTER(aDocumentation);
00203 
00204   *aDocumentation = mDocumentationElement;
00205   NS_IF_ADDREF(*aDocumentation);
00206 
00207   return NS_OK;
00208 }
00209 
00210 /* readonly attribute AString bindingName; */
00211 NS_IMETHODIMP
00212 nsSOAPPortBinding::GetName(nsAString & aBindingName)
00213 {
00214   aBindingName.Assign(mName);
00215 
00216   return NS_OK;
00217 }
00218 
00219 /* readonly attribute AString address; */
00220 NS_IMETHODIMP
00221 nsSOAPPortBinding::GetAddress(nsAString & aAddress)
00222 {
00223   aAddress.Assign(mAddress);
00224 
00225   return NS_OK;
00226 }
00227 
00228 /* readonly attribute unsigned short style; */
00229 NS_IMETHODIMP
00230 nsSOAPPortBinding::GetStyle(PRUint16 *aStyle)
00231 {
00232   NS_ENSURE_ARG_POINTER(aStyle);
00233 
00234   *aStyle = mStyle;
00235 
00236   return NS_OK;
00237 }
00238 
00239 /* readonly attribute AString transport; */
00240 NS_IMETHODIMP
00241 nsSOAPPortBinding::GetTransport(nsAString & aTransport)
00242 {
00243   aTransport.Assign(mTransport);
00244 
00245   return NS_OK;
00246 }
00247 
00248 /* readonly attribute unsigned short soapVersion; */
00249 NS_IMETHODIMP
00250 nsSOAPPortBinding::GetSoapVersion(PRUint16 *aVersion)
00251 {
00252   NS_ENSURE_ARG_POINTER(aVersion);
00253   *aVersion = mSoapVersion;
00254   return NS_OK;
00255 }
00256 
00257 nsresult
00258 nsSOAPPortBinding::SetDocumentationElement(nsIDOMElement* aElement)
00259 {
00260   mDocumentationElement = aElement;
00261 
00262   return NS_OK;
00263 }
00264 
00265 nsresult
00266 nsSOAPPortBinding::SetAddress(const nsAString& aAddress)
00267 {
00268   mAddress.Assign(aAddress);
00269 
00270   return NS_OK;
00271 }
00272 
00273 nsresult
00274 nsSOAPPortBinding::SetStyle(PRUint16 aStyle)
00275 {
00276   mStyle = aStyle;
00277 
00278   return NS_OK;
00279 }
00280 
00281 nsresult
00282 nsSOAPPortBinding::SetTransport(const nsAString& aTransport)
00283 {
00284   mTransport.Assign(aTransport);
00285 
00286   return NS_OK;
00287 }
00288 
00289 nsresult
00290 nsSOAPPortBinding::SetSoapVersion(PRUint16 aVersion)
00291 {
00292   mSoapVersion = aVersion;
00293   return NS_OK;
00294 }
00295 
00297 //
00298 // nsWSDLOperation implementation
00299 //
00301 nsWSDLOperation::nsWSDLOperation(const nsAString &aName)
00302   : mName(aName)
00303 {
00304 }
00305 
00306 nsWSDLOperation::~nsWSDLOperation()
00307 {
00308 }
00309 
00310 NS_IMPL_ISUPPORTS1_CI(nsWSDLOperation, nsIWSDLOperation)
00311 
00312 /* readonly attribute AString name; */
00313 NS_IMETHODIMP
00314 nsWSDLOperation::GetName(nsAString & aName)
00315 {
00316   aName.Assign(mName);
00317 
00318   return NS_OK;
00319 }
00320 
00321 /* readonly attribute nsIDOMElement documentation; */
00322 NS_IMETHODIMP
00323 nsWSDLOperation::GetDocumentation(nsIDOMElement * *aDocumentation)
00324 {
00325   NS_ENSURE_ARG_POINTER(aDocumentation);
00326 
00327   *aDocumentation = mDocumentationElement;
00328   NS_IF_ADDREF(*aDocumentation);
00329 
00330   return NS_OK;
00331 }
00332 
00333 /* readonly attribute nsIWSDLMessage input; */
00334 NS_IMETHODIMP
00335 nsWSDLOperation::GetInput(nsIWSDLMessage * *aInput)
00336 {
00337   NS_ENSURE_ARG_POINTER(aInput);
00338 
00339   *aInput = mInputMessage;
00340   NS_IF_ADDREF(*aInput);
00341 
00342   return NS_OK;
00343 }
00344 
00345 /* readonly attribute nsIWSDLMessage output; */
00346 NS_IMETHODIMP
00347 nsWSDLOperation::GetOutput(nsIWSDLMessage * *aOutput)
00348 {
00349   NS_ENSURE_ARG_POINTER(aOutput);
00350 
00351   *aOutput = mOutputMessage;
00352   NS_IF_ADDREF(*aOutput);
00353 
00354   return NS_OK;
00355 }
00356 
00357 /*  readonly attribute PRUint32 faultCount; */
00358 NS_IMETHODIMP
00359 nsWSDLOperation::GetFaultCount(PRUint32* aCount)
00360 {
00361   NS_ENSURE_ARG_POINTER(aCount);
00362 
00363   *aCount = mFaultMessages.Count();
00364 
00365   return NS_OK;
00366 }
00367 
00368 /*   nsIWSDLMessage getFault(in PRUint32 index); */
00369 NS_IMETHODIMP
00370 nsWSDLOperation::GetFault(PRUint32 aIndex, nsIWSDLMessage * *aFault)
00371 {
00372   NS_ENSURE_ARG_POINTER(aFault);
00373 
00374   if (aIndex < (PRUint32)mFaultMessages.Count()) {
00375     *aFault = mFaultMessages[aIndex];
00376     NS_IF_ADDREF(*aFault);
00377   } else {
00378     *aFault = nsnull;
00379   }
00380 
00381   return NS_OK;
00382 }
00383 
00384 NS_IMETHODIMP
00385 nsWSDLOperation::GetBinding(nsIWSDLBinding** aBinding)
00386 {
00387   NS_ENSURE_ARG_POINTER(aBinding);
00388 
00389   *aBinding = mBinding;
00390   NS_IF_ADDREF(*aBinding);
00391 
00392   return NS_OK;
00393 }
00394 
00395 /* readonly attribute PRUint32 parameterOrderCount; */
00396 NS_IMETHODIMP
00397 nsWSDLOperation::GetParameterOrderCount(PRUint32 *aParameterCount)
00398 {
00399   NS_ENSURE_ARG_POINTER(aParameterCount);
00400 
00401   *aParameterCount = (PRUint32)mParameters.Count();
00402 
00403   return NS_OK;
00404 }
00405 
00406 /* AString getParameter (in PRUint32 index); */
00407 NS_IMETHODIMP
00408 nsWSDLOperation::GetParameter(PRUint32 index, nsAString & _retval)
00409 {
00410   nsString* str = mParameters.StringAt((PRInt32)index);
00411   if (!str) {
00412     return NS_ERROR_FAILURE;
00413   }
00414   _retval.Assign(*str);
00415 
00416   return NS_OK;
00417 }
00418 
00419 /* PRUint32 getParameterIndex(in AString name); */
00420 NS_IMETHODIMP
00421 nsWSDLOperation::GetParameterIndex(const nsAString& aName,
00422                                    PRUint32* aIndex)
00423 {
00424   NS_ENSURE_ARG_POINTER(aIndex);
00425 
00426   *aIndex = (PRUint32)mParameters.IndexOf(aName);
00427   if (*aIndex == -1) {
00428     return NS_ERROR_FAILURE;
00429   }
00430 
00431   return NS_OK;
00432 }
00433 
00434 nsresult
00435 nsWSDLOperation::SetDocumentationElement(nsIDOMElement* aElement)
00436 {
00437   mDocumentationElement = aElement;
00438 
00439   return NS_OK;
00440 }
00441 
00442 nsresult
00443 nsWSDLOperation::SetInput(nsIWSDLMessage* aInputMessage)
00444 {
00445   mInputMessage =  aInputMessage;
00446 
00447   return NS_OK;
00448 }
00449 
00450 nsresult
00451 nsWSDLOperation::SetOutput(nsIWSDLMessage* aOutputMessage)
00452 {
00453   mOutputMessage = aOutputMessage;
00454 
00455   return NS_OK;
00456 }
00457 
00458 nsresult
00459 nsWSDLOperation::AddFault(nsIWSDLMessage* aFaultMessage)
00460 {
00461   NS_ENSURE_ARG(aFaultMessage);
00462 
00463   return mFaultMessages.AppendObject(aFaultMessage) ?
00464     NS_OK : NS_ERROR_OUT_OF_MEMORY;
00465 }
00466 
00467 nsresult
00468 nsWSDLOperation::SetBinding(nsIWSDLBinding* aBinding)
00469 {
00470   mBinding = aBinding;
00471 
00472   return NS_OK;
00473 }
00474 
00475 nsresult
00476 nsWSDLOperation::AddParameter(const nsAString& aParameter)
00477 {
00478   mParameters.AppendString(aParameter);
00479 
00480   return NS_OK;
00481 }
00482 
00484 //
00485 // nsSOAPOperationBinding implementation
00486 //
00488 nsSOAPOperationBinding::nsSOAPOperationBinding()
00489   : mStyle(nsIWSDLSOAPBinding::STYLE_RPC)
00490 {
00491 }
00492 
00493 nsSOAPOperationBinding::~nsSOAPOperationBinding()
00494 {
00495 }
00496 
00497 NS_IMPL_ISUPPORTS3_CI(nsSOAPOperationBinding, nsIWSDLBinding,
00498                       nsIWSDLSOAPBinding, nsISOAPOperationBinding)
00499 
00500 /*  readonly attribute AString protocol; */
00501 NS_IMETHODIMP
00502 nsSOAPOperationBinding::GetProtocol(nsAString& aProtocol)
00503 {
00504   aProtocol.AssignLiteral("soap");
00505 
00506   return NS_OK;
00507 }
00508 
00509 /*  readonly attribute nsIDOMElement documentation; */
00510 NS_IMETHODIMP
00511 nsSOAPOperationBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
00512 {
00513   NS_ENSURE_ARG_POINTER(aDocumentation);
00514 
00515   *aDocumentation = mDocumentationElement;
00516   NS_IF_ADDREF(*aDocumentation);
00517 
00518   return NS_OK;
00519 }
00520 
00521 /* readonly attribute unsigned short style; */
00522 NS_IMETHODIMP
00523 nsSOAPOperationBinding::GetStyle(PRUint16 *aStyle)
00524 {
00525   NS_ENSURE_ARG_POINTER(aStyle);
00526 
00527   *aStyle = mStyle;
00528 
00529   return NS_OK;
00530 }
00531 
00532 /* readonly attribute AString soapAction; */
00533 NS_IMETHODIMP
00534 nsSOAPOperationBinding::GetSoapAction(nsAString & aSoapAction)
00535 {
00536   aSoapAction.Assign(mSoapAction);
00537 
00538   return NS_OK;
00539 }
00540 
00541 nsresult
00542 nsSOAPOperationBinding::SetDocumentationElement(nsIDOMElement* aElement)
00543 {
00544   mDocumentationElement = aElement;
00545 
00546   return NS_OK;
00547 }
00548 
00549 nsresult
00550 nsSOAPOperationBinding::SetStyle(PRUint16 aStyle)
00551 {
00552   mStyle = aStyle;
00553 
00554   return NS_OK;
00555 }
00556 
00557 nsresult
00558 nsSOAPOperationBinding::SetSoapAction(const nsAString& aAction)
00559 {
00560   mSoapAction.Assign(aAction);
00561 
00562   return NS_OK;
00563 }
00564 
00566 //
00567 // nsWSDLMessage implementation
00568 //
00570 nsWSDLMessage::nsWSDLMessage(const nsAString& aName)
00571   : mName(aName)
00572 {
00573 }
00574 
00575 nsWSDLMessage::~nsWSDLMessage()
00576 {
00577 }
00578 
00579 NS_IMPL_ISUPPORTS1_CI(nsWSDLMessage, nsIWSDLMessage)
00580 
00581 /* readonly attribute AString name; */
00582 NS_IMETHODIMP
00583 nsWSDLMessage::GetName(nsAString & aName)
00584 {
00585   aName.Assign(mName);
00586 
00587   return NS_OK;
00588 }
00589 
00590 /* readonly attribute nsIDOMElement documentation; */
00591 NS_IMETHODIMP
00592 nsWSDLMessage::GetDocumentation(nsIDOMElement * *aDocumentation)
00593 {
00594   NS_ENSURE_ARG_POINTER(aDocumentation);
00595 
00596   *aDocumentation = mDocumentationElement;
00597   NS_IF_ADDREF(*aDocumentation);
00598 
00599   return NS_OK;
00600 }
00601 
00602 NS_IMETHODIMP
00603 nsWSDLMessage::GetBinding(nsIWSDLBinding** aBinding)
00604 {
00605   NS_ENSURE_ARG_POINTER(aBinding);
00606 
00607   *aBinding = mBinding;
00608   NS_IF_ADDREF(*aBinding);
00609 
00610   return NS_OK;
00611 }
00612 
00613 /* readonly attribute PRUint32 partCount; */
00614 NS_IMETHODIMP
00615 nsWSDLMessage::GetPartCount(PRUint32 *aPartCount)
00616 {
00617   NS_ENSURE_ARG_POINTER(aPartCount);
00618 
00619   *aPartCount = mParts.Count();
00620 
00621   return NS_OK;
00622 }
00623 
00624 /* nsIWSDLPart getPart (in PRUint32 index); */
00625 NS_IMETHODIMP
00626 nsWSDLMessage::GetPart(PRUint32 aIndex, nsIWSDLPart **_retval)
00627 {
00628   NS_ENSURE_ARG_POINTER(_retval);
00629 
00630   if (aIndex < (PRUint32)mParts.Count()) {
00631     *_retval = mParts[aIndex];
00632     NS_IF_ADDREF(*_retval);
00633   } else {
00634     *_retval = nsnull;
00635   }
00636 
00637   return NS_OK;
00638 }
00639 
00640 /* nsIWSDLPart getPartByName(in AString name); */
00641 NS_IMETHODIMP
00642 nsWSDLMessage::GetPartByName(const nsAString& aName, nsIWSDLPart** aPart)
00643 {
00644   nsAutoString name;
00645 
00646   *aPart = nsnull;
00647   // XXX Do a linear search for now. If more efficiency is needed
00648   // we can store the part in a hash as well.
00649   PRUint32 i, count = mParts.Count();
00650 
00651   for (i = 0; i < count; i++) {
00652     nsIWSDLPart *part = mParts[i];
00653 
00654     if (part) {
00655       part->GetName(name);
00656 
00657       if (name.Equals(aName)) {
00658         *aPart = part;
00659         NS_ADDREF(*aPart);
00660         break;
00661       }
00662     }
00663   }
00664 
00665   return NS_OK;
00666 }
00667 
00668 nsresult
00669 nsWSDLMessage::SetDocumentationElement(nsIDOMElement* aElement)
00670 {
00671   mDocumentationElement = aElement;
00672 
00673   return NS_OK;
00674 }
00675 
00676 nsresult
00677 nsWSDLMessage::AddPart(nsIWSDLPart* aPart)
00678 {
00679   NS_ENSURE_ARG(aPart);
00680 
00681   return mParts.AppendObject(aPart) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
00682 }
00683 
00684 nsresult
00685 nsWSDLMessage::SetBinding(nsIWSDLBinding* aBinding)
00686 {
00687   mBinding = aBinding;
00688 
00689   return NS_OK;
00690 }
00691 
00693 //
00694 // nsSOAPMessageBinding implementation
00695 //
00697 nsSOAPMessageBinding::nsSOAPMessageBinding(const nsAString& aNamespace)
00698   : mNamespace(aNamespace)
00699 {
00700 }
00701 
00702 nsSOAPMessageBinding::~nsSOAPMessageBinding()
00703 {
00704 }
00705 
00706 NS_IMPL_ISUPPORTS3_CI(nsSOAPMessageBinding, nsIWSDLBinding, nsIWSDLSOAPBinding,
00707                       nsISOAPMessageBinding)
00708 
00709 /*  readonly attribute AString protocol; */
00710 NS_IMETHODIMP
00711 nsSOAPMessageBinding::GetProtocol(nsAString& aProtocol)
00712 {
00713   aProtocol.AssignLiteral("soap");
00714 
00715   return NS_OK;
00716 }
00717 
00718 /*  readonly attribute nsIDOMElement documentation; */
00719 NS_IMETHODIMP
00720 nsSOAPMessageBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
00721 {
00722   NS_ENSURE_ARG_POINTER(aDocumentation);
00723 
00724   *aDocumentation = nsnull;
00725 
00726   return NS_OK;
00727 }
00728 
00729 /* readonly attribute AString namespace; */
00730 NS_IMETHODIMP
00731 nsSOAPMessageBinding::GetNamespace(nsAString & aNamespace)
00732 {
00733   aNamespace.Assign(mNamespace);
00734 
00735   return NS_OK;
00736 }
00737 
00739 //
00740 // nsWSDLPart implementation
00741 //
00743 nsWSDLPart::nsWSDLPart(const nsAString& aName)
00744   : mName(aName)
00745 {
00746 }
00747 
00748 nsWSDLPart::~nsWSDLPart()
00749 {
00750 }
00751 
00752 NS_IMPL_ISUPPORTS1_CI(nsWSDLPart, nsIWSDLPart)
00753 
00754 /* readonly attribute AString name; */
00755 NS_IMETHODIMP
00756 nsWSDLPart::GetName(nsAString & aName)
00757 {
00758   aName.Assign(mName);
00759 
00760   return NS_OK;
00761 }
00762 
00763 /* readonly attribute AString type; */
00764 NS_IMETHODIMP
00765 nsWSDLPart::GetType(nsAString & aType)
00766 {
00767   aType.Assign(mType);
00768 
00769   return NS_OK;
00770 }
00771 
00772 /* readonly attribute AString elementName; */
00773 NS_IMETHODIMP
00774 nsWSDLPart::GetElementName(nsAString & aElementName)
00775 {
00776   aElementName.Assign(mElementName);
00777 
00778   return NS_OK;
00779 }
00780 
00781 /* readonly attribute nsISchemaComponent schemaComponent; */
00782 NS_IMETHODIMP
00783 nsWSDLPart::GetSchemaComponent(nsISchemaComponent * *aSchemaComponent)
00784 {
00785   NS_ENSURE_ARG_POINTER(aSchemaComponent);
00786 
00787   *aSchemaComponent = mSchemaComponent;
00788   NS_IF_ADDREF(*aSchemaComponent);
00789 
00790   return NS_OK;
00791 }
00792 
00793 NS_IMETHODIMP
00794 nsWSDLPart::GetBinding(nsIWSDLBinding** aBinding)
00795 {
00796   NS_ENSURE_ARG_POINTER(aBinding);
00797 
00798   *aBinding = mBinding;
00799   NS_IF_ADDREF(*aBinding);
00800 
00801   return NS_OK;
00802 }
00803 
00804 nsresult
00805 nsWSDLPart::SetTypeInfo(const nsAString& aType, const nsAString& aElementName,
00806                         nsISchemaComponent* aSchemaComponent)
00807 {
00808   mType.Assign(aType);
00809   mElementName.Assign(aElementName);
00810   mSchemaComponent = aSchemaComponent;
00811 
00812   return NS_OK;
00813 }
00814 
00815 nsresult
00816 nsWSDLPart::SetBinding(nsIWSDLBinding* aBinding)
00817 {
00818   mBinding = aBinding;
00819 
00820   return NS_OK;
00821 }
00822 
00824 //
00825 // nsSOAPPartBinding implementation
00826 //
00828 nsSOAPPartBinding::nsSOAPPartBinding(PRUint16 aLocation, PRUint16 aUse,
00829                                      const nsAString& aEncodingStyle,
00830                                      const nsAString& aNamespace)
00831   : mLocation(aLocation), mUse(aUse), mEncodingStyle(aEncodingStyle),
00832     mNamespace(aNamespace)
00833 {
00834 }
00835 
00836 nsSOAPPartBinding::~nsSOAPPartBinding()
00837 {
00838 }
00839 
00840 NS_IMPL_ISUPPORTS3_CI(nsSOAPPartBinding, nsIWSDLBinding, nsIWSDLSOAPBinding,
00841                       nsISOAPPartBinding)
00842 
00843 /*  readonly attribute AString protocol; */
00844 NS_IMETHODIMP
00845 nsSOAPPartBinding::GetProtocol(nsAString& aProtocol)
00846 {
00847   aProtocol.AssignLiteral("soap");
00848 
00849   return NS_OK;
00850 }
00851 
00852 /*  readonly attribute nsIDOMElement documentation; */
00853 NS_IMETHODIMP
00854 nsSOAPPartBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
00855 {
00856   NS_ENSURE_ARG_POINTER(aDocumentation);
00857 
00858   *aDocumentation = nsnull;
00859 
00860   return NS_OK;
00861 }
00862 
00863 /* readonly attribute unsigned short location; */
00864 NS_IMETHODIMP
00865 nsSOAPPartBinding::GetLocation(PRUint16 *aLocation)
00866 {
00867   NS_ENSURE_ARG_POINTER(aLocation);
00868 
00869   *aLocation = mLocation;
00870 
00871   return NS_OK;
00872 }
00873 
00874 /* readonly attribute unsigned short use; */
00875 NS_IMETHODIMP
00876 nsSOAPPartBinding::GetUse(PRUint16 *aUse)
00877 {
00878   NS_ENSURE_ARG_POINTER(aUse);
00879 
00880   *aUse = mUse;
00881 
00882   return NS_OK;
00883 }
00884 
00885 /* readonly attribute AString encodingStyle; */
00886 NS_IMETHODIMP
00887 nsSOAPPartBinding::GetEncodingStyle(nsAString & aEncodingStyle)
00888 {
00889   aEncodingStyle.Assign(mEncodingStyle);
00890 
00891   return NS_OK;
00892 }
00893 
00894 /* readonly attribute AString namespace; */
00895 NS_IMETHODIMP
00896 nsSOAPPartBinding::GetNamespace(nsAString & aNamespace)
00897 {
00898   aNamespace.Assign(mNamespace);
00899 
00900   return NS_OK;
00901 }