For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > December 2006 > SOAP::Lite "<namesp1:...." prefix









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2006-12-01, 7:57 am

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

2006-12-01, 7:57 am


I think I could have worded this slightly better -

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

Morten Guldager

2006-12-01, 6:57 pm

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

2006-12-01, 6:57 pm


Morten Guldager wrote:

> 2006-12-01 Forsh wrote
>
> 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.

Mumia W. (reading news)

2006-12-01, 6:57 pm

On 12/01/2006 10:43 AM, Forsh wrote:
> Morten Guldager wrote:
>
>
>
> It is at the client side. (It does matter in this instance!)
>
>
> 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@earthlink.net
harryfmudd [AT] comcast [DOT] net

2006-12-02, 6:56 pm

Forsh wrote:

> Morten Guldager wrote:
>
>
>
>
>
> It is at the client side. (It does matter in this instance!)
>
>
>
>
> 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'}),
@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
Forsh

2006-12-04, 7:56 am

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

2006-12-04, 6:57 pm

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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com