Forum Discussion

jlang's avatar
jlang
New Contributor
13 years ago

Authorization Problem at Test Step Level with Maven Plugin

Hello all,

I have a Test Suite that pulls most of its authentication information from the Global Properties through the use of Service Endpoints. For example, there is a global property for the user and password and the Service Endpoints of each WSDL reference these. However, inside the Test Suite there are some instances at particular Test Steps where a different user/password combination is required than that in the global property settings. To run this an overriding Authorization was set at the Test Step level. When running on a local system this works as expected and the overriding user/password values, set on the Auth Tab of the Test Step, are used. However, when trying to run it through the Maven Plugin (3.6.1) it ignores these overridden values and continues to use the global property values. Does anyone have any ideas on what the issue may be?

Here is an snippet from the raw XML of the Authorization Override at the Test Case Level. As you can see the authentication credentials (USER1) are included for this Test Step.
<con:testStep type="request" name="********** Start at BEND as USER1 **********">
<con:settings/>
<con:config xsi:type="con:RequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<con:interface>SfcStartServiceWSBinding</con:interface>
<con:operation>start</con:operation>
<con:request name="********** Start at BEND as USER1 **********" outgoingWss="" incomingWss="" timeout="" wssPasswordType="">
<con:settings>
<con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers">&lt;xml-fragment/></con:setting>
</con:settings>
<con:encoding>UTF-8</con:encoding>
<con:endpoint>http://${meHostPort}/manufacturing-papiservices/SfcStartServiceWSService</con:endpoint>
<con:request><![CDATA[<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mep="mepapi:com:sap:me:production" xmlns:prod="http://www.sap.com/me/production">
<soapenv:Header/>
<soapenv:Body>
<mep:start>
<mep:Site>${meSite}</mep:Site>
<mep:Request>
<prod:sfcRef>${sfc}</prod:sfcRef>
<prod:operationRef>OperationBO:${meSite},${#TestSuite#objectPrefix}BEND,#</prod:operationRef>
<prod:resourceRef>ResourceBO:${meSite},DEFAULT</prod:resourceRef>
<prod:qty>1</prod:qty>
</mep:Request>
</mep:start>
</soapenv:Body>
</soapenv:Envelope>]]></con:request>
<con:assertion type="SOAP Response" name="SOAP Response"/>
<con:assertion type="SOAP Fault Assertion" name="Not SOAP Fault"/>
<con:credentials>
<con:username>${#TestSuite#objectPrefix}USER1</con:username>
<con:password>icc8336</con:password>
<con:authType>Preemptive</con:authType>
</con:credentials>
<con:jmsConfig JMSDeliveryMode="PERSISTENT"/>
<con:jmsPropertyConfig/>
<con:wsaConfig mustUnderstand="NONE" version="200508" action="mepapi:com:sap:me:production/SfcStartServiceWS/startRequest"/>
<con:wsrmConfig version="1.2"/>
</con:request>
</con:config>
</con:testStep>


Here is the output from the Maven Plugin.

If you base64 decode the string (Authorization : Basic c2l0ZV9hZG1pbjppY2M4MzM2) you get site_admin:icc8336 which is the global property setting not the locally overridden setting of USER1:icc8336 that can be seen in the above snippet.

Status: OK
Time Taken: 130
Size: 625
Timestamp: Thu Feb 28 00:33:35 CET 2013
TestStep: ********** Start at BEND as USER1 **********

----------------- Messages ------------------------------

----------------- Properties ------------------------------
Encoding: UTF-8
Password: icc8336
Username: site_admin
Endpoint: xxxxxxxxxxxxx Removed from log xxxxxxxxxxxxxxxxxxxxxxx

---------------- Request ---------------------------
Request Headers: Authorization : Basic c2l0ZV9hZG1pbjppY2M4MzM2
Host : dewdfgwd00211.wdf.sap.corp:50000
Content-Length : 624
SOAPAction : ""
Accept-Encoding : gzip,deflate
User-Agent : Jakarta Commons-HttpClient/3.1
Content-Type : text/xml;charset=UTF-8


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mep="mepapi:com:sap:me:production" xmlns:prod="http://www.sap.com/me/production">
<soapenv:Header/>
<soapenv:Body>
<mep:start>
<mep:Site>TESTD1</mep:Site>
<mep:Request>
<prod:sfcRef>SFCBO:TESTD1,TESTD12840</prod:sfcRef>
<prod:operationRef>OperationBO:TESTD1,RTR-SCN-139-BEND,#</prod:operationRef>
<prod:resourceRef>ResourceBO:TESTD1,DEFAULT</prod:resourceRef>
<prod:qty>1</prod:qty>
</mep:Request>
</mep:start>
</soapenv:Body>
</soapenv:Envelope>

---------------- Response --------------------------
Response Headers: content-type : text/xml; charset=utf-8
set-cookie : JSESSIONMARKID=b8CVsghnjRZLeIzB9AAIt7LVX44oG8agGS8R44RQA; Version=1; Path=/
transfer-encoding : chunked
#status# : HTTP/1.1 200 OK
server : SAP NetWeaver Application Server 7.20 / AS Java 7.30
content-encoding : gzip
date : Wed, 27 Feb 2013 23:33:35 GMT


<SOAP-ENV:Envelope xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns3:startResponse xmlns:ns2="http://www.sap.com/me/production" xmlns:ns3="mepapi:com:sap:me:production">
<ns3:Response>
<ns2:sfcRef>SFCBO:TESTD1,TESTD12840</ns2:sfcRef>
<ns2:itemRef>ItemBO:TESTD1,RTR-SCN-139-ITEM1,A</ns2:itemRef>
<ns2:routerRef>RouterBO:TESTD1,RTR-SCN-139-ROUTER1,U,A</ns2:routerRef>
<ns2:stepId>050</ns2:stepId>
</ns3:Response>
</ns3:startResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

4 Replies

  • I can confirm this occurs with soapui 4.5.1 maven plugin as well.

    This is a bug.
  • Hi!

    We've tried to reproduce (using a REST project, as we didn't have a Basic Auth protected WS to try with) this, but failed. Maybe we didn't fully understand your setup so I've attached our test project (using a basic auth example site) and the maven pom.xml file we're using.
    Please try to run this and let us know if we missed something.


    --
    Regards

    Erik
    SmartBear Sweden
  • We've partially solved the issue. We were specifying username and password in the maven configuration which we now realize was an override to all username/passwords for all requests. We've removed the username and password parameters from the maven configuration.

    This opened up a bunch of new issues.

    Nearly all of our request test steps do not specify a username or password. We assumed that the username and password specified at the endpoint would be used in this case - and this seems to be the behavior in the GUI. However, when running the tests via maven, no username or password is being sent with the request unless we explicitly set them at the request level.

    I tried adding our soapui-settings.xml (which specifies preemptive authentication) to the maven configuration, but this makes no difference.

    So the question is: is this the correct behavior? I don't want to have to repeat the service endpoint username and password for each request in the test. When running via maven, I want the service endpoint username and password to be preemptively sent with the request.
  • bump...

    Any chance I can get an answer on my question above?