Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Soap-Lite XML parameter error, doc must have top level element

Reply
Thread Tools

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

 
 
doug
Guest
Posts: n/a
 
      02-04-2004
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_credentia ls {
return 'storetest' => 'mm0822tt#';
}

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


<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlnssi="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/"
xmlnssd="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>
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      02-05-2004
doug <(E-Mail Removed)> wrote:

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


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
 
Doug
Guest
Posts: n/a
 
      02-08-2004
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML document must have a top level element c676228 ASP General 11 03-24-2010 11:36 PM
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
c is a low-level language or neither low level nor high level language pabbu C Programming 8 11-07-2005 03:05 PM
XML Element must have CDATA tages around it. Mike ASP .Net Web Services 3 03-08-2005 08:31 PM
String[] files = {"a.doc, b.doc"}; VERSUS String[] files = new String[] {"a.doc, b.doc"}; Matt Java 3 09-17-2004 10:28 PM



Advertisments