LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Please help me with credentials in header in SoapUI (https://www.linuxquestions.org/questions/programming-9/please-help-me-with-credentials-in-header-in-soapui-4175611400/)

Belikewater 08-05-2017 06:28 PM

Please help me with credentials in header in SoapUI
 
Hello everyone,

I am new to programming, I just started working with a book on Python. I have worked a little bit with sql, but I am still learning.

I need help concerning connecting to web services using SoapUI.

I was charged with the task of running some API calls at my job, but the problem is I am just learning about this and I need to get this set up by Tuesday.

I am willing to learn, but getting things set up by Tuesday will be difficult.

I am in desperate need of assistance on something I am sure is basic.

I need to enter user name, password, account number and account secret in SoapUI.

From what I understand is that you do this by modifying the header on a request call. I have used the wsdl file to populate the data, but I have not figured out how to enter the credentials in the header in the right language so to speak.

So my request is can someone help me how to do this in the header given the basic and only instructions from the web service guide which is below:
"The following section provides instruction for connecting to the service.
To use the Automotive Description Service, you must supply a valid user ID and password, the URL for the WSDL defining the service, and the service namespace or package name. Chrome Data’s order fulfillment department sends an email with a User ID and password to the contact person at your organization. Use the ID and password to initialize the number and secret attributes described in the Account Info section."

This is the wsdl: http://services.chromedata.com/Description/7b?wsdl

I have all the information, but not knowing how to enter it in language suitable to recognize the credentials in the Header I am lost.


Thanks

Belikewater 08-06-2017 02:26 PM

I think I may have figured it out. Ill have to test some calls. But it appears that you can enter the username and password in the request properties or the Auth tab.

Within the call itself it appears you can enter the account number and account secret.

I will mark it the thread as solved once I can confirm everything is in order

astrogeek 08-06-2017 02:43 PM

Quote:

Originally Posted by Belikewater (Post 5744910)
I was charged with the task of running some API calls at my job, but the problem is I am just learning about this and I need to get this set up by Tuesday.

If your paid job has responsibilites for which you are not qualified, perhaps you should discuss that with your employer. Please understand that everyone here volunteers their time, so the urgency is all on your end.

That said, what you will need to know to complete the task is basic XML and knowledge of how WSDL and SOAP work.

First, you may think of XML as the basic syntax of the language - how things are expressed. Any XML document will consist of elements, attributes and data, something like this...

Code:

<element_name attribute="attribute value">
  <nested_element>content data</nested_element>
</element_name>

XML provides the means of structuring arbitrary data in a way that can be parsed and validated according to some schema. The actual structure, or allowed elements and attributes are defined by the schema document, itself written in XML. In other words, the schema defines a valid document for that web service.

You should first gain a basic knowledge of XML by doing an online search for tutorials - there are many, here is one.

Next, WSDL, or Web Service Description Language is a specification of an XML document, or language used to describe web services. SO, to communicate with this web service you will need to understand the format of WSDL documents. Again, you may find many tutorials online, here is one.

The schema which you linked defines the documents recognized by that particular web service.

Right at the top it describes a set of elements and attributes contained within an AccountInfo element, which is probably what you are looking for. The basic structure described there looks something like this...

Code:

<AccountInfo number="..." secret=".." country="..." language="..." behalfOf="..." />
Finally, Soap defines an XML language which serves as a kind of envelope for passing data between systems across the internet. Find many tutorials online, here is one.

To interact with their web service you will need to create a complete WSDL document according to that schema and the desired activity, put it into a SOAP wrapper and submit it to their URL. It will then return the result, also in an XML document which you must then parse to extract the desired data.

All of this may be done in various scripting languages such as Python, PHP, Perl or others. The language used will determine the details of how the XML document (usually a simple string) is formed and how the HTTP request is performed (socket, curl, fileget, etc.).

I hope this helps get you started, good luck!

*** EDIT, or you could just use the auth tab of your application... (we were typing at the same time)

Belikewater 08-07-2017 01:27 PM

Quote:

If your paid job has responsibilites for which you are not qualified, perhaps you should discuss that with your employer. Please understand that everyone here volunteers their time, so the urgency is all on your end.
Hello Astrogeek,

Sorry if my message implied some type of demand from people on the forum to help me. It was just a request to get started. I am a fast learner, and I have taken on projects which at first I had no clue how to navigate, but eventually figured it out.

Thanks for helping me out on this and taking the time to explain the concepts. I have been reading through the links you provided. I have also watched a few video tutorials.

I am returning data and the next steps is to parse the data, then I will return to the API to see if I can do what we are wanting to get out of it.

If so, it will be good as I will be working more with SoapUI and the web service along with some Python that I have just started learning.

I am marking this thread as solved :D

astrogeek 08-08-2017 04:47 AM

You are welcome!

At one time or another, we all know what it is like to be under the pressure of a short deadline, not knowing what to do next! I did not intend to criticize, some need focus more than others so I just tweaked the knob a little. ;)

I hope the XML references were helpful. It really is pretty simple, but finding all the pieces the first time can be confusing.

Thanks for returning to mark the thread solved, hope you made your deadline!


All times are GMT -5. The time now is 07:32 AM.