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

Trying to build a complex envelope

Expand Messages
  • Andrew Koebrick
    Greetings, I am attempting to connect to a WSDL (for an Ultraseek search engine) and call a basic method. My SOAP::Lite client consistanly fails. I am,
    Message 1 of 2 , Sep 27, 2004
      Greetings,

      I am attempting to connect to a WSDL (for an Ultraseek search engine)
      and call a basic method. My SOAP::Lite client consistanly fails. I
      am, however, able to generate a functional envelope using Mindreef's
      SOAPscope. Can anyone please assit me on how to get SOAP::Lite to
      create an equivenant envelope?

      ######################################
      First, the functional envelope generated from SOAPscope:

      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope xmlns:search="http://verity.com/service/2003/search"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soap:Body
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <search:visitURL>
      <visitURLRequestPart
      xsi:type="search:VisitURLRequestMessage">
      <sources soapenc:arrayType="xsd:string[1]"
      xsi:type="soapenc:Array">
      <item xsi:type="xsd:string">state</item>
      </sources>
      <urls soapenc:arrayType="xsd:string[1]"
      xsi:type="soapenc:Array">
      <item
      xsi:type="xsd:string">http://server.admin.state.mn.us/test2.htm</item>
      </urls>
      </visitURLRequestPart>
      </search:visitURL>
      </soap:Body>
      </soap:Envelope>


      ##################################################
      Next, my lame SOAP::Lite program:

      #!/usr/bin/perl
      use SOAP::Lite +trace => 'debug';
      my $soap = SOAP::Lite
      -> service
      ("http://search.state.mn.us/webservices/ultraseek.wsdl")
      -> on_fault(sub { my($soap, $res) = @_;
      die ref $res ? $res->faultdetail : $soap->transport-
      >status, "\n";
      });

      $soap->visitURL(
      SOAP::Data->name('sources')->value('state'),
      SOAP::Data->name('urls')->value
      ('http://server.admin.state.mn.us/resource.html?Id=7997')


      #SOAP::Data->name('sources')->value('state')->type
      ('search:StringArray'), ##Tried this too, but it fails.
      #SOAP::Data->name('urls')->value
      ('http://server.admin.state.mn.us/resource.html?Id=7997')->type
      ('search:StringArray'), ##Tried this too, but it fails.

      );

      ###################################################
      Which results in this envelope:

      <?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>
      <namesp1:visitURL
      xmlns:namesp1="http://verity.com/service/2003/search">
      <sources xsi:type="xsd:string">state</sources>
      <urls
      xsi:type="xsd:string">http://server.admin.state.mn.us/resource.html?
      Id=7997</urls>
      </namesp1:visitURL>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>


      ######################################

      From my reading of the perldocs and cookbook I dont see a way to
      force the StringArray type successfully, or embed my variables into
      the VisitURLRequestMessage structure. Any assistance would be
      greatly appreciated.

      Cheers,

      Andrew Koebrick
      Minnesota Dept. of Administration
      Librarian / Web Guy
    • Andrew Koebrick
      I am posting a solution to my own question, in case future programmers face an identical/similar problem. Thanks for the off-list assistace I received. The
      Message 2 of 2 , Sep 30, 2004
        I am posting a solution to my own question, in case future 
        programmers face an identical/similar problem.
        
        Thanks for the off-list assistace I received.  The final impediment 
        was my own lack of understanding (now remedied) regarding namespaces.
        
        Anyhow, here is functional Perl::Lite code to interact with the 
        Ultraseek WSDL (in this case suggesting a new URL):
        
        #!/usr/bin/perl
        use SOAP::Lite;
        
        my (@sources,@urls);
        $urls[0] = "http://server.admin.state.mn.us/test12.htm";
        $sources[0] = "state";
        
        my $soap = SOAP::Lite
                -> service
        ("http://search.state.mn.us/webservices/ultraseek.wsdl")
                -> on_fault(sub { my($soap, $res) = @_;
                 die ref $res ? $res->faultdetail : $soap->transport-
        
        >status, "\n";
          
               });
        $soap->visitURL(
        SOAP::Data->name("visitURLRequestPart" => \SOAP::Data->value(
              SOAP::Data->name("sources" =>
                                \SOAP::Data->value(SOAP::Data->name("item" => 
        @sources)->type("xsd:string")
                                   )
                        )->attr({'SOAP-ENC:arrayType' =>'xsd:string[1]'})-
        
        >type("SOAP-ENC:Array"),
          
              SOAP::Data->name("urls" =>
                                \SOAP::Data->value(SOAP::Data->name("item" => 
        @urls)->type("xsd:string")
                                   )
                               )->attr({'SOAP-ENC:arrayType' =>'xsd:string
        [1]'})->type("SOAP-ENC:Array")
         ))->type("namesp1:VisitURLRequestMessage")
        );
        
        
        
        
        


        Andrew Koebrick wrote:
        Greetings,

        I am attempting to connect to a WSDL (for an Ultraseek search engine)
        and call a basic method.  My SOAP::Lite client consistanly fails.  I
        am, however, able to generate a functional envelope using Mindreef's
        SOAPscope.  Can anyone please assit me on how to get SOAP::Lite to
        create an equivenant envelope?

        ######################################
        First, the functional envelope generated from SOAPscope:

        <?xml version="1.0" encoding="UTF-8"?>
        <soap:Envelope xmlns:search="http://verity.com/service/2003/search"
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
           <soap:Body
        soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
              <search:visitURL>
                 <visitURLRequestPart
        xsi:type="search:VisitURLRequestMessage">
                    <sources soapenc:arrayType="xsd:string[1]"
        xsi:type="soapenc:Array">
                       <item xsi:type="xsd:string">state</item>
                    </sources>
                    <urls soapenc:arrayType="xsd:string[1]"
        xsi:type="soapenc:Array">
                       <item
        xsi:type="xsd:string">http://server.admin.state.mn.us/test2.htm</item>
                    </urls>
                 </visitURLRequestPart>
              </search:visitURL>
           </soap:Body>
        </soap:Envelope>


        ##################################################
        Next, my lame SOAP::Lite program:

        #!/usr/bin/perl
        use SOAP::Lite +trace =>  'debug';
        my $soap = SOAP::Lite
                -> service
        ("http://search.state.mn.us/webservices/ultraseek.wsdl")
                -> on_fault(sub { my($soap, $res) = @_;
                 die ref $res ? $res->faultdetail : $soap->transport-
        >status, "\n";
               });

        $soap->visitURL(
        SOAP::Data->name('sources')->value('state'),
        SOAP::Data->name('urls')->value
        ('http://server.admin.state.mn.us/resource.html?Id=7997')


        #SOAP::Data->name('sources')->value('state')->type
        ('search:StringArray'),   ##Tried this too, but it fails.
        #SOAP::Data->name('urls')->value
        ('http://server.admin.state.mn.us/resource.html?Id=7997')->type
        ('search:StringArray'), ##Tried this too, but it fails.

                      );

        ###################################################
        Which results in this envelope:

        <?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>
        <namesp1:visitURL
        xmlns:namesp1="http://verity.com/service/2003/search">
        <sources xsi:type="xsd:string">state</sources>
        <urls
        xsi:type="xsd:string">http://server.admin.state.mn.us/resource.html?
        Id=7997</urls>
        </namesp1:visitURL>
        </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>


        ######################################

        >From my reading of the perldocs and cookbook I dont see a way to
        force the StringArray type successfully, or embed my variables into
        the VisitURLRequestMessage structure.  Any assistance would be
        greatly appreciated.

        Cheers,

        Andrew Koebrick
        Minnesota Dept. of Administration
        Librarian / Web Guy




        -- 
        Andrew Koebrick
        Minnesota Bicycle and Pedestrian Alliance, President
        
        www.bikeped.org
        651-222-2080 --Sibley Bike Depot
        612-276-0641 --Home
        
        The MBPA is a 501(c)3 member supported non-profit dedicated to facilitating biking and walking as a healthy form of transportation.  In addition to advocacy and education, we also run the Sibley Bike Depot, a community bicycle education facility in downtown St. Paul.
        
        
      Your message has been successfully submitted and would be delivered to recipients shortly.