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

How to specify namespace for the method name tag

Expand Messages
  • vinograd
    Hello, I need to generate the following request:
    Message 1 of 2 , Sep 30 5:20 PM
    • 0 Attachment
      Hello,
      I need to generate the following request:
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <test2 xmlns="http://test.com/webservices/">
      <p1>string</p1>
      <p2>string</p2>
      </test2>
      </soap:Body>
      </soap:Envelope>

      My current code is:

      print SOAP::Lite
      -> service('http://www.test.com/webservices/test.asmx?WSDL')
      -> xmlschema('http://www.w3.org/2001/XMLSchema')
      -> envprefix('soap')
      -> test2(SOAP::Data->name("p1" => 'param1'), SOAP::Data->name
      ("p2" => 'param2'));

      It generates the following request:

      <?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>
      <test2 xmlns="">
      <p1 xsi:type="xsd:string">param1</p1>
      <p2 xsi:type="xsd:string">param2</p2>
      </test2>
      </soap:Body>
      </soap:Envelope>


      The only thing that's missign is the namespace specification for
      test2.
      I get this:
      <test2 xmlns="">
      instead of this:
      <test2 xmlns="http://test.com/webservices/">

      I tried adding -> uri('http://test.com/webservices/') like this:
      print SOAP::Lite
      -> service('http://www.merchantgear.com/webservices/test.asmx?
      WSDL')
      -> xmlschema('http://www.w3.org/2001/XMLSchema')
      -> envprefix('soap')
      -> uri('http://merchantgear.com/webservices/')
      -> test2(SOAP::Data->name("p1" => 'param1'), SOAP::Data->name
      ("p2" => 'param2'));

      But it didn't help.

      What do I need to do to specify namespace for the method name tag?
      Thanks,
      Ilya
    • rjray@blackperl.com
      Disclaimer: I don t know for certain that this will work, and I don t have the time at the moment to test it. If it doesn t, I can try to figure out what I get
      Message 2 of 2 , Oct 1, 2002
      • 0 Attachment
        Disclaimer: I don't know for certain that this will work, and I don't have the
        time at the moment to test it. If it doesn't, I can try to figure out what I
        get wrong below...

        > print SOAP::Lite
        > -> service('http://www.test.com/webservices/test.asmx?WSDL')
        > -> xmlschema('http://www.w3.org/2001/XMLSchema')
        > -> envprefix('soap')
        > -> test2(SOAP::Data->name("p1" => 'param1'),
        > SOAP::Data->name("p2" => 'param2'));

        Rather than calling the remote subroutine directly by name as in the above
        example, consider using the "call" method and passing a SOAP::Data object as
        the first parameter (the first parameter is taken as the remote name to call):

        > print SOAP::Lite
        > -> service('http://www.test.com/webservices/test.asmx?WSDL')
        > -> xmlschema('http://www.w3.org/2001/XMLSchema')
        > -> envprefix('soap')
        > -> call(SOAP::Data->name('test2')->uri("http://test.com/webservices/"),
        > SOAP::Data->name("p1" => 'param1'),
        > SOAP::Data->name("p2" => 'param2'));

        See if this works. If it doesn't, I'll try again when I'm a little more
        focused...

        Randy
        --
        """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
        Randy J. Ray rjray@...
        Campbell, CA rjray@...
        <A HREF="http://www.svsm.org">Silicon Valley Scale Modelers</A>
      Your message has been successfully submitted and would be delivered to recipients shortly.