SOAP::Lite "<namesp1:...." prefix

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="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding /"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<namesp1:NameOfWebserviceMethod xmlns:namesp1="MyWebService">
<value1>aaaaaaaa</value1>
<value2>bbbbbbbb</value2>
<value3>cccccccc</value3>
<value4>dddddddd</value4>
</namesp1:NameOfWebserviceMethod>
</soap:Body>
</soap:Envelope>

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

<NameOfWebserviceMethod xmlns="MyWebService">
<value1>aaaaaaaa</value1>
</NameOfWebserviceMethod>

Regards

Forsh
Forsh [ Fr, 01 Dezember 2006 11:13 ] [ ID #1554639 ]

Re: SOAP::Lite "<namesp1:...." prefix

I think I could have worded this slightly better -

"How do I change/remove the method element prefix?" would be more
appropriate :)
Forsh [ Fr, 01 Dezember 2006 14:33 ] [ ID #1554640 ]

Re: SOAP::Lite "<namesp1:...." prefix

2006-12-01 Forsh wrote
>
> I think I could have worded this slightly better -
>
> "How do I change/remove the method element prefix?" would be more
> appropriate :)

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....
Morten Guldager [ Fr, 01 Dezember 2006 17:21 ] [ ID #1554642 ]

Re: SOAP::Lite "<namesp1:...." prefix

Morten Guldager wrote:

> 2006-12-01 Forsh wrote
> >
> > I think I could have worded this slightly better -
> >
> > "How do I change/remove the method element prefix?" would be more
> > appropriate :)
>
> At the server or client side? (not sure if it matters)
>


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

> Is the "element" you want to change the same as the namespace?
>
>
> /Morten %-) - new to soap as well....

The element that I want to change is this wrapper:

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

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

<NameOfWebserviceMethod xmlns="MyWebService">
</NameOfWebserviceMethod>

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.
Forsh [ Fr, 01 Dezember 2006 17:43 ] [ ID #1554643 ]

Re: SOAP::Lite "<namesp1:...." prefix

On 12/01/2006 10:43 AM, Forsh wrote:
> Morten Guldager wrote:
>
>> 2006-12-01 Forsh wrote
>>> I think I could have worded this slightly better -
>>>
>>> "How do I change/remove the method element prefix?" would be more
>>> appropriate :)
>> At the server or client side? (not sure if it matters)
>>
>
>
> It is at the client side. (It does matter in this instance!)
>
>> Is the "element" you want to change the same as the namespace?
>>
>>
>> /Morten %-) - new to soap as well....
>
> The element that I want to change is this wrapper:
>
> <namesp1:NameOfWebserviceMethod xmlns:namesp1="MyWebService">
> </namesp1:NameOfWebserviceMethod>
>
> The "namesp1" text is the "method element prefix", and if possible I
> need to get this wrapper to look like:
>
> <NameOfWebserviceMethod xmlns="MyWebService">
> </NameOfWebserviceMethod>
>
> 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.
>

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

$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.


--
paduille.4060.mumia.w [at] earthlink.net
paduille.4060.mumia.w [ Sa, 02 Dezember 2006 00:21 ] [ ID #1554644 ]

Re: SOAP::Lite "<namesp1:...." prefix

Forsh wrote:

> Morten Guldager wrote:
>
>
>>2006-12-01 Forsh wrote
>>
>>>I think I could have worded this slightly better -
>>>
>>>"How do I change/remove the method element prefix?" would be more
>>>appropriate :)
>>
>>At the server or client side? (not sure if it matters)
>>
>
>
>
> It is at the client side. (It does matter in this instance!)
>
>
>>Is the "element" you want to change the same as the namespace?
>>
>>
>>/Morten %-) - new to soap as well....
>
>
> The element that I want to change is this wrapper:
>
> <namesp1:NameOfWebserviceMethod xmlns:namesp1="MyWebService">
> </namesp1:NameOfWebserviceMethod>
>
> The "namesp1" text is the "method element prefix", and if possible I
> need to get this wrapper to look like:
>
> <NameOfWebserviceMethod xmlns="MyWebService">
> </NameOfWebserviceMethod>
>
> 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.
>

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'}),
[at] argument_list_here);

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 stubmaker.pl, which comes with
SOAP::Lite, and gets installed somewhere on your path.

Tom Wyant
&quot;harryfmudd [AT] [ Sa, 02 Dezember 2006 19:48 ] [ ID #1555389 ]

Re: SOAP::Lite "<namesp1:...." prefix

Thanks very much for the information - it was most helpful. I have
used stubmaker.pl 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">
</namesp1:myMethodName>

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.

Regards
Forsh [ Mo, 04 Dezember 2006 13:01 ] [ ID #1557119 ]

Re: SOAP::Lite "<namesp1:...." prefix

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.

Forsh
Forsh [ Mo, 04 Dezember 2006 17:25 ] [ ID #1557121 ]
Perl » comp.lang.perl.modules » SOAP::Lite "<namesp1:...." prefix

Vorheriges Thema: Is there any method/way to use API(Windows or Linux)
Nächstes Thema: FDF2XML skript?