Project Links

Recommended Books

Donate


« Go get 0.65_4 | Main | 0.65_5 Released - Critical update for XMLRPC users »

uri and use_prefix deprecated in next release

I have seen a lot of support requests recently asking about setting default namespaces and the like. As a result, I will be introducing some changes to the API that I believe makes this task much more intuitive. Of course, changing the API should not be done lightly, especially to a subroutine like uri which is used by every installation of SOAP::Lite on the planet - one way or another. So it will be slowly phased out. So what are these changes, you ask?

First, there are two new subroutines added to SOAP::Serializer and also made available through SOAP::Lite as a shortcut, they are: default_ns() and ns(). They set the namespace URI of a request while at the same time express how that namespace should be serialized - either as a default namespace or as a declared namespace. Second, to provide a more intuitive name, use_prefix is being deprecated in favor of one of the aforementioned subroutines. Finally, uri() is also being deprecated for similar reasons. It's name never did make that much sense to me, and I am hoping that ns() is more intuitive.

Keep reading to see the man page entries for these new subroutines.

default_ns($uri) - Sets the default namespace for the request to the specified uri. This overrides any previous namespace declaration that may have been set using a previous call to ns() or default_ns(). Setting the default namespace causes elements to be serialized without a namespace prefix, like so:

  <soap:Envelope>
    <soap:Body>
      <myMethod xmlns="http://www.someuri.com">
        <foo />
      </myMethod>
    </soap:Body>
  </soap:Envelope>
ns($uri,$prefix=undef) - Sets the namespace uri and optionally the namespace prefix for the request to the specified values. This overrides any previous namespace declaration that may have been set using a previous call to ns() or default_ns(). If a prefix is not specified, one will be generated for you automatically. Setting the namespace causes elements to be serialized with a namespace prefix, like so:

  <soap:Envelope>
    <soap:Body>
      <my:myMethod xmlns:my="http://www.someuri.com">
        <my:foo />
      </my:myMethod>
    </soap:Body>
  </soap:Envelope>

Comments

Thanks, very helpful information

Thanks, very helpful information

http://www.lookcut.com

The comments to this entry are closed.

Don't Hate the Ads

Recent Comments

Recent Posts

Blog powered by TypePad