Soap::Lite assistance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gcwg
    New Member
    • Apr 2010
    • 4

    Soap::Lite assistance

    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 = '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="OPSDocume ntRetrievalServ ice">
    <wsdl:port name="DocumentR etrievalPort" binding="tns:Do cumentRetrieval Binding">
    <soap:address location="http://ops.epo.org//soap-services/document-retrieval"/>
    </wsdl:port>
    </wsdl:service>


    Sample XML request:

    <soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/" xmlns:ops="http ://ops.epo.org">
    <soapenv:Head er/>
    <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:Envelop e>


    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!
Working...