#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Parsing results from soap:lite


    I need some help getting the results from a soap service that I called. I'm able to successfully make the call and using Dumper($result) I can see the response. I need to parse the application return code and return message so I can check there values. By referencing $result->fault I know the soap call did not fail. However I'm not able to make the same reference to get the value of "ReturnCode" and "ReturnMessage"
    How do I get these values?



    A sample of the code and dumper output is below.



    Dumper output sample: (xxx added to urls)
    <soap:Envelope
    xmlns:soap="httxxxp://schemas.xmlsoap.org/soap/envelope/"
    xmlns:soapenc="httxxxp://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsi="htxxxtp://wwxxxw.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="htxxxtp://wwxxxw.w3.org/2001/XMLSchema">
    <soap:Body>
    <ns:AddDevelopmentInfoResponse xmlns:ns="urn:RULES:SOAP:ProjMgmtStatelessIntegrator:Mgmt-Work">
    <ReturnValues>
    <ReturnCode>5</ReturnCode>
    <ReturnMessage>The item ID is invalid: Item ID not found in system</ReturnMessage>
    </ReturnValues>
    </ns:AddDevelopmentInfoResponse>
    </soap:Body>
    </soap:Envelope>




    Code sample:
    #setup the necessary SOAP parameters
    my $soapres = SOAP::Lite
    -> proxy('httxxxp://mfstg.com/web/SOAPServlet')
    -> uri('urn:RULES:SOAP:ProjMgmtStatelessIntegrator:Mgmt-Work');

    $result=$soapres->AddDevelopmentInfo($request);

    #Debuging code: Uncomment to see full response from PMF
    unless ($result->fault) {
    print STDERR "NoFault\n";
    print STDERR $result->result()."\n";
    } else {
    print STDERR "Fault\n";
    print STDERR join ', ',
    $result->faultcode,
    $result->faultstring,
    $result->faultdetail;
    }
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,113
    Rep Power
    9398

IMN logo majestic logo threadwatch logo seochat tools logo