SOAP WSDL Associative Arrays

后端 未结 3 554
温柔的废话
温柔的废话 2021-01-18 02:36

How can I define an associative array in a SOAP wsdl file? This is how I define an array element type so far:


    

        
3条回答
  •  不思量自难忘°
    2021-01-18 03:01

    to transfer a php associative array over soap you will need to define following in your wsdl:

    
          
            
            
            
          
    
    
        
          
        
     
    

    now specify your new defined ArrayOfKeyValueData type as the type of your result or as parameter

    
      
    
    

    and specify your operation with someting like

    
        
        
    
    

    this will work fine with some kind of web service written in php that returns something like

    return array("k1" => "v1", "k2" => "v2");
    

    if you are using php as client, you will get exactly the same array on the client side. other languges or soap libraries may produce other structure, as not every language has this kind of "associative array" concept.

提交回复
热议问题