ÿþ/ *  
 T h i s   o b j e c t   a l l o w s   u s   t o   m a k e   S O A P   c a l l s   t o   . N E T   o b j e c t s   u s i n g   J a v a s c r i p t  
 * /  
 f u n c t i o n   S O A P ( )  
 {  
         t h i s . E r r o r M e s s a g e   =   ' N / A ' ;  
         t h i s . N a m e s p a c e   =   ' h t t p : / / t e m p u r i . o r g / ' ;  
         t h i s . O p e r a t i o n   =   ' ' ;  
         t h i s . P a r a m e t e r s   =   n e w   A r r a y ( ) ;  
         t h i s . P o s t e d X m l   =   ' ' ;  
         t h i s . R e s p o n s e T e x t   =   ' ' ;  
         t h i s . R e s p o n s e X m l   =   ' ' ;  
         t h i s . U r l   =   ' ' ;  
          
         i f   ( w i n d o w . X M L H t t p R e q u e s t )  
         {  
 	         t h i s . R e q u e s t   =   n e w   X M L H t t p R e q u e s t ( ) ;  
         }    
         e l s e   i f   ( w i n d o w . A c t i v e X O b j e c t )  
         {  
 	         t r y  
 	         {  
 	 	         t h i s . R e q u e s t   =   n e w   A c t i v e X O b j e c t ( " M s x m l 2 . X M L H T T P " ) ;  
 	         }    
 	         c a t c h   ( e )    
 	         {  
 	 	         t r y    
 	 	         {  
 	 	 	         t h i s . R e q u e s t   =   n e w   A c t i v e X O b j e c t ( " M i c r o s o f t . X M L H T T P " ) ;  
 	 	         }    
 	 	         c a t c h   ( e )    
 	 	         {  
 	 	                 t h i s . E r r o r M e s s a g e   =   e ;  
 	 	         }  
 	         }  
         }  
 }  
  
 S O A P . p r o t o t y p e . A d d P a r a m e t e r   =   f u n c t i o n ( n a m e ,   v a l u e )  
 {  
         v a r   i d x ;  
          
         i d x   =   t h i s . P a r a m e t e r s . l e n g t h ;  
          
         t h i s . P a r a m e t e r s [ i d x ]   =   n e w   A r r a y ( ) ;  
          
         t h i s . P a r a m e t e r s [ i d x ] [ 0 ]   =   n a m e ;  
         t h i s . P a r a m e t e r s [ i d x ] [ 1 ]   =   v a l u e ;  
 }  
  
 S O A P . p r o t o t y p e . P o s t   =   f u n c t i o n ( )  
 {  
         v a r   d a t a ,   x m l ,   i d x ,   p a r a m e t e r ,   e r r o r ,   d o c ,   t e x t ;          
          
         x m l   =   ' < ? x m l   v e r s i o n = " 1 . 0 "   e n c o d i n g = " u t f - 8 " ? > \ r \ n ' ;  
         x m l   + =   ' < s o a p 1 2 : E n v e l o p e   x m l n s : x s i = " h t t p : / / w w w . w 3 . o r g / 2 0 0 1 / X M L S c h e m a - i n s t a n c e "   x m l n s : x s d = " h t t p : / / w w w . w 3 . o r g / 2 0 0 1 / X M L S c h e m a "   x m l n s : s o a p 1 2 = " h t t p : / / w w w . w 3 . o r g / 2 0 0 3 / 0 5 / s o a p - e n v e l o p e " > \ r \ n ' ;  
         x m l   + =   ' \ t < s o a p 1 2 : B o d y > \ r \ n ' ;  
         x m l   + =   ' \ t \ t < '   +   t h i s . O p e r a t i o n   +   '   x m l n s = " '   +   t h i s . N a m e s p a c e   +   ' " > \ r \ n ' ;  
  
         f o r ( i d x = 0 ;   i d x < t h i s . P a r a m e t e r s . l e n g t h ;   i d x + + )  
         {  
                 p a r a m e t e r   =   t h i s . P a r a m e t e r s [ i d x ] ;                  
                 x m l   + =   ' \ t \ t \ t < '   +   p a r a m e t e r [ 0 ]   +   ' > '   +   p a r a m e t e r [ 1 ]   +   ' < / '   +   p a r a m e t e r [ 0 ]   +   ' > \ r \ n ' ;  
         }  
  
         x m l   + =   ' \ t \ t < / '   +   t h i s . O p e r a t i o n   +   ' > \ r \ n ' ;  
         x m l   + =   ' \ t < / s o a p 1 2 : B o d y > \ r \ n ' ;  
         x m l   + =   ' < / s o a p 1 2 : E n v e l o p e > ' ;  
          
 	 t h i s . R e q u e s t . o p e n ( " P O S T " ,   t h i s . U r l ,   f a l s e ) ;  
 	 t h i s . R e q u e s t . s e t R e q u e s t H e a d e r ( " C o n t e n t - T y p e " ,   " a p p l i c a t i o n / s o a p + x m l ;   c h a r s e t = u t f - 8 " ) ;  
 	 t h i s . R e q u e s t . s e t R e q u e s t H e a d e r ( " C o n t e n t - L e n g t h " ,   x m l . l e n g t h ) ;  
 	 t h i s . R e q u e s t . s e n d ( x m l ) ; 	  
 	 	  
         t h i s . P o s t e d X m l   =   x m l ;  
 	  
         i f   ( t h i s . R e q u e s t . r e a d y S t a t e   = =   4 )    
         {  
 	         i f   ( t h i s . R e q u e s t . s t a t u s   = =   2 0 0 )    
 	         {  
 	 	         d o c   =   t h i s . S t r i n g T o X M L D o c ( t h i s . R e q u e s t . r e s p o n s e T e x t ) ;  
 	 	          
 	 	         i f   ( d o c . t e x t )   t e x t   =   d o c . t e x t ;  
 	 	         e l s e   t e x t   =   d o c . d o c u m e n t E l e m e n t . t e x t C o n t e n t  
 	 	          
 	 	         t h i s . R e s p o n s e T e x t   =   t e x t ;  
 	 	         t h i s . R e s p o n s e X m l   =   t h i s . S t r i n g T o X M L D o c ( t e x t ) ; 	 	         	 	          
                         t h i s . S u c c e s s f u l   =   t r u e ;  
 	         }  
 	         e l s e    
 	         {  
 	                 t h i s . E r r o r M e s s a g e   =   " S t a t u s   N u m b e r :   "   +   t h i s . R e q u e s t . s t a t u s   +   " \ n \ n "   +   t h i s . R e q u e s t . s t a t u s T e x t   +   " \ n \ n "   +   t h i s . R e q u e s t . r e s p o n s e T e x t ; 	 	          
 	                 t h i s . S u c c e s s f u l   =   f a l s e ;  
 	         }  
         }                  
 }  
  
 S O A P . p r o t o t y p e . S t r i n g T o X M L D o c   =   f u n c t i o n ( s t r )  
 {  
 	 v a r   x m l D o c   =   n u l l ;  
  
 	 t r y  
 	 {  
 	 	 v a r   x m l D O M O b j   =   n e w   A c t i v e X O b j e c t ( " M i c r o s o f t . X M L D O M " ) ;  
 	 	 x m l D O M O b j . a s y n c   =   f a l s e ;  
 	 	 x m l D O M O b j . l o a d X M L ( s t r ) ;  
 	 	 x m l D o c   =   x m l D O M O b j ;  
 	 }  
 	 c a t c h   ( e )  
 	 {  
 	 	 t r y  
 	 	 {  
 	 	 	 v a r   d o m P a r s e r   =   n e w   D O M P a r s e r ;  
 	 	 	 x m l D o c   =   d o m P a r s e r . p a r s e F r o m S t r i n g ( s t r ,   ' t e x t / x m l ' ) ;  
 	 	 }  
 	 	 c a t c h   ( e )  
 	 	 {  
 	 	 	 x m l D o c   =   n u l l ;  
 	 	 }  
 	 }  
  
 	 r e t u r n   x m l D o c ;  
 } ;  
  
 S O A P . p r o t o t y p e . c o n s t r u c t o r   =   S O A P ;   
