SOAP::Lite "

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

  •   Subject
  • Author
  • Posted on

Hi All,

I'm quite new to Perl and SOAP and have a problem whereby I cant change
the "namesp1" prefix of one of the tags in the serialised SOAP::Lite
message.  The message is analogous to :

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi=" "
xmlns:SOAP-ENC=" /"
xmlns:xsd=" "
soap:encodingStyle=" /"
xmlns:soap=" /">
    <namesp1:NameOfWebserviceMethod xmlns:namesp1="MyWebService">

Does anyone know how to change/remove the "namesp1:" prefix to make the
tag look like:

<NameOfWebserviceMethod xmlns="MyWebService">



Re: SOAP::Lite "

I think I could have worded this slightly better -

"How do I change/remove the method element prefix?"  would be more
appropriate :)

Re: SOAP::Lite "

2006-12-01 Forsh wrote
Quoted text here. Click to load it

At the server or client side? (not sure if it matters)

Is the "element" you want to change the same as the namespace?

/Morten %-) - new to soap as well....

Re: SOAP::Lite "

Morten Guldager wrote:

Quoted text here. Click to load it

It is at the client side.  (It does matter in this instance!)

Quoted text here. Click to load it

The element that I want to change is this wrapper:

<namesp1:NameOfWebserviceMethod xmlns:namesp1="MyWebService">

The "namesp1" text is the "method element prefix", and if possible I
need to get this wrapper to look like:

<NameOfWebserviceMethod xmlns="MyWebService">

I have found it very difficult to find useful information on this
subject, other than lots of references to some interoperability
problems between Perl SOAP::Lite and dotNet web services.

Re: SOAP::Lite "

On 12/01/2006 10:43 AM, Forsh wrote:
Quoted text here. Click to load it

Ideally you would have the XML parser or generator remove the XML
namespace qualifiers; however, a particularly dangerous way to do it is

     $data =~ s/:?\bnamesp1\b:?//g;

Manipulating XML using regular expressions this way is dangerous. Try to
find a module that supports removing namespace information from XML.


Re: SOAP::Lite "

Forsh wrote:

Quoted text here. Click to load it

I haven't seen any code exhibited, but if I understand the question
(which is to get rid of the bogus namespace specification on the front
of the method name) something like

$soap->call (SOAP::Data
     ->name ('NameOfWebserviceMethod')
     ->attr ({xmlns => 'MyWebService'}),

might be a step in the right direction, assuming $soap is the SOAP
object you're working from.

If your service is more persnickety than Perl is about arguments, your
arguments might also need to be SOAP::Data objects: something like

SOAP::Data->new (
     name => 'Arg_name_1',
     type => 'whatever_this_is',
     value => $whatever_this_is_too,

might do the trick.

If you have WSDL to work from, see, which comes with
SOAP::Lite, and gets installed somewhere on your path.

Tom Wyant

Re: SOAP::Lite "

Thanks very much for the information - it was most helpful.  I have
used to make a stub from the wsdl, which I can amend to
tweak the resulting soap request.

I have one more issue to resolve; it is really frustrating.. it seems
that if I specify the "uri" within the .pm file that stubmaker made, as
"WebService", the resulting method element tag looks like the example
below, i.e. with the "namesp1" prefix.

     <namesp1:myMethodName xmlns:namesp1="WebService">

If I do not specify the "uri" then the tag looks like:

     <myMethodName xmlns=""></myMethodName>

i.e. it does not have the "namesp1" prefixes, but the actual "xmlns"
value is blank too.  It's either one or the other, both are wrong for
my purposes as dotNet rejects them.  I would love to be able to get the
tag to look like:

     <myMethodName xmlns="WebService">   </myMethodName>

I've been going around in circles for days now and, short of editting
the core SOAP files within Perl, I cannot see a way around this,
although I am sure there must be one.


Re: SOAP::Lite "

Ignore that last message!  It was a bit of a false alarm, I've managed
to get it to work now and it wasnt really as much of dotNet's fault as
I first made out.  I had assumed I needed to get the SOAP request into
a character-perfect representation of what dotNet wanted but it was not
the case.. it isnt as strict as I thought.

Thanks to those people who helped - it's much appreciated.


Site Timeline