Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing wsdl prefix from tags... #64

Closed
MattMencel opened this issue Jun 7, 2010 · 14 comments
Closed

Removing wsdl prefix from tags... #64

MattMencel opened this issue Jun 7, 2010 · 14 comments

Comments

@MattMencel
Copy link

Hi,

I'm trying to connect to Zimbra via SOAP and it doesn't like the wsdl prefix in the tags. The SOAP it seems to expect is this...

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header>
    <context xmlns="urn:zimbra">
      <nosession/>
    </context>
  </soap:Header>
  <soap:Body>
    <AuthRequest xmlns="urn:zimbraAdmin">
      <account>myadminaccount</account>
      <password>myadminpassword</password>
    </AuthRequest>
  </soap:Body>
</soap:Envelope>

So I'm trying to create that request with this bit of code...

    client = Savon::Client.new "https://myzimbraserver:7071/service/admin/soap"
    response = client.AuthRequest! do |soap|
      soap.version = 2
      soap.namespace = "https://myzimbraserver:7071/service/admin/soap"
      soap.action = "AuthRequest"
      soap.body = '<account>myadminaccount</account><password>myadminpassword</password>'
    end
    puts client
    puts response

But this is what I get back...

SOAP request: https://myzimbraserver:7071/service/admin/soap
SOAPAction: AuthRequest, Content-Type: text/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:wsdl="https://myzimbraserver:7071/service/admin/soap" xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><wsdl:authRequest><account>myadminaccount</account><password>myadminpassword</password></wsdl:authRequest></env:Body></env:Envelope>
SOAP response (status 500):
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"/></soap:Header><soap:Body><soap:Fault><soap:faultcode>soap:Client</soap:faultcode><soap:faultstring>unknown document: wsdl:authRequest</soap:faultstring><soap:detail><Error xmlns="urn:zimbra"><Code>service.UNKNOWN_DOCUMENT</Code><Trace>btpool0-61530://myzimbraserver:7071/service/admin/soap:1275927425215:46aeabde6ecddc68</Trace></Error></soap:detail></soap:Fault></soap:Body></soap:Envelope>
rake aborted!
(soap:Client) unknown document: wsdl:authRequest

Another issue is that it's converting AuthRequest to authRequest. I think I've specified it correctly for not using WSDL according to the docs. What am I doing wrong?

Thanks,
Matt

@mconigliaro
Copy link

Hi Matt,

I'm struggling with the same two issues this morning. I haven't figured out how to remove the wsdl prefix yet, but for converting the SOAP calls to camelcase (instead of lower-camelcase), I'm doing this:

soap.action[0] = soap.action[0,1].upcase
soap.input[0] = soap.input[0,1].upcase

@mconigliaro
Copy link

don't know why my two lines turned into one, but here's try #2:

soap.action[0] = soap.action[0,1].upcase

soap.input[0] = soap.input[0,1].upcase

@MattMencel
Copy link
Author

Thanks...I'll give that a try.

I also just posted the Zimbra soap.txt to a gist... http://gist.github.com/428946 ...for those that don't have access to a Zimbra server docs directory.

@MattMencel
Copy link
Author

Hi Michael,

Tried your code snippet. That solved the CamelCase problem but still leaves the issue that the Zimbra server will not accept the SOAP XML with tags like this...
wsdl:AuthRequest

@mconigliaro
Copy link

Yeah, I still don't know a workaround for that. Luckily for me, the API I'm working with (not Zimbra) doesn't seem to care if the prefix is there or not. Hopefully someone else can chime in with a solution for your problem.

@rubiii
Copy link
Contributor

rubiii commented Jun 8, 2010

quick survey: would you need to changed or disable the :wsdl namespace globally (for all client instances), per client instance or per request?

@MattMencel
Copy link
Author

Hi...when working with the Zimbra SOAP stuff....I would never need it so globally works. Maybe someone else would think differently though. I'd be fine just doing something like this per request though too...

response = client.AuthRequest! do |soap|
  soap.wsdl = false
  soap.version = 2
  soap.namespace = "https://myzimbraserver:7071/service/admin/soap"
  soap.action = "AuthRequest"
  soap.body = '<account>myadminaccount</account><password>myadminpassword</password>'
end

@mconigliaro
Copy link

I think it would be nice to have a way to set the default behavior at the client instance level, then be able to override the default at the request level (as chewie71 described above).

@rubiii
Copy link
Contributor

rubiii commented Oct 4, 2010

fixed in dev branch. will be released asap.

@rubiii
Copy link
Contributor

rubiii commented Oct 29, 2010

please try savon 0.8.0.beta.1

@cstearns
Copy link

just tried it...getting the following error when I attempt to create a new client instance:

ruby-1.9.2-p0 > client = Savon::Client.new ''

ArgumentError: wrong number of arguments (1 for 0)
from /Users/cstearns/.rvm/gems/ruby-1.9.2-p0/gems/savon-0.8.0.beta.1/lib/savon/client.rb:32:in initialize' from (irb):2:innew'
from (irb):2
from /Users/cstearns/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `

'

@rubiii
Copy link
Contributor

rubiii commented Oct 30, 2010

you should read the new Savon Guide before getting started.

@cstearns
Copy link

Yes I should! Thanks :)

@rubiii
Copy link
Contributor

rubiii commented Dec 20, 2010

released v0.8.0 which should solve this problem.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants