3
我想在節點中使用xml web服務soap客戶端,我不確定如何爲我的示例添加肥皂頭。如何在node.js中使用node-soap或strong-soap添加肥皂頭
看着強烈的肥皂,有一種方法addSoapHeader(value, qname, options)
,但我不知道我需要通過在這種情況下作爲qname和選項。
我的要求,我需要發送
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://schemas.foo.com/webservices/authentication" xmlns:hot="http://foo.com/webservices/hotelv3" xmlns:hot1="http://schemas.foo.com/webservices/hotelv3">
<soapenv:Header>
<aut:AuthenticationHeader>
<aut:LoginName>foo</aut:LoginName>
<aut:Password>secret</aut:Password>
<aut:Culture>en_US</aut:Culture>
<aut:Version>7.123</aut:Version>
</aut:AuthenticationHeader>
</soapenv:Header>
<soapenv:Body>
<hot:BookHotelV3>
<!--Optional:-->
<hot:request>
<hot1:RecordLocatorId>0</hot1:RecordLocatorId>
<!--Optional:-->
<hot1:RoomsInfo>
<!--Zero or more repetitions:-->
<hot1:RoomReserveInfo>
<hot1:RoomId>123</hot1:RoomId>
<hot1:ContactPassenger>
<hot1:FirstName>Joe</hot1:FirstName>
<hot1:LastName>Doe</hot1:LastName>
</hot1:ContactPassenger>
<hot1:AdultNum>2</hot1:AdultNum>
<hot1:ChildNum>0</hot1:ChildNum>
</hot1:RoomReserveInfo>
</hot1:RoomsInfo>
<hot1:PaymentType>Obligo</hot1:PaymentType>
</hot:request>
</hot:BookHotelV3>
</soapenv:Body>
</soapenv:Envelope>
應該值:
value = { LoginName:'foo', Password:'secret', Culture:'en_US', Version:7.123 }
那應該是QNAME? auth:AuthenticationHeader
?我在哪裏指定名稱空間?
有節點肥皂更容易的例子嗎?我應該使用強皁還是節皁?