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

SOAP::Lite XML parsing into perl tree

Expand Messages
  • Dave Kimberley <dave_kimberley@yahoo.co.
    I am accessing the secure mail system of the UK government Gateway using Perl with SOAP::Lite. The problem I have occurs when getting the message summaries
    Message 1 of 2 , Feb 19, 2003
    • 0 Attachment
      I am accessing the secure mail system of the UK government Gateway
      using Perl with SOAP::Lite.

      The problem I have occurs when getting the message summaries back. I
      use the following line of Perl to retrieve them:

      ($MessageBox,$TicketBook)=$service->GetMessageBox(\$TicketBook,$TYPE_INBOX,0);

      An example of returned XML

      <?xml version="1.0" encoding="UTF-8"?>
      <MessageBox
      targetNamespace="http://www.govtalk.gov.uk/gateway/digitalmail"
      xmlns="http://www.govtalk.gov.uk/gateway/digitalmail"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://www.govtalk.gov.uk/gateway/digitalmail">

      <MessageSummary>
      <MessageID>1</MessageID>
      <ServiceName>IR-PAYE</ServiceName>
      <DocumentType>Text</DocumentType>
      <Subject>EOY Returns Information</Subject>
      <DateTimeStamp>2001-09-11T09:30:47-05:00</DateTimeStamp>
      <ReplyAccepted>true</ReplyAccepted>
      <MessageState>UNREAD</MessageState>
      <MessageType>INBOX</MessageType>
      </MessageSummary>

      <MessageSummary>
      <MessageID>2</MessageID>
      <ServiceName>IR-PAYE</ServiceName>
      <DocumentType>P6</DocumentType>
      <Subject>Your P6 Notificaiton</Subject>
      <DateTimeStamp>2001-09-11T09:30:47-05:00</DateTimeStamp>
      <ReplyAccepted>false</ReplyAccepted>
      <MessageState>UNREAD</MessageState>
      <MessageType>INBOX</MessageType>
      </MessageSummary>

      </MessageBox>

      The problem I get is I only get one MessageSummary, the unique
      MessageID is within the MessageSummary. I can access the MessageID of
      that summary as follows:

      $MessageID=$MessageBox->{'MessageBox'}->{'MessageSummary'}->{'MessageID'};

      How can I change the way SOAP::Lite parses the XML or stop it from
      parsing the XML altogether?
    • Dave Kimberley <dave_kimberley@yahoo.co.
      I am accessing the secure mail system of the UK government Gateway using Perl with SOAP::Lite. They provide a wsdl file:
      Message 2 of 2 , Feb 24, 2003
      • 0 Attachment
        I am accessing the secure mail system of the UK government Gateway
        using Perl with SOAP::Lite.

        They provide a wsdl file:

        https://secure.gateway.gov.uk/GGMSSoap/GGMSAPI.wsdl

        I am using the following Perl script:

        #!/usr/local/bin/perl -w
        use strict;
        use SOAP::Lite;

        my $MessageID='';
        my $Status='';
        my $TicketBook='';

        my $soap =
        SOAP::Lite->service('https://secure.gateway.gov.uk/GGMSSoap/GGMSAPI.wsdl');
        ($Status, $TicketBook) = $soap->Logon(\$TicketBook, $Username, $Password);
        if ($Status ed 'true')
        {
        ($MessageBox, $TicketBook) = $soap->GetMessageBox(\$TicketBook,
        'INBOX', 0);

        $MessageID=$MessageBox->{'MessageBox'}->{'MessageSummary'}->{'MessageID'};
        print $MessageID;
        ($Status) = $soap->Logoff(\$TicketBook);
        }

        The problem I get is I only get one MessageSummary, as the unique
        MessageID is within the MessageSummary. I can access the MessageID of
        that summary as follows:

        $MessageID=$MessageBox->{'MessageBox'}->{'MessageSummary'}->{'MessageID'};

        The XML returned is supposed to be like the following example:

        <?xml version="1.0" encoding="UTF-8"?>
        <MessageBox
        targetNamespace="http://www.govtalk.gov.uk/gateway/digitalmail"
        xmlns="http://www.govtalk.gov.uk/gateway/digitalmail"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.govtalk.gov.uk/gateway/digitalmail">

        <MessageSummary>
        <MessageID>1</MessageID>
        <ServiceName>IR-PAYE</ServiceName>
        <DocumentType>Text</DocumentType>
        <Subject>EOY Returns Information</Subject>
        <DateTimeStamp>2001-09-11T09:30:47-05:00</DateTimeStamp>
        <ReplyAccepted>true</ReplyAccepted>
        <MessageState>UNREAD</MessageState>
        <MessageType>INBOX</MessageType>
        </MessageSummary>

        <MessageSummary>
        <MessageID>2</MessageID>
        <ServiceName>IR-PAYE</ServiceName>
        <DocumentType>P6</DocumentType>
        <Subject>Your P6 Notificaiton</Subject>
        <DateTimeStamp>2001-09-11T09:30:47-05:00</DateTimeStamp>
        <ReplyAccepted>false</ReplyAccepted>
        <MessageState>UNREAD</MessageState>
        <MessageType>INBOX</MessageType>
        </MessageSummary>

        </MessageBox>

        How can I access all the MessageSummary entries?

        Thanks


        Dave
      Your message has been successfully submitted and would be delivered to recipients shortly.