namespace problems

140 views
Skip to first unread message

Lynch Davis

unread,
Jan 23, 2014, 11:48:33 AM1/23/14
to sav...@googlegroups.com
I am trying to put together a simple query, but I seem to be running into several namespace problems.

{code}
require 'savon'

@wsdl="https://<filtered>/dnsa-ws/V2.0/dnsaapi?WSDL"

@headers={"Authorization" => "Basic"}

@auth_token = { 'urn1:userToken' => {
'urn1:userName' => 'user',
'urn1:password' => 'password',
}, 
}

@auth_info = { 'urn1:authInfo' => @auth_token }

client = Savon.client(
    wsdl: @wsdl,
    env_namespace: 'soap',
    soap_header: @auth_info,
    log: true,
    log_level: :debug,
    pretty_print_xml: true,
    filters: [:password],
    element_form_default: :qualified,
)

client.call(:get_customer_list)
{code}

When I run the code, and I get a  HTTP error (415) (Savon::HTTPError).  Popping this into the SoapUI tool, the first error I get is : 

            <S:Text xml:lang="en">Couldn't create SOAP message. Expecting Envelope in namespace http://www.w3.org/2003/05/soap-envelope, but got http://schemas.xmlsoap.org/soap/envelope/</S:Text>

So, somehow, I need to transform 

<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dnsaApi="urn:<filtered>:dnsa:api:wsdl:2" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

into

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:<filtered>:dnsa:messaging:schema:1" xmlns:urn1="urn:<filtered>:dnsa:auth:schema:1" xmlns:urn2="urn:<filtered>:dnsa:api:schema:1">


From there, I need to apply the correct namespaces to the elements.
Is there a cleaner way that how I am including the namespaces in my declarations?

Thanks
Reply all
Reply to author
Forward
0 new messages