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

Discussion in 'Perl Misc' started by doug, Feb 4, 2004.

  1. doug

    doug Guest

    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>
     
    doug, Feb 4, 2004
    #1
    1. Advertising

  2. doug <> 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
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Feb 5, 2004
    #2
    1. Advertising

  3. doug

    Doug Guest

    > 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.
     
    Doug, Feb 8, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    3
    Views:
    558
    Tor Iver Wilhelmsen
    Sep 17, 2004
  2. Aaron Brady

    SQL, lite lite lite

    Aaron Brady, Dec 29, 2008, in forum: Python
    Replies:
    15
    Views:
    793
    Aaron Brady
    Jan 1, 2009
  3. c676228
    Replies:
    11
    Views:
    959
    Jesse
    Mar 24, 2010
  4. gelbeiche
    Replies:
    0
    Views:
    172
    gelbeiche
    Jul 20, 2006
  5. droesler
    Replies:
    2
    Views:
    587
    droesler
    Aug 31, 2010
Loading...

Share This Page