Savon如何使用exx xml请求调用SOAP服务

时间:2016-05-12 09:09:14

标签: ruby soap savon

我对Savon v2很安静。 我有以下请求正文,它通过SoapUI传递:

<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header>
    <ns7:ClientInfoHeader xmlns:ns7='urn:messages.ws.rightnow.com/v1_2' soapenv:mustUnderstand='0'>
        <ns7:AppID>Basic Get</ns7:AppID>
    </ns7:ClientInfoHeader>
    <wsse:Security xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' mustUnderstand='1'>
        <wsse:UsernameToken>
            <wsse:Username>usernamexxx</wsse:Username>
            <wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>passwordxxx</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>
</soapenv:Header>
<soapenv:Body>
    <ns7:Get xmlns:ns7='urn:messages.ws.rightnow.com/v1_2'>
        <ns7:RNObjects xmlns:ns4='urn:objects.ws.rightnow.com/v1_2' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns4:Incident'>
            <ID xmlns='urn:base.ws.rightnow.com/v1_2' id='xxxxidxxx' />
            <ns4:Severity />
        </ns7:RNObjects>
        <ns7:ProcessingOptions>
            <ns7:FetchAllNames>false</ns7:FetchAllNames>
        </ns7:ProcessingOptions>
    </ns7:Get>
</soapenv:Body>

我的代码如下:

    client = Savon.client(
        wsdl: "https://srm-dev.rightnowdemo.com/cgi-bin/srm_dev.cfg/services/soap?wsdl",
        log: false
    )

    response = nil
    begin
    response = client.call(:Get, xml: "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
    <soapenv:Header>
        <ns7:ClientInfoHeader xmlns:ns7='urn:messages.ws.rightnow.com/v1_2' soapenv:mustUnderstand='0'>
            <ns7:AppID>Basic Get</ns7:AppID>
        </ns7:ClientInfoHeader>
        <wsse:Security xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' mustUnderstand='1'>
            <wsse:UsernameToken>
                <wsse:Username>usernamexxx</wsse:Username>
                <wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>passwordxxx</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
    </soapenv:Header>
    <soapenv:Body>
        <ns7:Get xmlns:ns7='urn:messages.ws.rightnow.com/v1_2'>
            <ns7:RNObjects xmlns:ns4='urn:objects.ws.rightnow.com/v1_2' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns4:Incident'>
                <ID xmlns='urn:base.ws.rightnow.com/v1_2' id='xxxxidxxx' />
                <ns4:Severity />
            </ns7:RNObjects>
            <ns7:ProcessingOptions>
                <ns7:FetchAllNames>false</ns7:FetchAllNames>
            </ns7:ProcessingOptions>
        </ns7:Get>
    </soapenv:Body>
</soapenv:Envelope>") 
rescue

end

p response

end

但根本没有返回任何值,响应仍为零。

如何通过Savon使用此SOAP服务???

0 个答案:

没有答案