Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions
WSPFactory Class Reference

#include <wspprivate.h>

Inheritance diagram for WSPFactory:
Inheritance graph
[legend]
Collaboration diagram for WSPFactory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 WSPFactory ()
virtual ~WSPFactory ()
nsIWebServiceProxy createProxy (in AString wsdlURL, in AString portname, in AString qualifier, in boolean isAsync)
 Create a service proxy.
void createProxyAsync (in AString wsdlURL, in AString portname, in AString qualifier, in boolean isAsync, in nsIWebServiceProxyCreationListener listener)
 Create a service proxy.

Static Public Member Functions

NS_DECL_ISUPPORTS static
NS_DECL_NSIWEBSERVICEPROXYFACTORY
nsresult 
C2XML (const nsACString &aCIdentifier, nsAString &aXMLIdentifier)
static void XML2C (const nsAString &aXMLIndentifier, nsACString &aCIdentifier)

Detailed Description

Definition at line 79 of file wspprivate.h.


Constructor & Destructor Documentation

Definition at line 166 of file wspfactory.cpp.

{
}
WSPFactory::~WSPFactory ( ) [virtual]

Definition at line 170 of file wspfactory.cpp.

{
}

Member Function Documentation

nsresult WSPFactory::C2XML ( const nsACString &  aCIdentifier,
nsAString &  aXMLIdentifier 
) [static]

Definition at line 212 of file wspfactory.cpp.

{
  nsReadingIterator<char> current, end;

  aXMLIdentifier.Truncate();
  aCIdentifier.BeginReading(current);
  aCIdentifier.EndReading(end);

  while (current != end) {
    char ch = *current++;
    PRUnichar uch;
    if (ch == P2M_ESCAPE_CHARACTER) {
      // Grab the next 4 characters that make up the
      // escape sequence
      PRUint16 i;
      PRUint16 acc = 0;
      for (i = 0; (i < 4) && (current != end); i++) {
        acc <<= 4;
        ch = *current++;
        if (('0' <= ch) && (ch <= '9')) {
          acc += ch - '0';
        }
        else if (('a' <= ch) && (ch <= 'f')) {
          acc += ch - ('a' - 10);
        }
        else if (('A' <= ch) && (ch <= 'F')) {
          acc += ch - ('A' - 10);
        }
        else {
          return NS_ERROR_FAILURE;
        }
      }

      // If we didn't get through the entire escape sequence, then
      // it's an error.
      if (i < 4) {
        return NS_ERROR_FAILURE;
      }

      uch = PRUnichar(acc);
    }
    else {
      uch = PRUnichar(ch);
    }
    aXMLIdentifier.Append(uch);
  }

  return NS_OK;
}

Here is the caller graph for this function:

nsIWebServiceProxy nsIWebServiceProxyFactory::createProxy ( in AString  wsdlURL,
in AString  portname,
in AString  qualifier,
in boolean  isAsync 
) [inherited]

Create a service proxy.

Loading of the WSDL URL will occur in a synchronous manner. Calls to web service can be made as soon as this method completes.

Parameters:
wsdlURLThe URL of the WSDL service description. This description will be loaded and used as the basis for the service proxy.
portnameThe name of the port of the service that this service proxy represents. Currently the port must represent a SOAP binding.
qualifierThe user-specified qualifier is incorporated into the names of XPCOM interfaces created for the service proxy. For C++ callers, this qualifier should be the same one used in creating the IDL used at compile time. Script callers need not specify a qualifier.
isAsyncIf PR_TRUE, the method signatures of the service proxy represent an asynchronous calling convention. A callback instance must be registered with the proxy. A method call to a web service is only completed when the corresponding callback method is invoked. If PR_FALSE, the method signatures of the service proxy represent a synchronous callling convention. A method call to a web service is completed when the method call to the proxy returns.
void nsIWebServiceProxyFactory::createProxyAsync ( in AString  wsdlURL,
in AString  portname,
in AString  qualifier,
in boolean  isAsync,
in nsIWebServiceProxyCreationListener  listener 
) [inherited]

Create a service proxy.

Loading of the WSDL URL will occur in an asynchronous manner. Methods on the listener instance will be invoked when the proxy has been created. Any method invocations on the service proxy prior to asynchronous completion of the intialization step will fail. The caller is guaranteed that this method will return before the listener is invoked.

Parameters:
wsdlURLThe URL of the WSDL service description. This description will be loaded and used as the basis for the service proxy.
portnameThe name of the port of the service that this service proxy represents. Currently the port must represent a SOAP binding.
qualifierThe user-specified qualifier is incorporated into the names of XPCOM interfaces created for the service proxy. For C++ callers, this qualifier should be the same one used in creating the IDL used at compile time. Script callers need not specify a qualifier.
isAsyncIf PR_TRUE, the method signatures of the service proxy represent an asynchronous calling convention. A callback instance must be registered with the proxy. A method call to a web service is only completed when the corresponding callback method is invoked. If PR_FALSE, the method signatures of the service proxy represent a synchronous callling convention. A method call to a web service is completed when the method call to the proxy returns.
listenerThe callback instance which will be invoked when the proxy is completely initialized.
void WSPFactory::XML2C ( const nsAString &  aXMLIndentifier,
nsACString &  aCIdentifier 
) [static]

Definition at line 264 of file wspfactory.cpp.

{
  nsReadingIterator<PRUnichar> current, end;

  aCIdentifier.Truncate();
  aXMLIndentifier.BeginReading(current);
  aXMLIndentifier.EndReading(end);

  while (current != end) {
    PRUnichar uch = *current++;
    if (((PRUnichar('a') <= uch) && (uch <= PRUnichar('z'))) ||
        ((PRUnichar('A') <= uch) && (uch <= PRUnichar('Z'))) ||
        ((PRUnichar('0') <= uch) && (uch <= PRUnichar('9')))) {
      // Casting is safe since we know that it's an ASCII character
      aCIdentifier.Append(char(uch));
    }
    else {
      // Escape the character and append to the string
      char buf[6];
      buf[0] = P2M_ESCAPE_CHARACTER;

      for (int i = 3; i >= 0; i--) {
        PRUint16 v = (uch >> 4*i) & 0xf;
        buf[4-i] = (char) (v + ((v > 9) ? 'a'-10 : '0'));
      }

      buf[5] = 0;

      aCIdentifier.Append(buf, 5);
    }
  }
}

Here is the caller graph for this function:


The documentation for this class was generated from the following files: