9
Constructing a SOAP call in JQuery (or any language) using SoapUI and Postman Version 1.0 8/2/2020 Environment: Server: IIS Service: The default service and method (GetData) Visual Studio creates when you create a new WCF service project. Or you can use your own service. Overview: Constructing a working SOAP query with the correct headers and data, then writing the code, is not straightforward at all. However, by using SoapUI and Postman, the process is much simpler 1. Create and publish service to your IIS installation. This can be bypassed if you already have a WCF service running. 2. Connect to service using Soap UI to obtain header data and XML request. The header information will be used to configure the message headers in Postman. The XML request will be sent in the body of the message. 3. Connect to service using Postman and do code generation. 1. Publish the default created WCF web page then in IIS choose Convert To App. Then browse to it. You should see this:

Constructing a SOAP call in JQUERY using Soap UI and Postman€¦ · Title: Microsoft Word - Constructing a SOAP call in JQUERY using Soap UI and Postman Author: alanm.hess Created

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

  • Constructing a SOAP call in JQuery (or any language) using SoapUI and Postman Version 1.0 8/2/2020 Environment: Server: IIS Service: The default service and method (GetData) Visual Studio creates when you create a new WCF service project. Or you can use your own service.

    Overview: Constructing a working SOAP query with the correct headers and data, then writing the code, is not straightforward at all. However, by using SoapUI and Postman, the process is much simpler

    1. Create and publish service to your IIS installation. This can be bypassed if you already have a WCF service running.

    2. Connect to service using Soap UI to obtain header data and XML request. The header information will be used to configure the message headers in Postman. The XML request will be sent in the body of the message.

    3. Connect to service using Postman and do code generation.

    1. Publish the default created WCF web page then in IIS choose Convert To App. Then browse to it.

    You should see this:

  • 2. Now open SOAP UI. 3. Create New SOAP Project:

  • 4. Use the WSDL from the services webpage to fill in the SOAP project dialog:

    5.

  • 6. 7. Right click GetData > New Request:

    8. 9. Name Request:

    10. 11. Enter a Value in the XML, replacing the “?”:

  • 12. 13. Click the Play button 14. Click Raw on the Request (on the left)

    15. 16. This raw request text and the XML text from SOAP UI will be used in postman (see bold below):

    POST http://localhost/wcf/Service.svc HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "http://tempuri.org/IService/GetData" Content-Length: 296 Host: localhost Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

    17. Open Postman. This is a code generation tool and web service testing tool. We will use it to obtain the JQuery code needed to communicate with the web service

    18. Create new Postman Request:

  • 19. 20. Name Request and create collection. Click Save:

    21.

  • 22. Click Headers. We need to add several headers

    23. 24. Add two header entries, Content-Type and SoapAction, identified earlier in the SOAP UI Raw

    request:

    25. 26. Go back to SOAP UI and copy the XML Request to put in the body of the message:

  • 10

    27. In Postman, Click Body > Raw and paste in the XML request. Also, change Type to POST and enter the URL of the service :

    28. 29. Click Send and view the response:

    30.

  • 31. This is the raw text of the same response:

    32. 33. Now you can get the JQuery code:

    34. 35. Select JavaScript - JQuery

    36. 37. You can then parse the response in your javascript code.