By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,811 Members | 1,978 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,811 IT Pros & Developers. It's quick & easy.

Soap::Lite assistance

P: 4
Hi,
I am new to using the Soap::Lite perl module. Here is a piece of code to retrieve an image, but it does not seem to working properly.
Expand|Select|Wrap|Line Numbers
  1. #!/usr/local/bin/perl
  2.  
  3. # Load the SOAP library
  4. use SOAP::Lite;
  5.  
  6. # Service details
  7. my $NAMESPACE = 'http://ops.epo.org//soap-services/document-retrieval';
  8. my $ENDPOINT = 'http://ops.epo.org//soap-services/document-retrieval';
  9.  
  10. # Create interface to the service
  11. my $soap = new SOAP::Lite(uri   => $NAMESPACE,
  12.                           proxy => $ENDPOINT);
  13. # Add a fault handler to map a fault to a die
  14. $soap->on_fault(
  15.     sub {    # SOAP fault handler
  16.         my $soap = shift;
  17.         my $res  = shift;
  18.  
  19.         # Map faults to exceptions
  20.         if ( ref($res) eq '' ) {
  21.             die($res);
  22.         }
  23.         else {
  24.             die( $res->faultstring );
  25.         }
  26.         return new SOAP::SOM;
  27.     }
  28. );
  29.  
  30.  
  31. my $request = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ops=\"http://ops.epo.org\">";
  32. $request = $request . "<soapenv:Header\/>";
  33. $request = $request . "<soapenv:Body>";
  34. $request = $request . "<ops:document-retrieval id=\"EP        1000000A1 I \" page-number=\"1\" document-format=\"SINGLE_PAGE_PDF\" system=\"ops.epo.org\">";
  35. $request = $request . "<\/ops:document-retrieval>";
  36. $request = $request . "<\/soapenv:Body>";
  37. $request = $request . "<\/soapenv:Envelope>";
  38.  
  39. print "reqeuest = $request\n";
  40.  
  41. # Perform the query
  42. my $result = $soap->call('OPSDocumentRetrievalService' => $request);
  43.  
  44. # Output the result
  45. print $result->result;
  46.  
from the wsdl file I am interested in this service:


<wsdl:service name="OPSDocumentRetrievalService">
<wsdl:port name="DocumentRetrievalPort" binding="tns:DocumentRetrievalBinding">
<soap:address location="http://ops.epo.org//soap-services/document-retrieval"/>
</wsdl:port>
</wsdl:service>


Sample XML request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ops="http://ops.epo.org">
<soapenv:Header/>
<soapenv:Body>
<ops:document-retrieval id="EP 1000000A1 I " page-number="1" document-format="SINGLE_PAGE_PDF" system="ops.epo.org">
</ops:document-retrieval>
</soapenv:Body>
</soapenv:Envelope>


I get the following error message when I try to run the script:

mismatched tag at line 1, column 944, byte 944 at /usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris/XML/Parser.pm line 187


The xml request seems to be valid and looks correct. Am I sending the request the wrong way or calling the service incorrectly?

Thanks for any replies!
Apr 8 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.