Loading ...
Sorry, an error occurred while loading the content.

AW: [soaplite] Adding attributes to envelope tag / changing name of a body tag

Expand Messages
  • Martin Busik
    Hi, ... the prefixes (e.g. soap is refered to as prefix when defined by xmlns:soap , wich means you write soap:Envelope ) do not really care, you can name
    Message 1 of 2 , Feb 12, 2011
    View Source
    • 0 Attachment
      Hi,

      > 1. My call from SOAP::Lite uses the following envelope tag:
      >
      > <soap:Envelope
      > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      > xmlns:soapenc="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/">
      >
      > I need to get the envelop tag to have these attributes instead:
      >
      > <soap:Envelope
      > xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
      > xmlns:xsd="http://www.scene7.com/IpsApi/xsd"
      > xmlns:ns="http://www.scene7.com/IpsApi/xsd/2010-01-31">

      the prefixes (e.g. "soap" is refered to as prefix when defined by
      "xmlns:soap", wich means you write "soap:Envelope")
      do not really care, you can name them as you want.

      I see a difference in the Envelope uri:

      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

      vs.

      xmlns:soap="http://www.w3.org/2003/05/soap-envelope"

      I'haven't checked the differences yet, but there may some differences
      occur...



      > my $params = SOAP::Data->name("ns:checkLoginParam" =>
      > \SOAP::Header->value(
      > SOAP::Header->name('ns:email')->value($s7user)->type(''),
      > SOAP::Header->name('ns:password')->value($s7pass)->type(''),
      > ));
      >
      > # request method
      > $soap->call('checkLogin', $params, $authHeader);
      >
      >
      > .. this produces the following xml ...
      >
      > <soap:Body>
      > <checkLogin xmlns="http://www.scene7.com/IpsApi/xsd/2010-01-31">
      > <ns:checkLoginParam>
      > <ns:email>myemail/ns:email>
      > <ns:password>mypass</ns:password>
      > </ns:checkLoginParam>
      > </checkLogin>
      > </soap:Body>
      >
      > Is there a way for me to remove the checkLogin tag from being
      > wrapped around checkLoginParam? The working code that I have
      > from soapUI that I am attempting to reproduce is this:
      >
      > <soap:Body>
      > <ns:checkLoginParam>
      > <ns:email>myemail</ns:email>
      > <ns:password>mypass</ns:password>
      > </ns:checkLoginParam>
      > </soap:Body>

      "checkLogin" is the main body element, it is refered to as "method name".

      This is, because your code uses: $soap->call('checkLogin',

      The example you have given seems to expect a method "checkLoginParam", which
      would be
      coded as: $soap->call('checkLoginParam',...

      If your email an password elements shall come inside the Body element, you
      should create them
      with SOAP::Data and not SOAP::Header. SOAP::Header is intended to "tell"
      SOAP::Lite to put its
      contents into the Envelope element (instead of into Body)

      HTH,
      Martin
    Your message has been successfully submitted and would be delivered to recipients shortly.