Ask a Question

Testing via a ESB, adding name space?

DW
Occasional Contributor

Testing via a ESB, adding name space?

I'm trying to do a proof of concept around using SoapUI within our orgnisation. We have a REST service that simply returns a reference number so should be very easy to test.

 

This works in Fiddler, request body below, but how do I get this to work in SoapUI? I've added the blue parts of the body as parameters but I get 'Object reference not set to an instance of an object.' which according to the developer (who's too busy to help at the moment) is because all our services are behind a service bus. Would adding the namespace help - and if so how do I do that?

 

Thanks

D

 

<?xml version="1.0" encoding="utf-8"?><GetWorkReferenceIdRequest xmlns="http://xxxxxxx">
  <MessageHeader xmlns="http://xxxxxxxx">
    <MessageId>1234</MessageId>
    <InitiatorId>122343</InitiatorId>
    <ServerName>12123</ServerName>
    <BusinessProcessName>123</BusinessProcessName>
    <BusinessProcessId>123</BusinessProcessId>
    <DateTimeStamp>0001-01-01T00:00:00</DateTimeStamp>
    <ProcessHeader>
      <MessageStatus>Success</MessageStatus>
      <Details>
      </Details>
    </ProcessHeader>
  </MessageHeader>
</GetWorkReferenceIdRequest>

 

 

7 REPLIES 7
rupert_anderson
Valued Contributor

Re: Testing via a ESB, adding name space?

Hi,

 

It sounds like the issue you are facing is likely to be related to the particulars of your service's ESB setup, as the error message doesn't seem like a security issue e.g. authentication or SSL certificate related.

 

I don't see any reason why SoapUI cannot be used to test this service assuming that you are able to fire a valid request, do you have any way to capture or obtain a valid request the the service from anywahere else e.g. debug from a working client system or possibly a sample request from that busy developer? 

 

That way you should be able to fire the valid request from SoapUI and hopefully get a succesful response and then maybe understand what is missing from your original request. Aside from providing any namespaces (which you seem to have examples of in your sample), those message header elements could also be wrong / missing e.g. maybe your ESB has issufficient / wrong data and is unable to route your request to the intended service.

 

Hope this helps,

 

Cheers,

Rupert

Author of SoapUI Cookbook
DW
Occasional Contributor

Re: Testing via a ESB, adding name space?

Thanks for the thoughts Rupert, I have a meeting next week with one of the devs to try and go through some of this.

 

How do I get the namespaces in to the SoapUI request? I've tried searching but can't find it anywhere.

D

rupert_anderson
Valued Contributor

Re: Testing via a ESB, adding name space?

Hi,

 

No problem.

 

Well, again this is not really a SoapUI thing, as SoapUI will dispatch any request XML content you want.

 

In terms of namespaces, I can see that some of your elements already have namespaces defined e.g.

 

<MessageHeader xmlns="http://xxxxxxxx">

 

If you mean how to you define a namespace prefix, then you can do things like:

 

<h:table xmlns:h="http://www.w3.org/TR/html4/">
  <h:tr>
    <h:td>Apples</h:td>
    <h:td>Bananas</h:td>
  </h:tr>
</h:table>

 

(Example taken from http://www.w3schools.com/xml/xml_namespaces.asp)

 

So basically, you are already using namespaces and namespaces of any standard type can be used in the REST request body as you seem to have done already. Does that make sense and is what you were asking?

 

Cheers,

Rupert

Author of SoapUI Cookbook
DW
Occasional Contributor

Re: Testing via a ESB, adding name space?

Thanks once again Rupert.

 

The code above is not from SoapUI, it's what we enter in Fiddler to test the service, therefore I've not entered the xmlns in SoapUI.

 

Think I'll spend some time going through your cookbook to get a better understanding of the tool.

 

 

rupert_anderson
Valued Contributor

Re: Testing via a ESB, adding name space?

No problem, hope I can help. Like I say, I think in this case it sounds like you may need a bit more support understanding any particulars of the ESB like a full sample request that is known to work. Then there should be no reason why SoapUI can't repeat the sample request.

 

Thanks, thats nice of you to mention the book, I am trying not to mention it too much as I figured it might be seen as self promotional/annoying! I think Chapter 4 has been provided as a sample chapter, at least partically and contains a REST example using HATEOAS links (and namespaces) e.g.

 

<quote xmlns:atom="http://www.w3.org/2005/Atom">
<id>777</id>
<amount>100</amount>
<atom:link rel="self" href="http://localhost:8080/quote/777"/>
<atom:link rel="customer" href="http://localhost:8080/ customer/12345"/>
</quote>

 

So, it might help. Although I would say that the cook book hopefully/probably builds on, rather than replaces, the excellent SoapUI wiki and would recomend that as the first place to start - plus this great forum of course! 🙂

 

If you need any more help on this stuff please let me know,

 

Cheers,

Rupert

Author of SoapUI Cookbook
DW
Occasional Contributor

Re: Testing via a ESB, adding name space?

Have finially managed to get it working Robot Happy 

 

I put everything in the request part (bottom left of request screen) and it worked.

 

Just need to sort out how to paramatise it and also get it to loop once and use the reference number value from the first loop as the basis for the assertion on the next loop (ref id = ref id + 1)

 

And once done that try against some more complex services. Happy days

 

Cheers

rupert_anderson
Valued Contributor

Re: Testing via a ESB, adding name space?

Ok, cool.

 

I take it the original XML request worked when you posted it as the request body.

 

If you need any help with parameterisation, then let me know.

 

Cheers,

Rupert

Author of SoapUI Cookbook
cancel
Showing results for 
Search instead for 
Did you mean: