diff --git a/jquery.soap/jquery.soap-tests.ts b/jquery.soap/jquery.soap-tests.ts
index c8328c800..3390c2774 100644
--- a/jquery.soap/jquery.soap-tests.ts
+++ b/jquery.soap/jquery.soap-tests.ts
@@ -1,5 +1,25 @@
///
+$.soap({
+ url: 'http://my.server.com/soapservices/',
+ method: 'helloWorld',
+
+ data: {
+ name: 'Remy Blom',
+ msg: 'Hi!'
+ },
+
+ success: function (soapResponse) {
+ // do stuff with soapResponse
+ // if you want to have the response as JSON use soapResponse.toJSON();
+ // or soapResponse.toString() to get XML string
+ // or soapResponse.toXML() to get XML DOM
+ },
+ error: function (SOAPResponse) {
+ // show error
+ }
+});
+
$.soap({
url: 'http://my.server.com/soapservices/', //endpoint address for the service
method: 'helloWorld', // service operation name
@@ -54,4 +74,223 @@ $.soap({
// debugging
enableLogging: false // to enable the local log function set to true, defaults to false (optional)
+})
+
+$.soap({
+
+}).done(function(data, textStatus, jqXHR) {
+ // do stuff on success here...
+}).fail(function(jqXHR, textStatus, errorThrown) {
+ // do stuff on error here...
+})
+
+$.soap({
+ url: 'http://my.server.com/soapservices/',
+ namespaceQualifier: 'myns',
+ namespaceURL: 'urn://service.my.server.com',
+ error: function (soapResponse) {
+ // show error
+ }
+});
+
+$.soap({
+ method: 'helloWorld',
+ data: {
+ name: 'Remy Blom',
+ msg: 'Hi!'
+ },
+ success: function (soapResponse) {
+ // do stuff with soapResponse
+ }
+});
+
+$.soap({
+ method: 'doSomethingElse',
+ data: {},
+ success: function (soapResponse) {
+ // do stuff with soapResponse
+ }
+});
+
+$.soap({
+ url: 'http://another.server.com/anotherService',
+ method: 'helloWorld',
+ data: {
+ name: 'Remy Blom',
+ msg: 'Hi!'
+ },
+ success: function (soapResponse) {
+ // do stuff with soapResponse
+ },
+ error: function (soapResponse) {
+ alert('that other server might be down...')
+ }
+});
+
+$.soap({
+ // other parameters..
+
+ // WS-Security
+ wss: {
+ username: 'user',
+ password: 'pass',
+ nonce: 'w08370jf7340qephufqp3r4',
+ created: new Date().getTime()
+ }
+});
+
+var username = 'foo';
+var password = 'bar';
+
+$.soap({
+ // other parameters...
+
+ HTTPHeaders: {
+ Authorization: 'Basic ' + btoa(username + ':' + password)
+ }
+});
+
+// jquery.soap/doc/options.md
+
+$.soap({
+ url: 'http://server.com/webServices/',
+ method: 'getItem',
+ appendMethodToURL: false
+})
+
+$.soap({
+ beforeSend: function(SOAPEnvelope) {
+ console.log(SOAPEnvelope.toString());
+ }
+});
+
+$.soap({
+ context: document.body,
+ success: function(SOAPResponse) {
+ console.log(this);
+ }
+});
+
+var xml =
+ ['',
+ '',
+ '',
+ '',
+ '',
+ ''];
+
+$.soap({
+ data: xml.join('')
+});
+
+$.soap({
+ method: 'requestNode',
+ data: {
+ name: 'Remy Blom',
+ msg: 'Hi!'
+ }
+});
+
+$.soap({
+ envAttributes: {
+ 'xmlns:another': 'http://anotherNamespace.com/'
+ }
+})
+
+$.soap({
+ method: 'helloWorld',
+ elementName: 'requestNode'
+})
+
+$.soap({
+ enableLoggin: true
+})
+
+$.soap({
+ error: function(SOAPResponse) {
+ console.log(SOAPResponse.toString())
+ }
+})
+
+$.soap({
+ HTTPHeaders: {
+ 'Authorization': 'Basic ' + btoa('user:pass')
+ }
+})
+
+$.soap({
+ url: 'http://server.com/webServices/',
+ method: 'getItem'
+})
+
+$.soap({
+ method: 'helloWorld',
+ namespaceQualifier: 'myns',
+ namespaceURL: 'urn://service.my.server.com'
+})
+
+$.soap({
+ method: 'helloWorld',
+ namespaceQualifier: 'myns',
+ namespaceURL: 'urn://service.my.server.com'
+})
+
+$.soap({
+ method: 'helloWorld',
+ namespaceQualifier: 'myns',
+ namespaceURL: 'urn://service.my.server.com',
+ noPrefix: true
+})
+
+$.soap({
+ request: function(SOAPEnvelope) {
+ console.log(SOAPEnvelope.toString());
+ }
+})
+
+$.soap({
+ soap12: true
+})
+
+$.soap({
+ url: 'http://server.com/webServices/',
+ method: 'getItem',
+ SOAPAction: 'getAnItem'
+})
+
+$.soap({
+ SOAPHeader: {
+ test: [1,2,3]
+ }
+})
+
+$.soap({
+ statusCode: {
+ 404: function() {
+ console.log('404 Not Found')
+ },
+ 200: function() {
+ console.log('200 OK')
+ }
+ }
+})
+
+$.soap({
+ success: function(SOAPResponse) {
+ console.log(SOAPResponse.toString());
+ }
+})
+
+$.soap({
+ url: 'http://server.com/webServices/',
+ method: 'getItem'
+})
+
+$.soap({
+ wss: {
+ username: 'user',
+ password: 'pass',
+ nonce: 'w08370jf7340qephufqp3r4',
+ created: new Date().getTime()
+ }
})
\ No newline at end of file
diff --git a/jquery.soap/jquery.soap.d.ts b/jquery.soap/jquery.soap.d.ts
index 68647b76a..abd65e783 100644
--- a/jquery.soap/jquery.soap.d.ts
+++ b/jquery.soap/jquery.soap.d.ts
@@ -7,68 +7,72 @@
declare module JQuerySOAP {
interface SOAPEnvelope {
- attributes: any
- bodies: any
- headers: any
+ attributes: Object
+ bodies: Array
+ headers: Array
prefix: string
soapConfig: any
typeOf: string
- addAttribute(name, value): void
+ addAttribute(name: String, value: string): void
+ addAttribute(name: String, value: number): void
addBody(soapObject: SOAPObject): void
addHeader(soapObject: SOAPObject): void
- addNamespace(name, uri): void
+ addNamespace(name: String, uri: string): void
toString(): string
- send(options): void
+ send(options: Options): void
}
interface SOAPResponse {
toJSON(): any
toString(): String
toXML(): XMLDocument
}
-
+
interface SOAPObject {
- attributes: any
- children: any
+ attributes: Object
+ children: Array
name: string
- ns: any
- _parent: any
+ ns: Object
+ _parent: SOAPObject
value: any
typeOf: string
- addNamespace(name, url): void
- addParameter(name, value)
- appendChild(soapObject: SOAPObject)
- attr(name, value)
- end()
- find(name)
- hasChildren()
- newChild(name)
- parent()
+ addNamespace(name: String, url: string): void
+ addParameter(name: String, value: string): void
+ addParameter(name: String, value: number): void
+ appendChild(soapObject: SOAPObject): SOAPObject
+ attr(name: string, value: string): Object
+ attr(name: string, value: number): Object
+ end(): SOAPObject
+ find(name: string): SOAPObject
+ hasChildren(): boolean
+ newChild(name: string): SOAPObject
+ parent(): SOAPObject
toString(): string
- val(value)
+ val(value: string): SOAPObject
+ val(value: number): SOAPObject
}
interface Options {
- appendMethodToURL?: boolean;
- async?: boolean;
- beforeSend?: (SOAPEnvelope: SOAPEnvelope) => void;
- context?: any;
- data?: Object;
- envAttributes?: any;
- elementName?: string;
- enableLogging?: boolean;
- error?: (SOAPResponse: SOAPResponse) => void;
- HTTPHeaders?: any;
- method?: string;
- namespaceQualifier?: string;
- namespaceURL?: string;
- noPrefix?: boolean;
- request?: (SOAPEnvelope: SOAPEnvelope) => void;
- soap12?: boolean;
- SOAPAction?: string;
- SOAPHeader?: any;
- statusCode?: any;
- success?: (SOAPResponse: SOAPResponse) => void;
- url?: string;
- wss?: any;
+ appendMethodToURL?: boolean;
+ async?: boolean;
+ beforeSend?: (SOAPEnvelope: SOAPEnvelope) => void;
+ context?: any;
+ data?: Object;
+ envAttributes?: Object;
+ elementName?: string;
+ enableLogging?: boolean;
+ error?: (SOAPResponse: SOAPResponse) => void;
+ HTTPHeaders?: Object;
+ method?: string;
+ namespaceQualifier?: string;
+ namespaceURL?: string;
+ noPrefix?: boolean;
+ request?: (SOAPEnvelope: SOAPEnvelope) => void;
+ soap12?: boolean;
+ SOAPAction?: string;
+ SOAPHeader?: Object;
+ statusCode?: Object;
+ success?: (SOAPResponse: SOAPResponse) => void;
+ url?: string;
+ wss?: Object;
}
interface SOAP {
(options?: Options): JQueryXHR;