Soap-Lite XML parameter error, doc must have top level element

D

doug

Hi, I'm using Soap-lite as a client to talk to a .Net server. It
works great using one parameter. When I add the second parameter, a
XML string, it fails. When I load the string that it generated into a
browser it also fails. It doesn't like the < symbols.

I've read that Soap-lite defaults to soap encoding ang .Net requires
literal encoding, but don't know how to change it on the client side.

Here is the code I'm using with the envelope following.

Thanks for any help
Doug

use SOAP::Lite;

my $prod = "<?xml version = \"1.0\" encoding=\"UTF-8\"
standalone=\"yes\"?>" .
"<VFPData><row cupc=\"06365200060\"/><row
cups=\"06365200080\"/>" .
"<row cupc=\"06365200001\"/></VFPData>";

print SOAP::Lite
-> service('http://192.168.101.2/ip2.wsdl')
-> GetProducts("123", $prod), "\n";

sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return 'storetest' => 'mm0822tt#';
}

my @params = ( SOAP::Data->name(x1 => "123"),
SOAP::Data->name(x2 => $prod) );


<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<GetProducts xmlns="">
<parameters>123</parameters>
<c-gensym4 xsi:type="xsd:string">
&lt;?xml version = "1.0" encoding="UTF-8" standalone="yes"?>
&lt;VFPData>
&lt;row cupc="06365200060"/>
&lt;row cups="06365200080"/>
&lt;row cupc="06365200001"/>
&lt;/VFPData></c-gensym4>
</GetProducts>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
 
T

Tad McClellan

doug said:
my $prod = "<?xml version = \"1.0\" encoding=\"UTF-8\"
standalone=\"yes\"?>" .


If you used single quotes for the string, you wouldn't need
all of those backslashes.
 
D

Doug

Hi, I'm using Soap-lite as a client to talk to a .Net server. It
works great using one parameter. When I add the second parameter, a
XML string, it fails. When I load the string that it generated into a
browser it also fails. It doesn't like the &lt; symbols.

This turned out to be red herring. When enclosing an xml string within xml,
all the <>&" chars are translated going in and converted coming out. That's
working as designed.

The problem I had turned out to be the namespaces on the method call and the
parameters. I've got it working in Java, now to figure out how to do it in
soap-lite.
At least I know where to look as the error messages from .Net are misleading
at best.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top