Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: How to obtain value from SOAP handle response

  1. #1

    Default How to obtain value from SOAP handle response

    Hello everyone,

    I used the "General - Annoted Web Service Call" example from the sample folder to make a soap call and obtain a response.
    Using the example, I can see how particular values are obtained from the body of the soap response.

    However, when I translate it with my particular response, it doesn't seem to work. I'm not very good at SOAP so I'm certainly doing something wrong.

    Here it is:

    This is my call:

    request = <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlnsmi="http://www.verimatrix.com/omi" xmlnsmit="http://www.verimatrix.com/schemas/OMItypes.xsd">
    <soapenv:Header/>
    <soapenv:Body>
    <omi:signOn>
    <userAttributes>
    <omit:userName>{username}</omit:userName>
    <omitassword>{password}</omitassword>
    </userAttributes>
    </omi:signOn>
    </soapenv:Body>
    </soapenv:Envelope>

    This is my response:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <ns3:signOnResponse xmlns:ns3="http://www.verimatrix.com/omi">
    <sessionHandle>
    <ns1:handle xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd">h0PtwMXVmHp6Oqy7A6CmcrFrnVM=</ns1:handle>
    </sessionHandle>
    <result>
    <ns1:resultId xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd">admin</ns1:resultId>
    <ns1:resultCode xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd">0</ns1:resultCode>
    <ns1:resultText xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd">Success</ns1:resultText>
    </result>
    </ns3:signOnResponse>
    </soapenv:Body>
    </soapenv:Envelope>

    This is the code (pretty much a copy of the sample transformation):
    responseXml = responseXml.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, "");
    var response = new XML(responseXml);

    // Determine the namespace of the SOAP Envelope:
    //
    var soap = response.namespace();

    // Specify the namespace of the verify email response:
    //
    var ws = response.*.*.namespace();

    // Set this namespace as a default to make parsing the response easier:

    default xml namespace = ws

    var responseBody = response.soap::Body.signOnResponse;
    var handle = responseBody.signOnResponse.sessionHandle.handle

    Alert(handle);

    --

    The Alert box is empty.

    However if I place in the alert:
    Alert(responseBody.toXMLString());

    I obtain the following:
    <ns3:signOnResponse xmlns:ns3="http://www.verimatrix.com/omi" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <sessionHandle>
    <ns1:handle xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd">TBdn27dfFPlpWG/HTRgH16LsrkI=</ns1:handle>
    </sessionHandle>
    <result>
    <ns1:resultId xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd">admin</ns1:resultId>
    <ns1:resultCode xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd">0</ns1:resultCode>
    <ns1:resultText xmlns:ns1="http://www.verimatrix.com/schemas/OMItypes.xsd">Success</ns1:resultText>
    </result>
    </ns3:signOnResponse>

    I just can't get to the handle: TBdn27dfFPlpWG/HTRgH16LsrkI=

    A bit of help would be very helpful.

    Thanks a lot

    Nico
    There's no point going somewhere if you don't enjoy the ride.

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    I can't see a SOAP problem here. If you just want to extract the handle from the response, you can use "Get Data from XML" for that - no need for JavaScript.
    So long, and thanks for all the fish.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.