gwong 0 Newbie Poster

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.

#!/usr/local/bin/perl

# Load the SOAP library
use SOAP::Lite;
 
# Service details
my $NAMESPACE = 'http://ops.epo.org//soap-services/document-retrieval';
my $ENDPOINT = 'http://ops.epo.org//soap-services/document-retrieval';
 
# Create interface to the service
my $soap = new SOAP::Lite(uri   => $NAMESPACE,
                          proxy => $ENDPOINT);
# Add a fault handler to map a fault to a die
$soap->on_fault(
	sub {    # SOAP fault handler
		my $soap = shift;
		my $res  = shift;
 
		# Map faults to exceptions
		if ( ref($res) eq '' ) {
			die($res);
		}
		else {
			die( $res->faultstring );
		}
		return new SOAP::SOM;
	}
);
 

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

print "reqeuest = $request\n";

# Perform the query
my $result = $soap->call('OPSDocumentRetrievalService' => $request);

# Output the result
print $result->result;

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!