javascript - Passing an array of ints with node-soap -
i'm using node-soap service , works need send array of ints , find can send first 1 because can't find correct way build js object represent array.
i've been looking @ similar questions couldn't find answer question.
i need generate xml property following one:
<ns1:arrayofints>           <!--zero or more repetitions:-->           <arr:int>2904</arr:int>           <arr:int>3089</arr:int>           <arr:int>4531</arr:int> </ns1:arrayofints> by passing object contains array:
soapobject = {               somefields,               "ns1:arrayofints": {                  goes here               },              }; any idea how create js object?
i had same problem , used $xml property add raw xml request , attributes set arr namespace:
var fields = [2904, 3089, 4531]; soapobject.arrayofints = {     attributes: {         'xmlns:arr': 'http://schemas.microsoft.com/2003/10/serialization/arrays'     },     $xml: fields.map(function(value) {         return '<arr:int>' + value + '</arr:int>';     }).join('') }; this code generate following request:
<ns1:arrayofints xmlns:arr="http://schemas.microsoft.com/2003/10/serialization/arrays">     <arr:int>2904</arr:int>     <arr:int>3089</arr:int>     <arr:int>4531</arr:int> </ns1:arrayofints> 
Comments
Post a Comment