Checking in changes that are the result of the review and super review of the WSDL code. The review was performed by harishd@netscape.com, jgaunt@netscape.com, and jst@netscape.com. Not part of the build yet.

This commit is contained in:
jst%netscape.com 2003-03-18 22:44:12 +00:00
parent c591e04a1a
commit 21ca0da5ff
14 changed files with 1148 additions and 1098 deletions

View File

@ -36,7 +36,8 @@ interface nsIWSDLPart;
interface nsIDOMElement;
[scriptable, uuid(0458dac1-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLPort : nsISupports {
interface nsIWSDLPort : nsISupports
{
readonly attribute AString name;
readonly attribute nsIDOMElement documentation;
@ -48,7 +49,8 @@ interface nsIWSDLPort : nsISupports {
};
[scriptable, uuid(0458dac2-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLOperation : nsISupports {
interface nsIWSDLOperation : nsISupports
{
readonly attribute AString name;
readonly attribute nsIDOMElement documentation;
@ -65,7 +67,8 @@ interface nsIWSDLOperation : nsISupports {
};
[scriptable, uuid(0458dac3-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLMessage : nsISupports {
interface nsIWSDLMessage : nsISupports
{
readonly attribute AString name;
readonly attribute nsIDOMElement documentation;
@ -77,7 +80,8 @@ interface nsIWSDLMessage : nsISupports {
};
[scriptable, uuid(0458dac4-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLPart : nsISupports {
interface nsIWSDLPart : nsISupports
{
readonly attribute AString name;
readonly attribute nsIWSDLBinding binding;
@ -94,7 +98,8 @@ interface nsIWSDLPart : nsISupports {
};
[scriptable, uuid(0458dac0-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLBinding : nsISupports {
interface nsIWSDLBinding : nsISupports
{
readonly attribute AString protocol;
readonly attribute nsIDOMElement documentation;
};

View File

@ -4,20 +4,20 @@
* 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):
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
@ -25,26 +25,26 @@
%{ C++
#include "nsAString.h"
%}
%}
interface nsIWSDLPort;
interface nsIWSDLLoadListener;
// Does this need to be scriptable, and exposed to scripters? We think
// not...
[scriptable, uuid(0458dac5-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLLoader : nsISupports {
interface nsIWSDLLoader : nsISupports
{
nsIWSDLPort load(in AString wsdlURI, in AString portName);
void loadAsync(in AString wsdlURI, in AString portName,
void loadAsync(in AString wsdlURI, in AString portName,
in nsIWSDLLoadListener listener);
nsISupports createPortProxy(in nsIWSDLPort service,
in AString nameSpace,
in boolean sync);
};
[scriptable, uuid(0458dac6-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLLoadListener : nsISupports {
interface nsIWSDLLoadListener : nsISupports
{
void onLoad(in nsIWSDLPort port);
void onError(in nsresult status,
in AString statusMessage);
void onError(in nsresult status, in AString statusMessage);
};
%{ C++

View File

@ -4,20 +4,20 @@
* 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):
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
@ -26,13 +26,18 @@
%{ C++
#include "nsAString.h"
%}
%}
[scriptable, uuid(0458dac7-65de-11d5-9b42-00104bdf5339)]
interface nsISOAPPortBinding : nsIWSDLBinding {
[scriptable, uuid(bb76b72e-d143-4738-804a-53b311466dd9)]
interface nsIWSDLSOAPBinding : nsIWSDLBinding
{
const unsigned short STYLE_RPC = 1;
const unsigned short STYLE_DOCUMENT = 2;
};
[scriptable, uuid(0458dac7-65de-11d5-9b42-00104bdf5339)]
interface nsISOAPPortBinding : nsIWSDLSOAPBinding
{
const unsigned short SOAP_VERSION_1_1 = 0;
const unsigned short SOAP_VERSION_1_2 = 1;
const unsigned short SOAP_VERSION_UNKNOWN = 32767;
@ -45,18 +50,21 @@ interface nsISOAPPortBinding : nsIWSDLBinding {
};
[scriptable, uuid(0458dac8-65de-11d5-9b42-00104bdf5339)]
interface nsISOAPOperationBinding : nsIWSDLBinding {
interface nsISOAPOperationBinding : nsIWSDLSOAPBinding
{
readonly attribute unsigned short style;
readonly attribute AString soapAction;
};
[scriptable, uuid(c3c4614c-301a-44af-ad70-936f9fd1ba5c)]
interface nsISOAPMessageBinding : nsIWSDLBinding {
interface nsISOAPMessageBinding : nsIWSDLSOAPBinding
{
readonly attribute AString namespace;
};
[scriptable, uuid(0458dac9-65de-11d5-9b42-00104bdf5339)]
interface nsISOAPPartBinding : nsIWSDLBinding {
interface nsISOAPPartBinding : nsIWSDLSOAPBinding
{
const unsigned short LOCATION_BODY = 1;
const unsigned short LOCATION_HEADER = 2;
const unsigned short LOCATION_FAULT = 3;

View File

@ -4,20 +4,20 @@
* 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):
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
@ -41,7 +41,7 @@ nsWSDLPort::~nsWSDLPort()
NS_IMPL_ISUPPORTS1_CI(nsWSDLPort, nsIWSDLPort)
/* readonly attribute AString name; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPort::GetName(nsAString & aName)
{
aName.Assign(mName);
@ -50,34 +50,42 @@ nsWSDLPort::GetName(nsAString & aName)
}
/* readonly attribute nsIDOMElement documentation; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPort::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
/* readonly attribute PRUint32 operationCount; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPort::GetOperationCount(PRUint32 *aOperationCount)
{
NS_ENSURE_ARG_POINTER(aOperationCount);
return mOperations.Count(aOperationCount);
*aOperationCount = mOperations.Count();
return NS_OK;
}
/* nsIWSDLOperation getOperation (in PRUint32 index); */
NS_IMETHODIMP
nsWSDLPort::GetOperation(PRUint32 index, nsIWSDLOperation **_retval)
NS_IMETHODIMP
nsWSDLPort::GetOperation(PRUint32 aIndex, nsIWSDLOperation **_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
return mOperations.QueryElementAt(index, NS_GET_IID(nsIWSDLOperation),
(void**)_retval);
if (aIndex < (PRUint32)mOperations.Count()) {
*_retval = mOperations[aIndex];
NS_IF_ADDREF(*_retval);
} else {
*_retval = nsnull;
}
return NS_OK;
}
/* nsIWSDLOperation getOperationByName(in AString name); */
@ -85,24 +93,20 @@ NS_IMETHODIMP
nsWSDLPort::GetOperationByName(const nsAString& aName,
nsIWSDLOperation** aOperation)
{
nsresult rv;
*aOperation = nsnull;
nsAutoString name;
// XXX Do a linear search for now. If more efficiency is needed
// we can store the opeartions in a hash as well.
PRUint32 index, count;
mOperations.Count(&count);
PRUint32 i, count = mOperations.Count();
for (index = 0; index < count; index++) {
nsCOMPtr<nsIWSDLOperation> operation;
rv = mOperations.QueryElementAt(index, NS_GET_IID(nsIWSDLOperation),
getter_AddRefs(operation));
if (NS_SUCCEEDED(rv)) {
nsAutoString name;
for (i = 0; i < count; i++) {
nsIWSDLOperation *operation = mOperations[i];
if (operation) {
operation->GetName(name);
if (name.Equals(aName)) {
*aOperation = operation;
NS_ADDREF(*aOperation);
@ -115,7 +119,7 @@ nsWSDLPort::GetOperationByName(const nsAString& aName,
}
NS_IMETHODIMP
nsWSDLPort::GetBinding(nsIWSDLBinding** aBinding)
nsWSDLPort::GetBinding(nsIWSDLBinding** aBinding)
{
NS_ENSURE_ARG_POINTER(aBinding);
@ -125,7 +129,7 @@ nsWSDLPort::GetBinding(nsIWSDLBinding** aBinding)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLPort::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -133,16 +137,16 @@ nsWSDLPort::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLPort::AddOperation(nsIWSDLOperation* aOperation)
{
NS_ENSURE_ARG(aOperation);
return mOperations.AppendElement(aOperation);
return mOperations.AppendObject(aOperation) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
nsWSDLPort::SetBinding(nsIWSDLBinding* aBinding)
nsresult
nsWSDLPort::SetBinding(nsIWSDLBinding* aBinding)
{
mBinding = aBinding;
@ -155,8 +159,8 @@ nsWSDLPort::SetBinding(nsIWSDLBinding* aBinding)
//
////////////////////////////////////////////////////////////
nsSOAPPortBinding::nsSOAPPortBinding(const nsAString& aName)
: mName(aName), mStyle(STYLE_RPC),
mSoapVersion(nsISOAPPortBinding::SOAP_VERSION_UNKNOWN)
: mName(aName), mSoapVersion(nsISOAPPortBinding::SOAP_VERSION_UNKNOWN),
mStyle(STYLE_RPC)
{
}
@ -164,8 +168,7 @@ nsSOAPPortBinding::~nsSOAPPortBinding()
{
}
NS_IMPL_ISUPPORTS2_CI(nsSOAPPortBinding,
nsIWSDLBinding,
NS_IMPL_ISUPPORTS3_CI(nsSOAPPortBinding, nsIWSDLBinding, nsIWSDLSOAPBinding,
nsISOAPPortBinding)
/* readonly attribute AString protocol; */
@ -173,7 +176,7 @@ NS_IMETHODIMP
nsSOAPPortBinding::GetProtocol(nsAString& aProtocol)
{
aProtocol.Assign(NS_LITERAL_STRING("soap"));
return NS_OK;
}
@ -182,15 +185,15 @@ NS_IMETHODIMP
nsSOAPPortBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
/* readonly attribute AString bindingName; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPortBinding::GetName(nsAString & aBindingName)
{
aBindingName.Assign(mName);
@ -199,7 +202,7 @@ nsSOAPPortBinding::GetName(nsAString & aBindingName)
}
/* readonly attribute AString address; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPortBinding::GetAddress(nsAString & aAddress)
{
aAddress.Assign(mAddress);
@ -208,7 +211,7 @@ nsSOAPPortBinding::GetAddress(nsAString & aAddress)
}
/* readonly attribute unsigned short style; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPortBinding::GetStyle(PRUint16 *aStyle)
{
NS_ENSURE_ARG_POINTER(aStyle);
@ -219,7 +222,7 @@ nsSOAPPortBinding::GetStyle(PRUint16 *aStyle)
}
/* readonly attribute AString transport; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPortBinding::GetTransport(nsAString & aTransport)
{
aTransport.Assign(mTransport);
@ -236,7 +239,7 @@ nsSOAPPortBinding::GetSoapVersion(PRUint16 *aVersion)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPPortBinding::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -244,7 +247,7 @@ nsSOAPPortBinding::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPPortBinding::SetAddress(const nsAString& aAddress)
{
mAddress.Assign(aAddress);
@ -252,15 +255,15 @@ nsSOAPPortBinding::SetAddress(const nsAString& aAddress)
return NS_OK;
}
NS_IMETHODIMP
nsSOAPPortBinding::SetStyle(PRUint16 aStyle)
nsresult
nsSOAPPortBinding::SetStyle(PRUint16 aStyle)
{
mStyle = aStyle;
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPPortBinding::SetTransport(const nsAString& aTransport)
{
mTransport.Assign(aTransport);
@ -268,7 +271,7 @@ nsSOAPPortBinding::SetTransport(const nsAString& aTransport)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPPortBinding::SetSoapVersion(PRUint16 aVersion)
{
mSoapVersion = aVersion;
@ -292,7 +295,7 @@ nsWSDLOperation::~nsWSDLOperation()
NS_IMPL_ISUPPORTS1_CI(nsWSDLOperation, nsIWSDLOperation)
/* readonly attribute AString name; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetName(nsAString & aName)
{
aName.Assign(mName);
@ -301,19 +304,19 @@ nsWSDLOperation::GetName(nsAString & aName)
}
/* readonly attribute nsIDOMElement documentation; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
/* readonly attribute nsIWSDLMessage input; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetInput(nsIWSDLMessage * *aInput)
{
NS_ENSURE_ARG_POINTER(aInput);
@ -325,7 +328,7 @@ nsWSDLOperation::GetInput(nsIWSDLMessage * *aInput)
}
/* readonly attribute nsIWSDLMessage output; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetOutput(nsIWSDLMessage * *aOutput)
{
NS_ENSURE_ARG_POINTER(aOutput);
@ -342,21 +345,29 @@ nsWSDLOperation::GetFaultCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
return mFaultMessages.Count(aCount);
*aCount = mFaultMessages.Count();
return NS_OK;
}
/* nsIWSDLMessage getFault(in PRUint32 index); */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetFault(PRUint32 aIndex, nsIWSDLMessage * *aFault)
{
NS_ENSURE_ARG_POINTER(aFault);
return mFaultMessages.QueryElementAt(aIndex, NS_GET_IID(nsIWSDLMessage),
(void**)aFault);
if (aIndex < (PRUint32)mFaultMessages.Count()) {
*aFault = mFaultMessages[aIndex];
NS_IF_ADDREF(*aFault);
} else {
*aFault = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP
nsWSDLOperation::GetBinding(nsIWSDLBinding** aBinding)
nsWSDLOperation::GetBinding(nsIWSDLBinding** aBinding)
{
NS_ENSURE_ARG_POINTER(aBinding);
@ -367,7 +378,7 @@ nsWSDLOperation::GetBinding(nsIWSDLBinding** aBinding)
}
/* readonly attribute PRUint32 parameterOrderCount; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetParameterOrderCount(PRUint32 *aParameterCount)
{
NS_ENSURE_ARG_POINTER(aParameterCount);
@ -378,7 +389,7 @@ nsWSDLOperation::GetParameterOrderCount(PRUint32 *aParameterCount)
}
/* AString getParameter (in PRUint32 index); */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetParameter(PRUint32 index, nsAString & _retval)
{
nsString* str = mParameters.StringAt((PRInt32)index);
@ -401,11 +412,11 @@ nsWSDLOperation::GetParameterIndex(const nsAString& aName,
if (*aIndex == -1) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -413,7 +424,7 @@ nsWSDLOperation::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::SetInput(nsIWSDLMessage* aInputMessage)
{
mInputMessage = aInputMessage;
@ -421,7 +432,7 @@ nsWSDLOperation::SetInput(nsIWSDLMessage* aInputMessage)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::SetOutput(nsIWSDLMessage* aOutputMessage)
{
mOutputMessage = aOutputMessage;
@ -429,27 +440,28 @@ nsWSDLOperation::SetOutput(nsIWSDLMessage* aOutputMessage)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::AddFault(nsIWSDLMessage* aFaultMessage)
{
NS_ENSURE_ARG(aFaultMessage);
return mFaultMessages.AppendElement(aFaultMessage);
return mFaultMessages.AppendObject(aFaultMessage) ?
NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
nsWSDLOperation::SetBinding(nsIWSDLBinding* aBinding)
nsresult
nsWSDLOperation::SetBinding(nsIWSDLBinding* aBinding)
{
mBinding = aBinding;
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::AddParameter(const nsAString& aParameter)
{
mParameters.AppendString(aParameter);
return NS_OK;
}
@ -459,7 +471,7 @@ nsWSDLOperation::AddParameter(const nsAString& aParameter)
//
////////////////////////////////////////////////////////////
nsSOAPOperationBinding::nsSOAPOperationBinding()
: mStyle(nsISOAPPortBinding::STYLE_RPC)
: mStyle(nsIWSDLSOAPBinding::STYLE_RPC)
{
}
@ -467,16 +479,15 @@ nsSOAPOperationBinding::~nsSOAPOperationBinding()
{
}
NS_IMPL_ISUPPORTS2_CI(nsSOAPOperationBinding,
nsIWSDLBinding,
nsISOAPOperationBinding)
NS_IMPL_ISUPPORTS3_CI(nsSOAPOperationBinding, nsIWSDLBinding,
nsIWSDLSOAPBinding, nsISOAPOperationBinding)
/* readonly attribute AString protocol; */
NS_IMETHODIMP
nsSOAPOperationBinding::GetProtocol(nsAString& aProtocol)
{
aProtocol.Assign(NS_LITERAL_STRING("soap"));
return NS_OK;
}
@ -485,15 +496,15 @@ NS_IMETHODIMP
nsSOAPOperationBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
/* readonly attribute unsigned short style; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPOperationBinding::GetStyle(PRUint16 *aStyle)
{
NS_ENSURE_ARG_POINTER(aStyle);
@ -504,7 +515,7 @@ nsSOAPOperationBinding::GetStyle(PRUint16 *aStyle)
}
/* readonly attribute AString soapAction; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPOperationBinding::GetSoapAction(nsAString & aSoapAction)
{
aSoapAction.Assign(mSoapAction);
@ -512,7 +523,7 @@ nsSOAPOperationBinding::GetSoapAction(nsAString & aSoapAction)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPOperationBinding::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -520,7 +531,7 @@ nsSOAPOperationBinding::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPOperationBinding::SetStyle(PRUint16 aStyle)
{
mStyle = aStyle;
@ -528,11 +539,11 @@ nsSOAPOperationBinding::SetStyle(PRUint16 aStyle)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPOperationBinding::SetSoapAction(const nsAString& aAction)
{
mSoapAction.Assign(aAction);
return NS_OK;
}
@ -553,7 +564,7 @@ nsWSDLMessage::~nsWSDLMessage()
NS_IMPL_ISUPPORTS1_CI(nsWSDLMessage, nsIWSDLMessage)
/* readonly attribute AString name; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLMessage::GetName(nsAString & aName)
{
aName.Assign(mName);
@ -562,19 +573,19 @@ nsWSDLMessage::GetName(nsAString & aName)
}
/* readonly attribute nsIDOMElement documentation; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLMessage::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
NS_IMETHODIMP
nsWSDLMessage::GetBinding(nsIWSDLBinding** aBinding)
nsWSDLMessage::GetBinding(nsIWSDLBinding** aBinding)
{
NS_ENSURE_ARG_POINTER(aBinding);
@ -585,47 +596,49 @@ nsWSDLMessage::GetBinding(nsIWSDLBinding** aBinding)
}
/* readonly attribute PRUint32 partCount; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLMessage::GetPartCount(PRUint32 *aPartCount)
{
NS_ENSURE_ARG_POINTER(aPartCount);
return mParts.Count(aPartCount);
*aPartCount = mParts.Count();
return NS_OK;
}
/* nsIWSDLPart getPart (in PRUint32 index); */
NS_IMETHODIMP
nsWSDLMessage::GetPart(PRUint32 index, nsIWSDLPart **_retval)
NS_IMETHODIMP
nsWSDLMessage::GetPart(PRUint32 aIndex, nsIWSDLPart **_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
return mParts.QueryElementAt(index, NS_GET_IID(nsIWSDLPart),
(void**)_retval);
if (aIndex < (PRUint32)mParts.Count()) {
*_retval = mParts[aIndex];
NS_IF_ADDREF(*_retval);
} else {
*_retval = nsnull;
}
return NS_OK;
}
/* nsIWSDLPart getPartByName(in AString name); */
NS_IMETHODIMP
nsWSDLMessage::GetPartByName(const nsAString& aName,
nsIWSDLPart** aPart)
nsWSDLMessage::GetPartByName(const nsAString& aName, nsIWSDLPart** aPart)
{
nsresult rv;
nsAutoString name;
*aPart = nsnull;
// XXX Do a linear search for now. If more efficiency is needed
// we can store the part in a hash as well.
PRUint32 index, count;
mParts.Count(&count);
PRUint32 i, count = mParts.Count();
for (index = 0; index < count; index++) {
nsCOMPtr<nsIWSDLPart> part;
rv = mParts.QueryElementAt(index, NS_GET_IID(nsIWSDLPart),
getter_AddRefs(part));
if (NS_SUCCEEDED(rv)) {
nsAutoString name;
for (i = 0; i < count; i++) {
nsIWSDLPart *part = mParts[i];
if (part) {
part->GetName(name);
if (name.Equals(aName)) {
*aPart = part;
NS_ADDREF(*aPart);
@ -637,7 +650,7 @@ nsWSDLMessage::GetPartByName(const nsAString& aName,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLMessage::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -645,16 +658,16 @@ nsWSDLMessage::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLMessage::AddPart(nsIWSDLPart* aPart)
{
NS_ENSURE_ARG(aPart);
return mParts.AppendElement(aPart);
return mParts.AppendObject(aPart) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
nsWSDLMessage::SetBinding(nsIWSDLBinding* aBinding)
nsresult
nsWSDLMessage::SetBinding(nsIWSDLBinding* aBinding)
{
mBinding = aBinding;
@ -675,8 +688,7 @@ nsSOAPMessageBinding::~nsSOAPMessageBinding()
{
}
NS_IMPL_ISUPPORTS2_CI(nsSOAPMessageBinding,
nsIWSDLBinding,
NS_IMPL_ISUPPORTS3_CI(nsSOAPMessageBinding, nsIWSDLBinding, nsIWSDLSOAPBinding,
nsISOAPMessageBinding)
/* readonly attribute AString protocol; */
@ -684,7 +696,7 @@ NS_IMETHODIMP
nsSOAPMessageBinding::GetProtocol(nsAString& aProtocol)
{
aProtocol.Assign(NS_LITERAL_STRING("soap"));
return NS_OK;
}
@ -693,14 +705,14 @@ NS_IMETHODIMP
nsSOAPMessageBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = nsnull;
return NS_OK;
}
/* readonly attribute AString namespace; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPMessageBinding::GetNamespace(nsAString & aNamespace)
{
aNamespace.Assign(mNamespace);
@ -725,7 +737,7 @@ nsWSDLPart::~nsWSDLPart()
NS_IMPL_ISUPPORTS1_CI(nsWSDLPart, nsIWSDLPart)
/* readonly attribute AString name; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPart::GetName(nsAString & aName)
{
aName.Assign(mName);
@ -734,7 +746,7 @@ nsWSDLPart::GetName(nsAString & aName)
}
/* readonly attribute AString type; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPart::GetType(nsAString & aType)
{
aType.Assign(mType);
@ -743,7 +755,7 @@ nsWSDLPart::GetType(nsAString & aType)
}
/* readonly attribute AString elementName; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPart::GetElementName(nsAString & aElementName)
{
aElementName.Assign(mElementName);
@ -752,7 +764,7 @@ nsWSDLPart::GetElementName(nsAString & aElementName)
}
/* readonly attribute nsISchemaComponent schemaComponent; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPart::GetSchemaComponent(nsISchemaComponent * *aSchemaComponent)
{
NS_ENSURE_ARG_POINTER(aSchemaComponent);
@ -764,7 +776,7 @@ nsWSDLPart::GetSchemaComponent(nsISchemaComponent * *aSchemaComponent)
}
NS_IMETHODIMP
nsWSDLPart::GetBinding(nsIWSDLBinding** aBinding)
nsWSDLPart::GetBinding(nsIWSDLBinding** aBinding)
{
NS_ENSURE_ARG_POINTER(aBinding);
@ -774,9 +786,8 @@ nsWSDLPart::GetBinding(nsIWSDLBinding** aBinding)
return NS_OK;
}
NS_IMETHODIMP
nsWSDLPart::SetTypeInfo(const nsAString& aType,
const nsAString& aElementName,
nsresult
nsWSDLPart::SetTypeInfo(const nsAString& aType, const nsAString& aElementName,
nsISchemaComponent* aSchemaComponent)
{
mType.Assign(aType);
@ -786,8 +797,8 @@ nsWSDLPart::SetTypeInfo(const nsAString& aType,
return NS_OK;
}
NS_IMETHODIMP
nsWSDLPart::SetBinding(nsIWSDLBinding* aBinding)
nsresult
nsWSDLPart::SetBinding(nsIWSDLBinding* aBinding)
{
mBinding = aBinding;
@ -802,8 +813,8 @@ nsWSDLPart::SetBinding(nsIWSDLBinding* aBinding)
nsSOAPPartBinding::nsSOAPPartBinding(PRUint16 aLocation, PRUint16 aUse,
const nsAString& aEncodingStyle,
const nsAString& aNamespace)
: mLocation(aLocation), mUse(aUse),
mEncodingStyle(aEncodingStyle), mNamespace(aNamespace)
: mLocation(aLocation), mUse(aUse), mEncodingStyle(aEncodingStyle),
mNamespace(aNamespace)
{
}
@ -811,8 +822,7 @@ nsSOAPPartBinding::~nsSOAPPartBinding()
{
}
NS_IMPL_ISUPPORTS2_CI(nsSOAPPartBinding,
nsIWSDLBinding,
NS_IMPL_ISUPPORTS3_CI(nsSOAPPartBinding, nsIWSDLBinding, nsIWSDLSOAPBinding,
nsISOAPPartBinding)
/* readonly attribute AString protocol; */
@ -820,7 +830,7 @@ NS_IMETHODIMP
nsSOAPPartBinding::GetProtocol(nsAString& aProtocol)
{
aProtocol.Assign(NS_LITERAL_STRING("soap"));
return NS_OK;
}
@ -829,14 +839,14 @@ NS_IMETHODIMP
nsSOAPPartBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = nsnull;
return NS_OK;
}
/* readonly attribute unsigned short location; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPartBinding::GetLocation(PRUint16 *aLocation)
{
NS_ENSURE_ARG_POINTER(aLocation);
@ -847,7 +857,7 @@ nsSOAPPartBinding::GetLocation(PRUint16 *aLocation)
}
/* readonly attribute unsigned short use; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPartBinding::GetUse(PRUint16 *aUse)
{
NS_ENSURE_ARG_POINTER(aUse);
@ -858,7 +868,7 @@ nsSOAPPartBinding::GetUse(PRUint16 *aUse)
}
/* readonly attribute AString encodingStyle; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPartBinding::GetEncodingStyle(nsAString & aEncodingStyle)
{
aEncodingStyle.Assign(mEncodingStyle);
@ -867,7 +877,7 @@ nsSOAPPartBinding::GetEncodingStyle(nsAString & aEncodingStyle)
}
/* readonly attribute AString namespace; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPartBinding::GetNamespace(nsAString & aNamespace)
{
aNamespace.Assign(mNamespace);

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,6 @@
// XPCOM Includes
#include "nsCOMPtr.h"
#include "nsSupportsArray.h"
#include "nsString.h"
#include "nsIAtom.h"
#include "nsHashtable.h"
@ -50,9 +49,10 @@
#define NS_ERROR_WSDL_LOADPENDING NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 1)
class nsWSDLAtoms {
class nsWSDLAtoms
{
public:
static void CreateWSDLAtoms();
static nsresult CreateWSDLAtoms();
static void DestroyWSDLAtoms();
static nsIAtom* sDefinitions_atom;
@ -74,9 +74,12 @@ public:
static nsIAtom* sHeader_atom;
static nsIAtom* sHeaderFault_atom;
static nsIAtom* sAddress_atom;
static nsIAtom* sSchema_atom;
};
class nsWSDLLoader : public nsIWSDLLoader {
class nsWSDLLoader : public nsIWSDLLoader
{
public:
nsWSDLLoader();
virtual ~nsWSDLLoader();
@ -85,45 +88,59 @@ public:
NS_DECL_NSIWSDLLOADER
nsresult Init();
protected:
nsresult doLoad(const nsAString& wsdlURI, const nsAString& portName,
nsIWSDLLoadListener *aListener, nsIWSDLPort **_retval);
nsresult GetResolvedURI(const nsAString& aSchemaURI,
const char* aMethod,
nsIURI** aURI);
protected:
nsWSDLPort* mPort;
};
class nsWSDLLoadingContext {
class nsWSDLLoadingContext
{
public:
nsWSDLLoadingContext(nsIDOMDocument* aDocument,
const nsAString& aLocation) :
mDocument(aDocument), mChildIndex(0), mDocumentLocation(aLocation) {
const nsAString& aLocation)
: mDocument(aDocument), mChildIndex(0), mDocumentLocation(aLocation)
{
}
~nsWSDLLoadingContext() {
~nsWSDLLoadingContext()
{
}
void GetRootElement(nsIDOMElement** aElement) {
void GetRootElement(nsIDOMElement** aElement)
{
mDocument->GetDocumentElement(aElement);
}
PRUint32 GetChildIndex() { return mChildIndex; }
void SetChildIndex(PRUint32 aChildIndex) { mChildIndex = aChildIndex; }
PRUint32 GetChildIndex()
{
return mChildIndex;
}
void SetChildIndex(PRUint32 aChildIndex)
{
mChildIndex = aChildIndex;
}
void GetTargetNamespace(nsAString& aNamespace) {
void GetTargetNamespace(nsAString& aNamespace)
{
nsCOMPtr<nsIDOMElement> element;
GetRootElement(getter_AddRefs(element));
if (element) {
element->GetAttribute(NS_LITERAL_STRING("targetNamespace"),
aNamespace);
element->GetAttribute(NS_LITERAL_STRING("targetNamespace"), aNamespace);
}
else {
aNamespace.Truncate();
}
}
void GetDocumentLocation(nsAString& aLocation) {
void GetDocumentLocation(nsAString& aLocation)
{
aLocation.Assign(mDocumentLocation);
}
@ -139,8 +156,7 @@ protected:
class nsWSDLLoadRequest : public nsIDOMEventListener
{
public:
nsWSDLLoadRequest(PRBool aIsSync,
nsIWSDLLoadListener* aListener,
nsWSDLLoadRequest(PRBool aIsSync, nsIWSDLLoadListener* aListener,
const nsAString& aPortName);
virtual ~nsWSDLLoadRequest();
@ -152,26 +168,21 @@ public:
nsresult ContineProcessingTillDone();
nsresult GetPort(nsIWSDLPort** aPort);
nsresult PushContext(nsIDOMDocument* aDocument,
const nsAString& aLocation);
nsresult PushContext(nsIDOMDocument* aDocument, const nsAString& aLocation);
nsWSDLLoadingContext* GetCurrentContext();
void PopContext();
nsresult GetSchemaElement(const nsAString& aName,
const nsAString& aNamespace,
nsISchemaElement** aSchemaComponent);
nsresult GetSchemaType(const nsAString& aName,
const nsAString& aNamespace,
nsresult GetSchemaType(const nsAString& aName, const nsAString& aNamespace,
nsISchemaType** aSchemaComponent);
nsresult GetMessage(const nsAString& aName,
const nsAString& aNamespace,
nsresult GetMessage(const nsAString& aName, const nsAString& aNamespace,
nsIWSDLMessage** aMessage);
nsresult GetPortType(const nsAString& aName,
const nsAString& aNamespace,
nsresult GetPortType(const nsAString& aName, const nsAString& aNamespace,
nsIWSDLPort** aPort);
nsresult ProcessImportElement(nsIDOMElement* aElement,
PRUint32 aIndex);
nsresult ProcessImportElement(nsIDOMElement* aElement, PRUint32 aIndex);
nsresult ProcessTypesElement(nsIDOMElement* aElement);
nsresult ProcessMessageElement(nsIDOMElement* aElement);
nsresult ProcessAbstractPartElement(nsIDOMElement* aElement,
@ -194,7 +205,7 @@ protected:
nsCOMPtr<nsIXMLHttpRequest> mRequest;
nsCOMPtr<nsISchemaLoader> mSchemaLoader;
PRBool mIsSync;
PRPackedBool mIsSync;
nsCOMPtr<nsIWSDLPort> mPort;
nsString mPortName;

View File

@ -4,20 +4,20 @@
* 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):
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
@ -35,8 +35,7 @@
// XPCOM Includes
#include "nsCOMPtr.h"
#include "nsVoidArray.h"
#include "nsSupportsArray.h"
#include "nsCOMArray.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsWeakReference.h"
@ -51,31 +50,33 @@
#define NS_WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/"
#define NS_WSDL_SOAP_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/"
class nsSOAPPortBinding : public nsISOAPPortBinding {
class nsSOAPPortBinding : public nsISOAPPortBinding
{
public:
nsSOAPPortBinding(const nsAString& aName);
virtual ~nsSOAPPortBinding();
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLBINDING
NS_DECL_NSISOAPPORTBINDING
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD SetAddress(const nsAString& aAddress);
NS_IMETHOD SetStyle(PRUint16 aStyle);
NS_IMETHOD SetTransport(const nsAString& aTransport);
NS_IMETHOD SetSoapVersion(PRUint16 aSoapVersion);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult SetAddress(const nsAString& aAddress);
nsresult SetStyle(PRUint16 aStyle);
nsresult SetTransport(const nsAString& aTransport);
nsresult SetSoapVersion(PRUint16 aSoapVersion);
protected:
nsString mName;
nsString mAddress;
PRUint16 mStyle;
nsString mTransport;
nsString mAddress;
nsString mTransport;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
PRUint16 mSoapVersion;
PRUint16 mStyle;
};
class nsWSDLPort : public nsIWSDLPort {
class nsWSDLPort : public nsIWSDLPort
{
public:
nsWSDLPort(const nsAString &aName);
virtual ~nsWSDLPort();
@ -83,18 +84,19 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLPORT
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD AddOperation(nsIWSDLOperation* aOperation);
NS_IMETHOD SetBinding(nsIWSDLBinding* aBinding);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult AddOperation(nsIWSDLOperation* aOperation);
nsresult SetBinding(nsIWSDLBinding* aBinding);
protected:
nsString mName;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
nsSupportsArray mOperations;
nsCOMArray<nsIWSDLOperation> mOperations;
nsCOMPtr<nsIWSDLBinding> mBinding;
};
class nsSOAPOperationBinding : public nsISOAPOperationBinding {
class nsSOAPOperationBinding : public nsISOAPOperationBinding
{
public:
nsSOAPOperationBinding();
virtual ~nsSOAPOperationBinding();
@ -103,17 +105,18 @@ public:
NS_DECL_NSIWSDLBINDING
NS_DECL_NSISOAPOPERATIONBINDING
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD SetStyle(PRUint16 aStyle);
NS_IMETHOD SetSoapAction(const nsAString& aAction);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult SetStyle(PRUint16 aStyle);
nsresult SetSoapAction(const nsAString& aAction);
protected:
PRUint16 mStyle;
nsString mSoapAction;
nsString mSoapAction;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
PRUint16 mStyle;
};
class nsWSDLOperation : public nsIWSDLOperation {
class nsWSDLOperation : public nsIWSDLOperation
{
public:
nsWSDLOperation(const nsAString &aName);
virtual ~nsWSDLOperation();
@ -121,24 +124,25 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLOPERATION
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD SetInput(nsIWSDLMessage* aInputMessage);
NS_IMETHOD SetOutput(nsIWSDLMessage* aOutputMessage);
NS_IMETHOD AddFault(nsIWSDLMessage* aFaultMessage);
NS_IMETHOD AddParameter(const nsAString& aParameter);
NS_IMETHOD SetBinding(nsIWSDLBinding* aBinding);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult SetInput(nsIWSDLMessage* aInputMessage);
nsresult SetOutput(nsIWSDLMessage* aOutputMessage);
nsresult AddFault(nsIWSDLMessage* aFaultMessage);
nsresult AddParameter(const nsAString& aParameter);
nsresult SetBinding(nsIWSDLBinding* aBinding);
protected:
nsString mName;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
nsCOMPtr<nsIWSDLMessage> mInputMessage;
nsCOMPtr<nsIWSDLMessage> mOutputMessage;
nsSupportsArray mFaultMessages;
nsCOMArray<nsIWSDLMessage> mFaultMessages;
nsStringArray mParameters;
nsCOMPtr<nsIWSDLBinding> mBinding;
};
class nsSOAPMessageBinding : public nsISOAPMessageBinding {
class nsSOAPMessageBinding : public nsISOAPMessageBinding
{
public:
nsSOAPMessageBinding(const nsAString& aNamespace);
virtual ~nsSOAPMessageBinding();
@ -151,7 +155,8 @@ protected:
nsString mNamespace;
};
class nsWSDLMessage : public nsIWSDLMessage {
class nsWSDLMessage : public nsIWSDLMessage
{
public:
nsWSDLMessage(const nsAString& aName);
virtual ~nsWSDLMessage();
@ -159,18 +164,19 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLMESSAGE
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD AddPart(nsIWSDLPart* aPart);
NS_IMETHOD SetBinding(nsIWSDLBinding* aBinding);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult AddPart(nsIWSDLPart* aPart);
nsresult SetBinding(nsIWSDLBinding* aBinding);
protected:
nsString mName;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
nsSupportsArray mParts;
nsCOMArray<nsIWSDLPart> mParts;
nsCOMPtr<nsIWSDLBinding> mBinding;
};
class nsSOAPPartBinding : public nsISOAPPartBinding {
class nsSOAPPartBinding : public nsISOAPPartBinding
{
public:
nsSOAPPartBinding(PRUint16 aLocation, PRUint16 aUse,
const nsAString& aEncodingStyle,
@ -185,10 +191,11 @@ protected:
PRUint16 mLocation;
PRUint16 mUse;
nsString mEncodingStyle;
nsString mNamespace;
nsString mNamespace;
};
class nsWSDLPart : public nsIWSDLPart {
class nsWSDLPart : public nsIWSDLPart
{
public:
nsWSDLPart(const nsAString& aName);
virtual ~nsWSDLPart();
@ -196,10 +203,9 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLPART
NS_IMETHOD SetTypeInfo(const nsAString& aType,
const nsAString& aElementName,
nsISchemaComponent* aSchemaComponent);
NS_IMETHOD SetBinding(nsIWSDLBinding* aBinding);
nsresult SetTypeInfo(const nsAString& aType, const nsAString& aElementName,
nsISchemaComponent* aSchemaComponent);
nsresult SetBinding(nsIWSDLBinding* aBinding);
protected:
nsString mName;

View File

@ -36,7 +36,8 @@ interface nsIWSDLPart;
interface nsIDOMElement;
[scriptable, uuid(0458dac1-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLPort : nsISupports {
interface nsIWSDLPort : nsISupports
{
readonly attribute AString name;
readonly attribute nsIDOMElement documentation;
@ -48,7 +49,8 @@ interface nsIWSDLPort : nsISupports {
};
[scriptable, uuid(0458dac2-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLOperation : nsISupports {
interface nsIWSDLOperation : nsISupports
{
readonly attribute AString name;
readonly attribute nsIDOMElement documentation;
@ -65,7 +67,8 @@ interface nsIWSDLOperation : nsISupports {
};
[scriptable, uuid(0458dac3-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLMessage : nsISupports {
interface nsIWSDLMessage : nsISupports
{
readonly attribute AString name;
readonly attribute nsIDOMElement documentation;
@ -77,7 +80,8 @@ interface nsIWSDLMessage : nsISupports {
};
[scriptable, uuid(0458dac4-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLPart : nsISupports {
interface nsIWSDLPart : nsISupports
{
readonly attribute AString name;
readonly attribute nsIWSDLBinding binding;
@ -94,7 +98,8 @@ interface nsIWSDLPart : nsISupports {
};
[scriptable, uuid(0458dac0-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLBinding : nsISupports {
interface nsIWSDLBinding : nsISupports
{
readonly attribute AString protocol;
readonly attribute nsIDOMElement documentation;
};

View File

@ -4,20 +4,20 @@
* 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):
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
@ -25,26 +25,26 @@
%{ C++
#include "nsAString.h"
%}
%}
interface nsIWSDLPort;
interface nsIWSDLLoadListener;
// Does this need to be scriptable, and exposed to scripters? We think
// not...
[scriptable, uuid(0458dac5-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLLoader : nsISupports {
interface nsIWSDLLoader : nsISupports
{
nsIWSDLPort load(in AString wsdlURI, in AString portName);
void loadAsync(in AString wsdlURI, in AString portName,
void loadAsync(in AString wsdlURI, in AString portName,
in nsIWSDLLoadListener listener);
nsISupports createPortProxy(in nsIWSDLPort service,
in AString nameSpace,
in boolean sync);
};
[scriptable, uuid(0458dac6-65de-11d5-9b42-00104bdf5339)]
interface nsIWSDLLoadListener : nsISupports {
interface nsIWSDLLoadListener : nsISupports
{
void onLoad(in nsIWSDLPort port);
void onError(in nsresult status,
in AString statusMessage);
void onError(in nsresult status, in AString statusMessage);
};
%{ C++

View File

@ -4,20 +4,20 @@
* 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):
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
@ -26,13 +26,18 @@
%{ C++
#include "nsAString.h"
%}
%}
[scriptable, uuid(0458dac7-65de-11d5-9b42-00104bdf5339)]
interface nsISOAPPortBinding : nsIWSDLBinding {
[scriptable, uuid(bb76b72e-d143-4738-804a-53b311466dd9)]
interface nsIWSDLSOAPBinding : nsIWSDLBinding
{
const unsigned short STYLE_RPC = 1;
const unsigned short STYLE_DOCUMENT = 2;
};
[scriptable, uuid(0458dac7-65de-11d5-9b42-00104bdf5339)]
interface nsISOAPPortBinding : nsIWSDLSOAPBinding
{
const unsigned short SOAP_VERSION_1_1 = 0;
const unsigned short SOAP_VERSION_1_2 = 1;
const unsigned short SOAP_VERSION_UNKNOWN = 32767;
@ -45,18 +50,21 @@ interface nsISOAPPortBinding : nsIWSDLBinding {
};
[scriptable, uuid(0458dac8-65de-11d5-9b42-00104bdf5339)]
interface nsISOAPOperationBinding : nsIWSDLBinding {
interface nsISOAPOperationBinding : nsIWSDLSOAPBinding
{
readonly attribute unsigned short style;
readonly attribute AString soapAction;
};
[scriptable, uuid(c3c4614c-301a-44af-ad70-936f9fd1ba5c)]
interface nsISOAPMessageBinding : nsIWSDLBinding {
interface nsISOAPMessageBinding : nsIWSDLSOAPBinding
{
readonly attribute AString namespace;
};
[scriptable, uuid(0458dac9-65de-11d5-9b42-00104bdf5339)]
interface nsISOAPPartBinding : nsIWSDLBinding {
interface nsISOAPPartBinding : nsIWSDLSOAPBinding
{
const unsigned short LOCATION_BODY = 1;
const unsigned short LOCATION_HEADER = 2;
const unsigned short LOCATION_FAULT = 3;

View File

@ -4,20 +4,20 @@
* 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):
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
@ -41,7 +41,7 @@ nsWSDLPort::~nsWSDLPort()
NS_IMPL_ISUPPORTS1_CI(nsWSDLPort, nsIWSDLPort)
/* readonly attribute AString name; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPort::GetName(nsAString & aName)
{
aName.Assign(mName);
@ -50,34 +50,42 @@ nsWSDLPort::GetName(nsAString & aName)
}
/* readonly attribute nsIDOMElement documentation; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPort::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
/* readonly attribute PRUint32 operationCount; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPort::GetOperationCount(PRUint32 *aOperationCount)
{
NS_ENSURE_ARG_POINTER(aOperationCount);
return mOperations.Count(aOperationCount);
*aOperationCount = mOperations.Count();
return NS_OK;
}
/* nsIWSDLOperation getOperation (in PRUint32 index); */
NS_IMETHODIMP
nsWSDLPort::GetOperation(PRUint32 index, nsIWSDLOperation **_retval)
NS_IMETHODIMP
nsWSDLPort::GetOperation(PRUint32 aIndex, nsIWSDLOperation **_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
return mOperations.QueryElementAt(index, NS_GET_IID(nsIWSDLOperation),
(void**)_retval);
if (aIndex < (PRUint32)mOperations.Count()) {
*_retval = mOperations[aIndex];
NS_IF_ADDREF(*_retval);
} else {
*_retval = nsnull;
}
return NS_OK;
}
/* nsIWSDLOperation getOperationByName(in AString name); */
@ -85,24 +93,20 @@ NS_IMETHODIMP
nsWSDLPort::GetOperationByName(const nsAString& aName,
nsIWSDLOperation** aOperation)
{
nsresult rv;
*aOperation = nsnull;
nsAutoString name;
// XXX Do a linear search for now. If more efficiency is needed
// we can store the opeartions in a hash as well.
PRUint32 index, count;
mOperations.Count(&count);
PRUint32 i, count = mOperations.Count();
for (index = 0; index < count; index++) {
nsCOMPtr<nsIWSDLOperation> operation;
rv = mOperations.QueryElementAt(index, NS_GET_IID(nsIWSDLOperation),
getter_AddRefs(operation));
if (NS_SUCCEEDED(rv)) {
nsAutoString name;
for (i = 0; i < count; i++) {
nsIWSDLOperation *operation = mOperations[i];
if (operation) {
operation->GetName(name);
if (name.Equals(aName)) {
*aOperation = operation;
NS_ADDREF(*aOperation);
@ -115,7 +119,7 @@ nsWSDLPort::GetOperationByName(const nsAString& aName,
}
NS_IMETHODIMP
nsWSDLPort::GetBinding(nsIWSDLBinding** aBinding)
nsWSDLPort::GetBinding(nsIWSDLBinding** aBinding)
{
NS_ENSURE_ARG_POINTER(aBinding);
@ -125,7 +129,7 @@ nsWSDLPort::GetBinding(nsIWSDLBinding** aBinding)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLPort::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -133,16 +137,16 @@ nsWSDLPort::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLPort::AddOperation(nsIWSDLOperation* aOperation)
{
NS_ENSURE_ARG(aOperation);
return mOperations.AppendElement(aOperation);
return mOperations.AppendObject(aOperation) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
nsWSDLPort::SetBinding(nsIWSDLBinding* aBinding)
nsresult
nsWSDLPort::SetBinding(nsIWSDLBinding* aBinding)
{
mBinding = aBinding;
@ -155,8 +159,8 @@ nsWSDLPort::SetBinding(nsIWSDLBinding* aBinding)
//
////////////////////////////////////////////////////////////
nsSOAPPortBinding::nsSOAPPortBinding(const nsAString& aName)
: mName(aName), mStyle(STYLE_RPC),
mSoapVersion(nsISOAPPortBinding::SOAP_VERSION_UNKNOWN)
: mName(aName), mSoapVersion(nsISOAPPortBinding::SOAP_VERSION_UNKNOWN),
mStyle(STYLE_RPC)
{
}
@ -164,8 +168,7 @@ nsSOAPPortBinding::~nsSOAPPortBinding()
{
}
NS_IMPL_ISUPPORTS2_CI(nsSOAPPortBinding,
nsIWSDLBinding,
NS_IMPL_ISUPPORTS3_CI(nsSOAPPortBinding, nsIWSDLBinding, nsIWSDLSOAPBinding,
nsISOAPPortBinding)
/* readonly attribute AString protocol; */
@ -173,7 +176,7 @@ NS_IMETHODIMP
nsSOAPPortBinding::GetProtocol(nsAString& aProtocol)
{
aProtocol.Assign(NS_LITERAL_STRING("soap"));
return NS_OK;
}
@ -182,15 +185,15 @@ NS_IMETHODIMP
nsSOAPPortBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
/* readonly attribute AString bindingName; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPortBinding::GetName(nsAString & aBindingName)
{
aBindingName.Assign(mName);
@ -199,7 +202,7 @@ nsSOAPPortBinding::GetName(nsAString & aBindingName)
}
/* readonly attribute AString address; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPortBinding::GetAddress(nsAString & aAddress)
{
aAddress.Assign(mAddress);
@ -208,7 +211,7 @@ nsSOAPPortBinding::GetAddress(nsAString & aAddress)
}
/* readonly attribute unsigned short style; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPortBinding::GetStyle(PRUint16 *aStyle)
{
NS_ENSURE_ARG_POINTER(aStyle);
@ -219,7 +222,7 @@ nsSOAPPortBinding::GetStyle(PRUint16 *aStyle)
}
/* readonly attribute AString transport; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPortBinding::GetTransport(nsAString & aTransport)
{
aTransport.Assign(mTransport);
@ -236,7 +239,7 @@ nsSOAPPortBinding::GetSoapVersion(PRUint16 *aVersion)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPPortBinding::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -244,7 +247,7 @@ nsSOAPPortBinding::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPPortBinding::SetAddress(const nsAString& aAddress)
{
mAddress.Assign(aAddress);
@ -252,15 +255,15 @@ nsSOAPPortBinding::SetAddress(const nsAString& aAddress)
return NS_OK;
}
NS_IMETHODIMP
nsSOAPPortBinding::SetStyle(PRUint16 aStyle)
nsresult
nsSOAPPortBinding::SetStyle(PRUint16 aStyle)
{
mStyle = aStyle;
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPPortBinding::SetTransport(const nsAString& aTransport)
{
mTransport.Assign(aTransport);
@ -268,7 +271,7 @@ nsSOAPPortBinding::SetTransport(const nsAString& aTransport)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPPortBinding::SetSoapVersion(PRUint16 aVersion)
{
mSoapVersion = aVersion;
@ -292,7 +295,7 @@ nsWSDLOperation::~nsWSDLOperation()
NS_IMPL_ISUPPORTS1_CI(nsWSDLOperation, nsIWSDLOperation)
/* readonly attribute AString name; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetName(nsAString & aName)
{
aName.Assign(mName);
@ -301,19 +304,19 @@ nsWSDLOperation::GetName(nsAString & aName)
}
/* readonly attribute nsIDOMElement documentation; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
/* readonly attribute nsIWSDLMessage input; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetInput(nsIWSDLMessage * *aInput)
{
NS_ENSURE_ARG_POINTER(aInput);
@ -325,7 +328,7 @@ nsWSDLOperation::GetInput(nsIWSDLMessage * *aInput)
}
/* readonly attribute nsIWSDLMessage output; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetOutput(nsIWSDLMessage * *aOutput)
{
NS_ENSURE_ARG_POINTER(aOutput);
@ -342,21 +345,29 @@ nsWSDLOperation::GetFaultCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
return mFaultMessages.Count(aCount);
*aCount = mFaultMessages.Count();
return NS_OK;
}
/* nsIWSDLMessage getFault(in PRUint32 index); */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetFault(PRUint32 aIndex, nsIWSDLMessage * *aFault)
{
NS_ENSURE_ARG_POINTER(aFault);
return mFaultMessages.QueryElementAt(aIndex, NS_GET_IID(nsIWSDLMessage),
(void**)aFault);
if (aIndex < (PRUint32)mFaultMessages.Count()) {
*aFault = mFaultMessages[aIndex];
NS_IF_ADDREF(*aFault);
} else {
*aFault = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP
nsWSDLOperation::GetBinding(nsIWSDLBinding** aBinding)
nsWSDLOperation::GetBinding(nsIWSDLBinding** aBinding)
{
NS_ENSURE_ARG_POINTER(aBinding);
@ -367,7 +378,7 @@ nsWSDLOperation::GetBinding(nsIWSDLBinding** aBinding)
}
/* readonly attribute PRUint32 parameterOrderCount; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetParameterOrderCount(PRUint32 *aParameterCount)
{
NS_ENSURE_ARG_POINTER(aParameterCount);
@ -378,7 +389,7 @@ nsWSDLOperation::GetParameterOrderCount(PRUint32 *aParameterCount)
}
/* AString getParameter (in PRUint32 index); */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLOperation::GetParameter(PRUint32 index, nsAString & _retval)
{
nsString* str = mParameters.StringAt((PRInt32)index);
@ -401,11 +412,11 @@ nsWSDLOperation::GetParameterIndex(const nsAString& aName,
if (*aIndex == -1) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -413,7 +424,7 @@ nsWSDLOperation::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::SetInput(nsIWSDLMessage* aInputMessage)
{
mInputMessage = aInputMessage;
@ -421,7 +432,7 @@ nsWSDLOperation::SetInput(nsIWSDLMessage* aInputMessage)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::SetOutput(nsIWSDLMessage* aOutputMessage)
{
mOutputMessage = aOutputMessage;
@ -429,27 +440,28 @@ nsWSDLOperation::SetOutput(nsIWSDLMessage* aOutputMessage)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::AddFault(nsIWSDLMessage* aFaultMessage)
{
NS_ENSURE_ARG(aFaultMessage);
return mFaultMessages.AppendElement(aFaultMessage);
return mFaultMessages.AppendObject(aFaultMessage) ?
NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
nsWSDLOperation::SetBinding(nsIWSDLBinding* aBinding)
nsresult
nsWSDLOperation::SetBinding(nsIWSDLBinding* aBinding)
{
mBinding = aBinding;
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLOperation::AddParameter(const nsAString& aParameter)
{
mParameters.AppendString(aParameter);
return NS_OK;
}
@ -459,7 +471,7 @@ nsWSDLOperation::AddParameter(const nsAString& aParameter)
//
////////////////////////////////////////////////////////////
nsSOAPOperationBinding::nsSOAPOperationBinding()
: mStyle(nsISOAPPortBinding::STYLE_RPC)
: mStyle(nsIWSDLSOAPBinding::STYLE_RPC)
{
}
@ -467,16 +479,15 @@ nsSOAPOperationBinding::~nsSOAPOperationBinding()
{
}
NS_IMPL_ISUPPORTS2_CI(nsSOAPOperationBinding,
nsIWSDLBinding,
nsISOAPOperationBinding)
NS_IMPL_ISUPPORTS3_CI(nsSOAPOperationBinding, nsIWSDLBinding,
nsIWSDLSOAPBinding, nsISOAPOperationBinding)
/* readonly attribute AString protocol; */
NS_IMETHODIMP
nsSOAPOperationBinding::GetProtocol(nsAString& aProtocol)
{
aProtocol.Assign(NS_LITERAL_STRING("soap"));
return NS_OK;
}
@ -485,15 +496,15 @@ NS_IMETHODIMP
nsSOAPOperationBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
/* readonly attribute unsigned short style; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPOperationBinding::GetStyle(PRUint16 *aStyle)
{
NS_ENSURE_ARG_POINTER(aStyle);
@ -504,7 +515,7 @@ nsSOAPOperationBinding::GetStyle(PRUint16 *aStyle)
}
/* readonly attribute AString soapAction; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPOperationBinding::GetSoapAction(nsAString & aSoapAction)
{
aSoapAction.Assign(mSoapAction);
@ -512,7 +523,7 @@ nsSOAPOperationBinding::GetSoapAction(nsAString & aSoapAction)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPOperationBinding::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -520,7 +531,7 @@ nsSOAPOperationBinding::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPOperationBinding::SetStyle(PRUint16 aStyle)
{
mStyle = aStyle;
@ -528,11 +539,11 @@ nsSOAPOperationBinding::SetStyle(PRUint16 aStyle)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsSOAPOperationBinding::SetSoapAction(const nsAString& aAction)
{
mSoapAction.Assign(aAction);
return NS_OK;
}
@ -553,7 +564,7 @@ nsWSDLMessage::~nsWSDLMessage()
NS_IMPL_ISUPPORTS1_CI(nsWSDLMessage, nsIWSDLMessage)
/* readonly attribute AString name; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLMessage::GetName(nsAString & aName)
{
aName.Assign(mName);
@ -562,19 +573,19 @@ nsWSDLMessage::GetName(nsAString & aName)
}
/* readonly attribute nsIDOMElement documentation; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLMessage::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = mDocumentationElement;
NS_IF_ADDREF(*aDocumentation);
return NS_OK;
}
NS_IMETHODIMP
nsWSDLMessage::GetBinding(nsIWSDLBinding** aBinding)
nsWSDLMessage::GetBinding(nsIWSDLBinding** aBinding)
{
NS_ENSURE_ARG_POINTER(aBinding);
@ -585,47 +596,49 @@ nsWSDLMessage::GetBinding(nsIWSDLBinding** aBinding)
}
/* readonly attribute PRUint32 partCount; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLMessage::GetPartCount(PRUint32 *aPartCount)
{
NS_ENSURE_ARG_POINTER(aPartCount);
return mParts.Count(aPartCount);
*aPartCount = mParts.Count();
return NS_OK;
}
/* nsIWSDLPart getPart (in PRUint32 index); */
NS_IMETHODIMP
nsWSDLMessage::GetPart(PRUint32 index, nsIWSDLPart **_retval)
NS_IMETHODIMP
nsWSDLMessage::GetPart(PRUint32 aIndex, nsIWSDLPart **_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
return mParts.QueryElementAt(index, NS_GET_IID(nsIWSDLPart),
(void**)_retval);
if (aIndex < (PRUint32)mParts.Count()) {
*_retval = mParts[aIndex];
NS_IF_ADDREF(*_retval);
} else {
*_retval = nsnull;
}
return NS_OK;
}
/* nsIWSDLPart getPartByName(in AString name); */
NS_IMETHODIMP
nsWSDLMessage::GetPartByName(const nsAString& aName,
nsIWSDLPart** aPart)
nsWSDLMessage::GetPartByName(const nsAString& aName, nsIWSDLPart** aPart)
{
nsresult rv;
nsAutoString name;
*aPart = nsnull;
// XXX Do a linear search for now. If more efficiency is needed
// we can store the part in a hash as well.
PRUint32 index, count;
mParts.Count(&count);
PRUint32 i, count = mParts.Count();
for (index = 0; index < count; index++) {
nsCOMPtr<nsIWSDLPart> part;
rv = mParts.QueryElementAt(index, NS_GET_IID(nsIWSDLPart),
getter_AddRefs(part));
if (NS_SUCCEEDED(rv)) {
nsAutoString name;
for (i = 0; i < count; i++) {
nsIWSDLPart *part = mParts[i];
if (part) {
part->GetName(name);
if (name.Equals(aName)) {
*aPart = part;
NS_ADDREF(*aPart);
@ -637,7 +650,7 @@ nsWSDLMessage::GetPartByName(const nsAString& aName,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLMessage::SetDocumentationElement(nsIDOMElement* aElement)
{
mDocumentationElement = aElement;
@ -645,16 +658,16 @@ nsWSDLMessage::SetDocumentationElement(nsIDOMElement* aElement)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsWSDLMessage::AddPart(nsIWSDLPart* aPart)
{
NS_ENSURE_ARG(aPart);
return mParts.AppendElement(aPart);
return mParts.AppendObject(aPart) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
nsWSDLMessage::SetBinding(nsIWSDLBinding* aBinding)
nsresult
nsWSDLMessage::SetBinding(nsIWSDLBinding* aBinding)
{
mBinding = aBinding;
@ -675,8 +688,7 @@ nsSOAPMessageBinding::~nsSOAPMessageBinding()
{
}
NS_IMPL_ISUPPORTS2_CI(nsSOAPMessageBinding,
nsIWSDLBinding,
NS_IMPL_ISUPPORTS3_CI(nsSOAPMessageBinding, nsIWSDLBinding, nsIWSDLSOAPBinding,
nsISOAPMessageBinding)
/* readonly attribute AString protocol; */
@ -684,7 +696,7 @@ NS_IMETHODIMP
nsSOAPMessageBinding::GetProtocol(nsAString& aProtocol)
{
aProtocol.Assign(NS_LITERAL_STRING("soap"));
return NS_OK;
}
@ -693,14 +705,14 @@ NS_IMETHODIMP
nsSOAPMessageBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = nsnull;
return NS_OK;
}
/* readonly attribute AString namespace; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPMessageBinding::GetNamespace(nsAString & aNamespace)
{
aNamespace.Assign(mNamespace);
@ -725,7 +737,7 @@ nsWSDLPart::~nsWSDLPart()
NS_IMPL_ISUPPORTS1_CI(nsWSDLPart, nsIWSDLPart)
/* readonly attribute AString name; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPart::GetName(nsAString & aName)
{
aName.Assign(mName);
@ -734,7 +746,7 @@ nsWSDLPart::GetName(nsAString & aName)
}
/* readonly attribute AString type; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPart::GetType(nsAString & aType)
{
aType.Assign(mType);
@ -743,7 +755,7 @@ nsWSDLPart::GetType(nsAString & aType)
}
/* readonly attribute AString elementName; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPart::GetElementName(nsAString & aElementName)
{
aElementName.Assign(mElementName);
@ -752,7 +764,7 @@ nsWSDLPart::GetElementName(nsAString & aElementName)
}
/* readonly attribute nsISchemaComponent schemaComponent; */
NS_IMETHODIMP
NS_IMETHODIMP
nsWSDLPart::GetSchemaComponent(nsISchemaComponent * *aSchemaComponent)
{
NS_ENSURE_ARG_POINTER(aSchemaComponent);
@ -764,7 +776,7 @@ nsWSDLPart::GetSchemaComponent(nsISchemaComponent * *aSchemaComponent)
}
NS_IMETHODIMP
nsWSDLPart::GetBinding(nsIWSDLBinding** aBinding)
nsWSDLPart::GetBinding(nsIWSDLBinding** aBinding)
{
NS_ENSURE_ARG_POINTER(aBinding);
@ -774,9 +786,8 @@ nsWSDLPart::GetBinding(nsIWSDLBinding** aBinding)
return NS_OK;
}
NS_IMETHODIMP
nsWSDLPart::SetTypeInfo(const nsAString& aType,
const nsAString& aElementName,
nsresult
nsWSDLPart::SetTypeInfo(const nsAString& aType, const nsAString& aElementName,
nsISchemaComponent* aSchemaComponent)
{
mType.Assign(aType);
@ -786,8 +797,8 @@ nsWSDLPart::SetTypeInfo(const nsAString& aType,
return NS_OK;
}
NS_IMETHODIMP
nsWSDLPart::SetBinding(nsIWSDLBinding* aBinding)
nsresult
nsWSDLPart::SetBinding(nsIWSDLBinding* aBinding)
{
mBinding = aBinding;
@ -802,8 +813,8 @@ nsWSDLPart::SetBinding(nsIWSDLBinding* aBinding)
nsSOAPPartBinding::nsSOAPPartBinding(PRUint16 aLocation, PRUint16 aUse,
const nsAString& aEncodingStyle,
const nsAString& aNamespace)
: mLocation(aLocation), mUse(aUse),
mEncodingStyle(aEncodingStyle), mNamespace(aNamespace)
: mLocation(aLocation), mUse(aUse), mEncodingStyle(aEncodingStyle),
mNamespace(aNamespace)
{
}
@ -811,8 +822,7 @@ nsSOAPPartBinding::~nsSOAPPartBinding()
{
}
NS_IMPL_ISUPPORTS2_CI(nsSOAPPartBinding,
nsIWSDLBinding,
NS_IMPL_ISUPPORTS3_CI(nsSOAPPartBinding, nsIWSDLBinding, nsIWSDLSOAPBinding,
nsISOAPPartBinding)
/* readonly attribute AString protocol; */
@ -820,7 +830,7 @@ NS_IMETHODIMP
nsSOAPPartBinding::GetProtocol(nsAString& aProtocol)
{
aProtocol.Assign(NS_LITERAL_STRING("soap"));
return NS_OK;
}
@ -829,14 +839,14 @@ NS_IMETHODIMP
nsSOAPPartBinding::GetDocumentation(nsIDOMElement * *aDocumentation)
{
NS_ENSURE_ARG_POINTER(aDocumentation);
*aDocumentation = nsnull;
return NS_OK;
}
/* readonly attribute unsigned short location; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPartBinding::GetLocation(PRUint16 *aLocation)
{
NS_ENSURE_ARG_POINTER(aLocation);
@ -847,7 +857,7 @@ nsSOAPPartBinding::GetLocation(PRUint16 *aLocation)
}
/* readonly attribute unsigned short use; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPartBinding::GetUse(PRUint16 *aUse)
{
NS_ENSURE_ARG_POINTER(aUse);
@ -858,7 +868,7 @@ nsSOAPPartBinding::GetUse(PRUint16 *aUse)
}
/* readonly attribute AString encodingStyle; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPartBinding::GetEncodingStyle(nsAString & aEncodingStyle)
{
aEncodingStyle.Assign(mEncodingStyle);
@ -867,7 +877,7 @@ nsSOAPPartBinding::GetEncodingStyle(nsAString & aEncodingStyle)
}
/* readonly attribute AString namespace; */
NS_IMETHODIMP
NS_IMETHODIMP
nsSOAPPartBinding::GetNamespace(nsAString & aNamespace)
{
aNamespace.Assign(mNamespace);

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,6 @@
// XPCOM Includes
#include "nsCOMPtr.h"
#include "nsSupportsArray.h"
#include "nsString.h"
#include "nsIAtom.h"
#include "nsHashtable.h"
@ -50,9 +49,10 @@
#define NS_ERROR_WSDL_LOADPENDING NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 1)
class nsWSDLAtoms {
class nsWSDLAtoms
{
public:
static void CreateWSDLAtoms();
static nsresult CreateWSDLAtoms();
static void DestroyWSDLAtoms();
static nsIAtom* sDefinitions_atom;
@ -74,9 +74,12 @@ public:
static nsIAtom* sHeader_atom;
static nsIAtom* sHeaderFault_atom;
static nsIAtom* sAddress_atom;
static nsIAtom* sSchema_atom;
};
class nsWSDLLoader : public nsIWSDLLoader {
class nsWSDLLoader : public nsIWSDLLoader
{
public:
nsWSDLLoader();
virtual ~nsWSDLLoader();
@ -85,45 +88,59 @@ public:
NS_DECL_NSIWSDLLOADER
nsresult Init();
protected:
nsresult doLoad(const nsAString& wsdlURI, const nsAString& portName,
nsIWSDLLoadListener *aListener, nsIWSDLPort **_retval);
nsresult GetResolvedURI(const nsAString& aSchemaURI,
const char* aMethod,
nsIURI** aURI);
protected:
nsWSDLPort* mPort;
};
class nsWSDLLoadingContext {
class nsWSDLLoadingContext
{
public:
nsWSDLLoadingContext(nsIDOMDocument* aDocument,
const nsAString& aLocation) :
mDocument(aDocument), mChildIndex(0), mDocumentLocation(aLocation) {
const nsAString& aLocation)
: mDocument(aDocument), mChildIndex(0), mDocumentLocation(aLocation)
{
}
~nsWSDLLoadingContext() {
~nsWSDLLoadingContext()
{
}
void GetRootElement(nsIDOMElement** aElement) {
void GetRootElement(nsIDOMElement** aElement)
{
mDocument->GetDocumentElement(aElement);
}
PRUint32 GetChildIndex() { return mChildIndex; }
void SetChildIndex(PRUint32 aChildIndex) { mChildIndex = aChildIndex; }
PRUint32 GetChildIndex()
{
return mChildIndex;
}
void SetChildIndex(PRUint32 aChildIndex)
{
mChildIndex = aChildIndex;
}
void GetTargetNamespace(nsAString& aNamespace) {
void GetTargetNamespace(nsAString& aNamespace)
{
nsCOMPtr<nsIDOMElement> element;
GetRootElement(getter_AddRefs(element));
if (element) {
element->GetAttribute(NS_LITERAL_STRING("targetNamespace"),
aNamespace);
element->GetAttribute(NS_LITERAL_STRING("targetNamespace"), aNamespace);
}
else {
aNamespace.Truncate();
}
}
void GetDocumentLocation(nsAString& aLocation) {
void GetDocumentLocation(nsAString& aLocation)
{
aLocation.Assign(mDocumentLocation);
}
@ -139,8 +156,7 @@ protected:
class nsWSDLLoadRequest : public nsIDOMEventListener
{
public:
nsWSDLLoadRequest(PRBool aIsSync,
nsIWSDLLoadListener* aListener,
nsWSDLLoadRequest(PRBool aIsSync, nsIWSDLLoadListener* aListener,
const nsAString& aPortName);
virtual ~nsWSDLLoadRequest();
@ -152,26 +168,21 @@ public:
nsresult ContineProcessingTillDone();
nsresult GetPort(nsIWSDLPort** aPort);
nsresult PushContext(nsIDOMDocument* aDocument,
const nsAString& aLocation);
nsresult PushContext(nsIDOMDocument* aDocument, const nsAString& aLocation);
nsWSDLLoadingContext* GetCurrentContext();
void PopContext();
nsresult GetSchemaElement(const nsAString& aName,
const nsAString& aNamespace,
nsISchemaElement** aSchemaComponent);
nsresult GetSchemaType(const nsAString& aName,
const nsAString& aNamespace,
nsresult GetSchemaType(const nsAString& aName, const nsAString& aNamespace,
nsISchemaType** aSchemaComponent);
nsresult GetMessage(const nsAString& aName,
const nsAString& aNamespace,
nsresult GetMessage(const nsAString& aName, const nsAString& aNamespace,
nsIWSDLMessage** aMessage);
nsresult GetPortType(const nsAString& aName,
const nsAString& aNamespace,
nsresult GetPortType(const nsAString& aName, const nsAString& aNamespace,
nsIWSDLPort** aPort);
nsresult ProcessImportElement(nsIDOMElement* aElement,
PRUint32 aIndex);
nsresult ProcessImportElement(nsIDOMElement* aElement, PRUint32 aIndex);
nsresult ProcessTypesElement(nsIDOMElement* aElement);
nsresult ProcessMessageElement(nsIDOMElement* aElement);
nsresult ProcessAbstractPartElement(nsIDOMElement* aElement,
@ -194,7 +205,7 @@ protected:
nsCOMPtr<nsIXMLHttpRequest> mRequest;
nsCOMPtr<nsISchemaLoader> mSchemaLoader;
PRBool mIsSync;
PRPackedBool mIsSync;
nsCOMPtr<nsIWSDLPort> mPort;
nsString mPortName;

View File

@ -4,20 +4,20 @@
* 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):
*
* Contributor(s):
* Vidur Apparao <vidur@netscape.com> (original author)
*/
@ -35,8 +35,7 @@
// XPCOM Includes
#include "nsCOMPtr.h"
#include "nsVoidArray.h"
#include "nsSupportsArray.h"
#include "nsCOMArray.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsWeakReference.h"
@ -51,31 +50,33 @@
#define NS_WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/"
#define NS_WSDL_SOAP_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/"
class nsSOAPPortBinding : public nsISOAPPortBinding {
class nsSOAPPortBinding : public nsISOAPPortBinding
{
public:
nsSOAPPortBinding(const nsAString& aName);
virtual ~nsSOAPPortBinding();
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLBINDING
NS_DECL_NSISOAPPORTBINDING
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD SetAddress(const nsAString& aAddress);
NS_IMETHOD SetStyle(PRUint16 aStyle);
NS_IMETHOD SetTransport(const nsAString& aTransport);
NS_IMETHOD SetSoapVersion(PRUint16 aSoapVersion);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult SetAddress(const nsAString& aAddress);
nsresult SetStyle(PRUint16 aStyle);
nsresult SetTransport(const nsAString& aTransport);
nsresult SetSoapVersion(PRUint16 aSoapVersion);
protected:
nsString mName;
nsString mAddress;
PRUint16 mStyle;
nsString mTransport;
nsString mAddress;
nsString mTransport;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
PRUint16 mSoapVersion;
PRUint16 mStyle;
};
class nsWSDLPort : public nsIWSDLPort {
class nsWSDLPort : public nsIWSDLPort
{
public:
nsWSDLPort(const nsAString &aName);
virtual ~nsWSDLPort();
@ -83,18 +84,19 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLPORT
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD AddOperation(nsIWSDLOperation* aOperation);
NS_IMETHOD SetBinding(nsIWSDLBinding* aBinding);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult AddOperation(nsIWSDLOperation* aOperation);
nsresult SetBinding(nsIWSDLBinding* aBinding);
protected:
nsString mName;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
nsSupportsArray mOperations;
nsCOMArray<nsIWSDLOperation> mOperations;
nsCOMPtr<nsIWSDLBinding> mBinding;
};
class nsSOAPOperationBinding : public nsISOAPOperationBinding {
class nsSOAPOperationBinding : public nsISOAPOperationBinding
{
public:
nsSOAPOperationBinding();
virtual ~nsSOAPOperationBinding();
@ -103,17 +105,18 @@ public:
NS_DECL_NSIWSDLBINDING
NS_DECL_NSISOAPOPERATIONBINDING
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD SetStyle(PRUint16 aStyle);
NS_IMETHOD SetSoapAction(const nsAString& aAction);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult SetStyle(PRUint16 aStyle);
nsresult SetSoapAction(const nsAString& aAction);
protected:
PRUint16 mStyle;
nsString mSoapAction;
nsString mSoapAction;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
PRUint16 mStyle;
};
class nsWSDLOperation : public nsIWSDLOperation {
class nsWSDLOperation : public nsIWSDLOperation
{
public:
nsWSDLOperation(const nsAString &aName);
virtual ~nsWSDLOperation();
@ -121,24 +124,25 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLOPERATION
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD SetInput(nsIWSDLMessage* aInputMessage);
NS_IMETHOD SetOutput(nsIWSDLMessage* aOutputMessage);
NS_IMETHOD AddFault(nsIWSDLMessage* aFaultMessage);
NS_IMETHOD AddParameter(const nsAString& aParameter);
NS_IMETHOD SetBinding(nsIWSDLBinding* aBinding);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult SetInput(nsIWSDLMessage* aInputMessage);
nsresult SetOutput(nsIWSDLMessage* aOutputMessage);
nsresult AddFault(nsIWSDLMessage* aFaultMessage);
nsresult AddParameter(const nsAString& aParameter);
nsresult SetBinding(nsIWSDLBinding* aBinding);
protected:
nsString mName;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
nsCOMPtr<nsIWSDLMessage> mInputMessage;
nsCOMPtr<nsIWSDLMessage> mOutputMessage;
nsSupportsArray mFaultMessages;
nsCOMArray<nsIWSDLMessage> mFaultMessages;
nsStringArray mParameters;
nsCOMPtr<nsIWSDLBinding> mBinding;
};
class nsSOAPMessageBinding : public nsISOAPMessageBinding {
class nsSOAPMessageBinding : public nsISOAPMessageBinding
{
public:
nsSOAPMessageBinding(const nsAString& aNamespace);
virtual ~nsSOAPMessageBinding();
@ -151,7 +155,8 @@ protected:
nsString mNamespace;
};
class nsWSDLMessage : public nsIWSDLMessage {
class nsWSDLMessage : public nsIWSDLMessage
{
public:
nsWSDLMessage(const nsAString& aName);
virtual ~nsWSDLMessage();
@ -159,18 +164,19 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLMESSAGE
NS_IMETHOD SetDocumentationElement(nsIDOMElement* aElement);
NS_IMETHOD AddPart(nsIWSDLPart* aPart);
NS_IMETHOD SetBinding(nsIWSDLBinding* aBinding);
nsresult SetDocumentationElement(nsIDOMElement* aElement);
nsresult AddPart(nsIWSDLPart* aPart);
nsresult SetBinding(nsIWSDLBinding* aBinding);
protected:
nsString mName;
nsCOMPtr<nsIDOMElement> mDocumentationElement;
nsSupportsArray mParts;
nsCOMArray<nsIWSDLPart> mParts;
nsCOMPtr<nsIWSDLBinding> mBinding;
};
class nsSOAPPartBinding : public nsISOAPPartBinding {
class nsSOAPPartBinding : public nsISOAPPartBinding
{
public:
nsSOAPPartBinding(PRUint16 aLocation, PRUint16 aUse,
const nsAString& aEncodingStyle,
@ -185,10 +191,11 @@ protected:
PRUint16 mLocation;
PRUint16 mUse;
nsString mEncodingStyle;
nsString mNamespace;
nsString mNamespace;
};
class nsWSDLPart : public nsIWSDLPart {
class nsWSDLPart : public nsIWSDLPart
{
public:
nsWSDLPart(const nsAString& aName);
virtual ~nsWSDLPart();
@ -196,10 +203,9 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWSDLPART
NS_IMETHOD SetTypeInfo(const nsAString& aType,
const nsAString& aElementName,
nsISchemaComponent* aSchemaComponent);
NS_IMETHOD SetBinding(nsIWSDLBinding* aBinding);
nsresult SetTypeInfo(const nsAString& aType, const nsAString& aElementName,
nsISchemaComponent* aSchemaComponent);
nsresult SetBinding(nsIWSDLBinding* aBinding);
protected:
nsString mName;