Project Links

Recommended Books

Donate


How to Persist SOAP Headers in SOAP::Lite

I discovered recently that SOAP::Lite isn't necessary well-behaved when it comes to conforming to SOAP intermediary requirements. According to the spec, SOAP services must ignore headers not addressed to them and must pass them along untouched in any response they deliver. Now most developers don't need to worry about this because this capability is only relevant to people invoking SOAP intermediaries. However, at Grand Central where I work, we use SOAP intermediaries all the time; in one scenario, we were calling a Web Service I built using Perl, but it did not persist SOAP Headers properly. So, I wrote some code to address the problem, and now it works as the SOAP spec requires.

Continue reading "How to Persist SOAP Headers in SOAP::Lite" »

How do you turnoff the blasted c-gensym elements?

This is a simple answer addressed in an article I wrote for Builder.com entitled A Hands On Tour of SOAP::Lite. The answer is also answered, albeit indirectly, in a previous post about complex types. The secret is properly escaping the SOAP::Data element like so: \SOAP::Data. I know, it is not very intuitive. :-(

How to add multiple namespaces to an element

For those with really complicated XML elements that need to have multiple namespace declarations - possibly because some out of scope XML attributes need to be declared - can rest assured that there is an easy way to do it. It is not as automatic as the traditional SOAP::Lite->uri() method, but it works just the same...

Continue reading "How to add multiple namespaces to an element" »

Composing messages with raw XML...

I was faced with the dilemna of having an XML document that I had scraped from a web page that I wanted to encode into a SOAP Envelope, but I couldn't figure out how to do it, so I asked the SOAP::Lite mailing list (a long time ago) and got my answer. And since several others (including this one, and this one) have asked the same question. Since the question is so popular - here is how you do it...

Continue reading "Composing messages with raw XML..." »

Override the root element of the response

Last week I showed how to override the root element of a request, but did not show a way to do the same thing for the root element of a response. So, read on if you would like to know how to modify the response's namespace, namespace prefix, encoding style, etc. It is not very intuitive, or pretty for that matter, but at least it is relatively simple.

Continue reading "Override the root element of the response" »

How To Specify Multiple Namespaces

Someone asked on the SOAP::Lite message board about how to specify multiple namespaces in a request. The following little code snippet answers that question. The trick is using the SOAP::Data->attr() subroutine...

Continue reading "How To Specify Multiple Namespaces" »

How do you modify the root element of a request?

SOAP::Lite's API allows you to call remote Web service operations easily within your code. Simply instantiate an instance of a service, and execute (or call) the remote method directly from your service instance. For example, a call might look like "$soap->myMethod(arguments)." However, while this convention makes for a nice API, by calling the method in this way you give up control over the attributes of the root SOAP Body element. So how do you change the namespace, the prefix, or attributes of the root element?

Continue reading "How do you modify the root element of a request?" »

Don't Hate the Ads

Recent Comments

Recent Posts

Blog powered by TypePad