Savon 创建匹配的 XML 模式 [英] Savon create matched XML pattern

查看:35
本文介绍了Savon 创建匹配的 XML 模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从印度 Web API 的所得税中获取泛信息.

I am trying to get the pan info from the income tax of india web API.

请求的标准 XML 是这样的

The standard XML for the request is this

     <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:pan="http://panws.dit.tcs.com/" xmlns:typ="http://panws.dit.tcs.com/types/">
       <soapenv:Header/>
       <soapenv:Body>
        <pan:getPanInfo>
          <login>
             <typ:userName>xxxxxxxxx</typ:userName>
             <typ:password>xxxxxxxxxx</typ:password>
          </login>
          <panNo>
             <typ:panNo>xxxxxxxxxxxxx</typ:panNo>
          </panNo>
          </pan:getPanInfo>
         </soapenv:Body>
      </soapenv:Envelope>

我正在使用 SAVON ruby​​ gem 以上述格式提交请求.我的代码是

I am using SAVON ruby gem to submit the request in the above format. My code is

        client = Savon.client do |globals|
           globals.wsdl 'https://incometaxindiaefiling.gov.in/e-FilingWS/ditws/PanWS.wsdl'
        end
        client.call(:get_pan_info, message: {
           "login" => {
               "typ:userName" => "xxxxxxxxxx",
               "typ:password" => "xxxxxxxxxxxxxxxx"
             }, 
             "panNo" => {
             "typ:panNo" => "xxxxxxxxxxxxxxx"
          }
        })

它创建要提交的 XML 在这里:

It creates the XML to be submitted is here:

    <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://panws.dit.tcs.com/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://panws.dit.tcs.com/types/">
   <env:Body>
     <tns:getPanInfo>
        <tns:login>
           <typ:userName>xxxxxxx</typ:userName>
            <typ:password>xxxxxxxxxxxx</typ:password>
        </tns:login>
        <tns:panNo>
           <typ:panNo>xxxxxxxxxxxxxx</typ:panNo>
        </tns:panNo>
      </tns:getPanInfo>
     </env:Body>
   </env:Envelope>

它给出了 500 外部服务器错误,

and it gives 500 External server Error,

任何机构都可以指出我错在哪里或如何为请求创建相同的 XML.

Can any body please point me out where i am wrong or how to create the same XML for the request.

推荐答案

你应该设置正确的 env_namespace :

You should set the correct env_namespace :

Savon.client(env_namespace: :soapenv)

Ctrl+F env_namespace 这里一个>

这篇关于Savon 创建匹配的 XML 模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆