This shows you the differences between two versions of the page.
|
blog:written:perl_s_soaplite_-_turn_off_c-gensym_and_s-gensym [2009/02/12 13:43] davek |
blog:written:perl_s_soaplite_-_turn_off_c-gensym_and_s-gensym [2009/02/12 13:47] (current) davek |
||
|---|---|---|---|
| Line 11: | Line 11: | ||
| However, I constantly run into one problem that I seem to need to resolve very few months. I'm documenting it here. | However, I constantly run into one problem that I seem to need to resolve very few months. I'm documenting it here. | ||
| - | SOAP::Lite enjoys putting c-gensym/s-gensym tags around the arguments of my soap method and method response. generally perl figures out what I went when I'm using perl on both the server and client side. However when I have to conform with a standard or operate cross languages, these gensym tags cause problems. | + | SOAP::Lite enjoys putting c-gensym/s-gensym tags around the arguments of my soap method and method response. generally perl figures out what I want when I'm using perl on both the server and client side. However when I have to conform to a standard or operate cross languages, these gensym tags cause problems. |
| - | Most frequently I have a hashref I want to return. I want the the XML to look like this: | + | Most frequently I have a hashref I want to return. I want the XML to look like this: |
| <code> | <code> | ||
| <element_1> | <element_1> | ||
| Line 32: | Line 32: | ||
| $send_this = SOAP::Data->value( | $send_this = SOAP::Data->value( | ||
| map | map | ||
| - | { SOAP::Data->name( $_ => $reports->{$_}) } | + | { SOAP::Data->name( $_ => $hash->{$_}) } |
| - | keys(%{$reports}) | + | keys(%{$hash}) |
| ); | ); | ||
| - | Basically, this pulls each top-level hash element off, turns it into a SOAP::Data name/value pair, pushes onto an array, and then SOAP:Data()'s that final result. | + | Basically, this pulls each top-level hash element from $hash, turns the element into a SOAP::Data() name/value pair, pushes onto an array, and then SOAP:Data()'s that final result. |
| The result is suitable for sending to SOAP::Lite and getting a SOAP method body that looks as desired. | The result is suitable for sending to SOAP::Lite and getting a SOAP method body that looks as desired. | ||
| If your hashref is deeper than this example, no problem. SOAP::Lite handles that correctly. Only the top-level elements need to be converted to these SOAP::Data() name/value pairs. The hashrefs inside them translate to XML properly without further user intervention. | If your hashref is deeper than this example, no problem. SOAP::Lite handles that correctly. Only the top-level elements need to be converted to these SOAP::Data() name/value pairs. The hashrefs inside them translate to XML properly without further user intervention. | ||