Je travaille actuellement sur un nouveau projet et je suis assez nouveau pour le savon. J'utilise actuellement ruby-1.8.7 et 1.0.0 et savon je demande ci-dessous XML SOAPSavon soap demande ruby format
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices">
<soapenv:Header/>
<soapenv:Body>
<web:InvokeComponent1 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<PartnerName xsi:type="xsd:string">ABC</PartnerName>
<ComponentName xsi:type="xsd:string">TestingServices</ComponentName>
<arg1Value xsi:type="xsd:string">[CONTROL]
RequestID=83f6baab
RequestTime=13:14:15
RequestDate=08/08/2013
GenerateLead=N
Auto=Y
</arg1Value>
<RaUID xsi:type="xsd:string">username</RaUID>
<RaPW xsi:type="xsd:string">password1</RaPW>
<AgNO xsi:type="xsd:string">12345</AgNO>
</web:InvokeComponent1>
</soapenv:Body>
</soapenv:Envelope>
Ceci est mon code, je l'ai écrit Savon à cette automatisation de la demande, évidemment mentionné ci-dessous le code ne fonctionne pas comme j'ai besoin de quelques entrées.
Je ne sais pas où inclure soapenv: En-tête, j'ai essayé de mettre à l'intérieur de la demande, comme indiqué dans le code ci-dessous (en commentaires) mais je reçois « méthode non définie tête = » pour # (NoMethodError). où inclure l'en-tête dans la demande de savon? Dans le nom de la requête SOAP, j'ai un attribut supplémentaire soapenv: encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" où dois-je inclure cet attribut supplémentaire.
client = Savon::Client.new do |wsdl| wsdl.document = "https://www.abc.com/webservices/RemotePublicGateway.cfc?wsdl" # this is not actual WSDL end testing_string = '[CONTROL] RequestID=83f6baab RequestTime=13:14:15 RequestDate=08/08/2013 GenerateLead=N Auto=Y' response = client.request :web, "InvokeComponent1" do #client.header = { } soap.body = { :PartnerName => 'ABC', :attributes! => { :PartnerName => { 'xsi:type' => "xsd:string" } }, :ComponentName => 'TestingServices', :attributes! => { :ComponentName => { 'xsi:type' => "xsd:string" } }, :arg1Value => testing_string, :attributes! => { :arg1Value => { 'xsi:type' => "xsd:string" } }, :RaUID => 'username', :attributes! => { :RaUID => { 'xsi:type' => "xsd:string" } }, :RaPW => 'password1', :attributes! => { :RaPW => { 'xsi:type' => "xsd:string" } }, :AgNO=> '12345', :attributes! => { :AgNO => { 'xsi:type' => "xsd:string" } } } end
est dépréciée 1.0.0 savon. Pourquoi l'utilisez-vous? Pourquoi utilisez-vous ruby 1.8.7 sur un nouveau projet? – 7stud
Ok, laissez-moi essayer avec la nouvelle version de Savon, ce projet fait partie d'un plus grand projet déjà existant qui utilise 1.8.7 Je ne peux pas simplement passer à une version plus récente pour ce projet. –