Forum Discussion

dataki's avatar
dataki
Occasional Contributor
4 years ago

Issue with Authentication, or...?

I'm new to soapui. I have been provided with a json endpoint, a user name and password which I would like to access some data. In SoapUI, I enter the uri, and the param values. I have created a Basic authentication entry. I'm not able to access any data. I can't share the uri etc but the values I have are like this in the SoapUI interface prior to my test:

URI: https://test.anyname.com
Resource: theservice.svc
Parameters: ?ItemID=123456

On the JSON tab I see this

The content you are trying to view cannot be viewed as JSON

The HTML tab shows

Metadata publishing for this service is currently disabled

What am I missing?

 

5 Replies

  • richie's avatar
    richie
    Community Hero
    Hey dataki,

    You can actually provide the full URI parms and payload in regards to security concerns. What you shouldnt do is provide the full URL (hostname plus URI). As long as you don't provide the hostname along with username and password thats fine from a security concern as no one would be able to hit your resource without those details. If youre concerned about revealing payload details you can supply dummy data (even though its kinda moot without hostname and username/password details)

    Anyway. Right. We're gonna need a bit more info to help diagnose.

    Is this SOAP or REST? if SOAP youre likely to have a wsdl file that defines the webservice. (SOAP messages are containers that include the relevant payload within the SOAP emvelope).

    Youve been given the full URI. You need to confirm the following to nail this down.

    What HTTP method...GET? PUT? PATCH? POST? DELETE?
    What are the parameters on the request. URI/Template/Resource? Matrix? Query? Headers?
    Does your request include a payload?
    If "yes" is it validated in your webservice?
    If "yes" youll need to create a schema valid payload.

    If your request has a payload, what is the associated mediatype....text/xml? application/xml? application/json?

    You mentioned a username and password. Are you definitely using Basic Auth rather than one of various other authentication/authorisation mechanism?

    Does your endpoint support http or https? Youll likely get an SSL.Exception generated if this is incorrect.

    Do you need to proxy your requests?

    You need to confirm at your end all the above detail as incorrectly setting any of the above could result in bad response/no response from endpoint. There's other things as well, but the above gives you the basic considerations to submit a request successfully.

    You didnt mention what you saw in the logging. This can help a lot diagnose whats going wrong. So keep on eye on the soapui log, the http log and the error log. Did you get an http response status code returned from your endpoint?

    Also the RAW tabs on the request pane and response pane can be very helpful as this reveals exactly what was submitted and received....this includes the full URL(including URI, Matrix/Query parameters, all the Header parms) and the payload (if there is one)

    If you come back answering the above points we should be able to sort you out.

    Ta

    Rich


    • dataki's avatar
      dataki
      Occasional Contributor

      I am appreciative that you responded so quickly. I would really like to get this resolved before the long weekend.

      It's supposed to be REST/JSON. They did send a wsdl, and that made me confirm to the provider that it's json, and they say it is. There is a payload, if by that you mean data should be returned.

       

      I originally used GET. Since you wrote I've also tried POST, PUT, HEAD, PATCH, without seeing any different outcome.


      The parameters...as I posted there is ?ItemID=123456. That is one of the two parameters that can be used, according to the provider. But you wrote "URI/Template/Resource? Matrix? Query? Headers?" and I'm not sure what you mean. The parameters we're going to use are the simple ItemID (an integer) or a date range, which I've not tried yet. In the SoapUI parameter dialog I don't see a place to change a parameter setting to a value like URI vs Matrix?

       

      I'm not sure what you mean by if the payload is validated by the webservice?

       

      Likewise, the associated media type, not sure. I expect it to return data in plain text, which will be transformed into rows in sql server. ItemName = "Widget" etc.

       

      Proxy, not sure. If it needed that I'd have thought they would have mentioned it.

       

      The soapui log looks clean, just info on the request, it's been received, can be kept alive indefinitely, got response, then closed.

       

      There is nothing in the error log.

       

      The http log has what I think is a Windows Communication Foundation boilerplate response, starting with "metadata publishing for this service is currently disabled". It's the same as what I see if I enter the url to the service only in a browser: https://test.anyname.com/theservice.svc

       

      If I enter the full uri including the parameter into a browser (firefox) I get the following. I wouldn't expect the data, at least because it's not authenticated, but did what to see what it offered.

       

      The server encountered an error processing the request. The exception message is 'Object reference not set to an instance of an object.'. See server logs for more details. The exception stack trace is:

      at app.Integration.Services.host.Log.ItemID(integer personId) in D:\path\path\app.log\item.cs:line 45 at InvokeItemInfo(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

      • dataki's avatar
        dataki
        Occasional Contributor

        This is solved. What I had configured as a parameter needed to be set up as a Resource.