Can we use access token with soap request?

azam110
Kilo Contributor

I am able to get the access token from service now using oauth 3legged flow. How can i use it with my SOAP request to service now?

5 REPLIES 5

henry_cheng
ServiceNow Employee
ServiceNow Employee

Hi Azam,



ServiceNow supports inbound SOAP request and is working as OAuth Provider.


When you get the access token from ServiceNow you should use it in your SOAP tool as a parameter in the SOAP request header.


This is depending on how the 3rd-party SOAP client tool is designed.


You can refer to below wiki page for the sample regarding how to use the tokens in the SOAP request.


Generating OAuth Tokens - ServiceNow Wiki http://wiki.servicenow.com/index.php?title=OAuth_Applications#gsc.tab=0


http://wiki.servicenow.com/index.php?title=OAuth_Setup#gsc.tab=0



Cheers


Henry


Hi   Henry,


Thanks for your reply


But i didnt get it   how can i use the access token in SOAP   request Header?   Can you please make it more clear wthis .ith an example?


I would be very curios to know   this.



Thanks


Azam


henry_cheng
ServiceNow Employee
ServiceNow Employee

Hi Azam,



It depends which SOAP client tool you are using.


Here is a sample using Postman to get the access token and using it to access the resource. Please have a check.


Inbound OAuth Auth Code Grant Flow Part 1 - Getting Started with Postman



Cheers


Henry


Thanks for your answer Henry.


That worked fine on Postman. But i wants to send my access token with SOAP request to service now.


It would be helpful for me if you can send some more to use access token with SOAP call.


How can use it in the request below



<soapenv:Envelope xmlns:bpel="http://xmlns.oracle.com/Error/Project1/BPELProcess2" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">


    <soapenv:Header>



          </wsse:Security>


    </soapenv:Header>


    <soapenv:Body>


          <bpel:process>


                <!--1 or more repetitions:-->


                <bpel:Object1>


                      <bpel:OrganizationName>testproblem</bpel:OrganizationName>


                      <bpel:City>?</bpel:City>


                      <bpel:Country>?</bpel:Country>


                      <bpel:PostelCode>?</bpel:PostelCode>


                      <bpel:State>?</bpel:State>


                      <bpel:element1>?</bpel:element1>


                      <bpel:element2>?</bpel:element2>


                      <bpel:element3>?</bpel:element3>


                      <bpel:element4>?</bpel:element4>


                      <bpel:element5>?</bpel:element5>


                      <bpel:element6>?</bpel:element6>


                      <bpel:element7>?</bpel:element7>


                </bpel:Object1>


          </bpel:process>


    </soapenv:Body>


</soapenv:Envelope>



Thanks


Azam