Expand my Community achievements bar.

SOLVED

Logging in to use SOAP API

Avatar

Level 3

Hi

I am testing in postman right now but getting the following error - can anyone tell me what I am doing wrong?:

<?xml version='1.0'?>

<SOAP-ENV:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>

    <SOAP-ENV:Body>

        <SOAP-ENV:Fault>

            <faultcode>SOAP-ENV:Client</faultcode>

            <faultstring xsi:type='xsd:string'>SOP-330007 Error while reading parameters of method 'Logon' of service 'xtk:session'</faultstring>

            <detail xsi:type='xsd:string'>XML-110009 Unable to find the element ':Body' of path '/' (document with schema 'soapenv:Envelope')

SOP-330003 Argument of type 'string' is missing in XML SOAP message.</detail>

        </SOAP-ENV:Fault>

    </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

For reference the details I am using are:

Post request to https://MYDOMAIN/nl/jsp/soaprouter.jsp

headers are:

Content-Type:text/xml; charset=utf-8

SOAPAction:xtk:session#Logon

Body is:

<soapenv:Envelope xmlns:soapenv="https://schemas.xmlsoap.org/soap/envelope" xmlns:urn="xtk:session">

   <soapenv:Header />

   <soapenv:Body>

      <urn:Logon>

         <urn:sessiontoken />

         <urn:strLogin>MYUSERNAME</urn:strLogin>

         <urn:strPassword>MYPASSWORD</urn:strPassword>

         <urn:elemParameters />

      </urn:Logon>

   </soapenv:Body>

</soapenv:Envelope>

1 Accepted Solution

Avatar

Correct answer by
Level 8

hello stephenjwz​,

I think there is an issue with your payload.

Can you try with your own ID/Password (administrator) and may be it will work.

You should not be passing in userid/password in the sessiontoken element, this should be a long string hashed token that is generated by running the logon operation in the sessionMethodSoap.

Here is an example logon operation payload.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

</soap:Header>

<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<urn:Logon xmlns:urn="urn:xtk:session">

    <urn:sessiontoken></urn:sessiontoken>

    <urn:strLogin>your_user_name_here</urn:strLogin>

    <urn:strPassword>your_password_here</urn:strPassword>

    <urn:elemParameters>

       

        <AnyElement/>

    </urn:elemParameters>

</urn:Logon>

</soapenv:Body>

</soapenv:Envelope>

Regards,

Venu

View solution in original post

1 Reply

Avatar

Correct answer by
Level 8

hello stephenjwz​,

I think there is an issue with your payload.

Can you try with your own ID/Password (administrator) and may be it will work.

You should not be passing in userid/password in the sessiontoken element, this should be a long string hashed token that is generated by running the logon operation in the sessionMethodSoap.

Here is an example logon operation payload.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

</soap:Header>

<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<urn:Logon xmlns:urn="urn:xtk:session">

    <urn:sessiontoken></urn:sessiontoken>

    <urn:strLogin>your_user_name_here</urn:strLogin>

    <urn:strPassword>your_password_here</urn:strPassword>

    <urn:elemParameters>

       

        <AnyElement/>

    </urn:elemParameters>

</urn:Logon>

</soapenv:Body>

</soapenv:Envelope>

Regards,

Venu