Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Soap::Lite assistance

Status
Not open for further replies.

gcw2001

Programmer
Apr 8, 2010
5
0
0
US
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.
Code:
#!/usr/local/bin/perl

# Load the SOAP library
use SOAP::Lite;
 
# Service details
my $NAMESPACE = '[URL unfurl="true"]http://ops.epo.org//soap-services/document-retrieval';[/URL]
my $ENDPOINT = '[URL unfurl="true"]http://ops.epo.org//soap-services/document-retrieval';[/URL]
 
# 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=\"[URL unfurl="true"]http://schemas.xmlsoap.org/soap/envelope/\"[/URL] xmlns:ops=\"[URL unfurl="true"]http://ops.epo.org\">";[/URL]
$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=" </wsdl:port>
</wsdl:service>


Sample XML request:

<soapenv:Envelope xmlns:soapenv=" xmlns:eek:ps=" <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!
 
Are you sure it is what you are sending that it doesn't like, and not what is being returned? You only have 330 or so bytes in your request, and the parse error occurs at byte 944. It is possible it is blowing up parsing the response.

According to the SOAP::Lite docs you can get it to log the outbound and inbound messages (see which might be worth a try...

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Thanks for the replies guys! It looks like the wsdl document is not compatible with Soap::Lite so I am trying to use the
Soap::WSDL module instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top