<SCRIPT>
// Convert a JSON object to XML
Function toxml (OBJ ){
VaR xml = "";
For (var k in OBJ ){
VaR v = OBJ [k];
If (typeof (v )! = "Object "){
XML + = "<" + K + ">" + V + "</" + K + "> ";
} Else {
XML + = "<" + K + "> ";
XML + = toxml (v );
XML + = "</" + K + "> ";
}
}
Return XML;
}
// Construct a soap call String
// Name: Method Name
// ARGs: attached JSON Parameter
// Ns: namespace OF THE METHOD
Function tosoap (name, argS, NS)
{
VaR MSG = '';
MSG + = '<v: envelope \ r \ n ';
MSG + = 'xmlns: I = "http://www.w3.org/2001/xmlschema-instance%22/r/n ';
MSG + = 'xmlns: D = "http://www.w3.org/2001/xmlschema%22/r/n ';
MSG + = 'xmlns: c = "http://schemas.xmlsoap.org/soap/encoding/42422/r/n ';
MSG + = 'xmlns: V = "http://schemas.xmlsoap.org/soap/envelope/42422/r/n ';
MSG + = '> \ r \ n ';
MSG + = '<v: Header/> \ r \ n ';
MSG + = '<v: Body> \ r \ n ';
MSG + = '<' + name + 'xmlns = "'+ NS +'" id = "O0" C: Root = "1"> \ r \ n ';
MSG + = ''+ toxml (ARGs) +" \ r \ n ";
MSG + = '</' + name + '> \ r \ n ';
MSG + = '</V: Body> \ r \ n ';
MSG + = '</V: envelope> \ r \ n ';
Return MSG;
}
// Var o = {A: 1, B: "XX", C: {C1: 3, C2: "ww "}};
// Alert (toxml (o ));
VaR o = {
Zi_tid: 'xq9fasfi + 7 wbswdfgsszcw = ',
Zi_isre: 1,
Key: NULL,
Row: 10,
SKIP: 0,
Code: 'ijrgfsfsjqyo4'
};
VaR soap = tosoap ('listinfo', O, 'authorityservicewsdl ');
Alert (SOAP );
</SCRIPT>
PS. this script is used to call PHP's WebService (using the standard SOAP protocol). ASPnet's WebService implements both standard soap and common get/post methods, calling is much simpler.