Contributions
Re: Add custom soap Header using Java API
I was able to solve this problem using this rather low-tech functie: public static void replacePartRawRequestAsString(WsdlTestStep step, String oldStringValue, String newStringValue){ WsaConfig wsaConfig = ((WsdlTestRequestStep) step).getHttpRequest().getWsaConfig(); ((WsdlTestRequestStep)step).getHttpRequest().setWsaEnabled(false); String request= (step.getPropertyValue("Request")); String requestHeaders="<soapenv:Header xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">" +"<wsa:Action>"+wsaConfig.getAction()+"</wsa:Action>" +"<wsa:From><wsa:Address>"+wsaConfig.getFrom()+"</wsa:Address></wsa:From>" +"<wsa:MessageID>uuid:5c644a44-419e-4ff1-b716-e8e5bd37caec</wsa:MessageID>" +"<wsa:To>"+wsaConfig.getTo()+"</wsa:To>" +"</soapenv:Header>"; request=request.replace("<soapenv:Header/>", requestHeaders); request=request.replace(oldStringValue, newStringValue); ((WsdlTestRequestStep)step).getHttpRequest().setRequestContent(request); } Which I can call like this: replacePartRawRequestAsString(newStep, "</soapenv:Header>", "<illegalHeader>test</illegalHeader></soapenv:Header>");5 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.1KViews1like1CommentRe: Add custom soap Header using Java API
Actually comming to think about it, I would like to have the option to directly set how the RAWrequest would come to look like. Setting it like this won't work since it's read-only testStepName.setPropertyValue("RawRequest", "testtesttest")5 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.1KViews0likes2CommentsAdd custom soap Header using Java API
Dear all, I want to test if our soap webservice properly declines requests with a custom header in the envelope 'soapenv:Header'. I'm experiencing trouble in generating a testrequest with such a header through the JAVA packages. I hoped to get away with something like below; String request = testStepName.getPropertyValue("Request"); request.replace( "</soapenv:Header>", "<customHeader>test</customHeader></soapenv:Header>"); testStepName.setPropertyValue("Request", request); But at compile time the RawRequest with soapenv:Header is not availble yet. Untill now, I only made changes to the soapenv on wsa:Headers for which there are special methods, or through changes in a WSDL. However, for adding other custom headers I can't find any methods in the packages. So my questions is; Which methods can I user to create custom soapenv:Headers in a teststep using Java ? Thanks in Advance! CasparSolved5 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.2KViews0likes3CommentsRe: Script assertion passes individually but fails in running testSuite
Thanks for your suggestion! I've tried a delay but the problem persists. Troubleshooting I realized it had nothing to do with the script assertion but with the request. Without an assertion the step is also never completed, and stays 'grey. The teststep fires a request without a keystore on a secure port to check that whenether the response is null. This runs a single request, but does not in a testcase. Apparantly this is because this attempt throws an exception; (@error log) Mon May 27 10:35:19 CEST 2019: ERROR: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure And this causes ReadyAPI to stop the testplan. When ran as a single request, the exception is also thrown, but doesn't halt execution, and the scipt assertion is tested normally.5 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.8KViews0likes3CommentsRe: Script assertion passes individually but fails in running testSuite
Thanks for your suggestion! I put a delay in the testcase before the step, and tried a delay in the script assertion but the problems persists. Troubleshooting I now noticed that this error is also thrown when there is no assertion. So the actual problem is that this step is never completed when ran in a testcase, but runs properly when fired as an individual request. The test is to see whenether a request without a certificate gets a null response on an secure port. This apparantly throws anjavax.net.ssl.SSLHandshakeException. My http log shows: [write] I/O error: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure The error log shows: Mon May 27 10:01:56 CEST 2019: ERROR: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure Which is not unexpected given the testsituation, but how to make soapui run past this Exception?5 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.7KViews0likes0CommentsScript assertion passes individually but fails in running testSuite
Hi all, I have a script assertion to assert whenether a response is null: assert messageExchange.hasResponse() == false When I run the assertion or request individually, it passes. However when I run the entire testsuite, the suite fails (while response is still empty). The step doesn't turn red but stays grey. How can I resolve this? I'm at ReadyAPI version 2.6.0.5 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.8KViews0likes6CommentsAdding a keystore/groovy script to single request through Java
Hi all, I have a testsituation in which I want to have requests with and without the use of a keystore in a single testcase. I'm generating soapuiprojects through the Java package com.eviware.soapui. I found a way to add a certificate in java using this code; SoapUI.getSettings().setString(SSLSettings.KEYSTORE, "pathToKeystore"); SoapUI.getSettings().setString(SSLSettings.KEYSTORE_PASSWORD, "xxxxxxx"); SoapUI.getSettings().setBoolean(SSLSettings.CLIENT_AUTHENTICATION, true); SoapUI.saveSettings(); However, this adds the credentials to the whole project (logically), and therefore isn't usefull to me. In the ReadyAPI user interface I can add credentials to a single request(with a request property), and a way to do this using the library would help me most! An other option would be adding a groovy script to a testcase, and perform all the teststeps with a certificate after running this script. I did this in the user interface with this groovy script; import com.eviware.soapui.settings.SSLSettings import com.eviware.soapui.SoapUI SoapUI.settings.setString( SSLSettings.KEYSTORE, "pathToKeyStore" ) SoapUI.settings.setString( SSLSettings.KEYSTORE_PASSWORD, "xxxxxxx" ) However, I do not know how to add this groovy script to a testcase using the package in Java Code. So any help with this would be appriaciated as well! Thanks in advance!Solved5 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.7KViews0likes3CommentsOptional attributes in generating a soapUI project from WDSL
Hi all, I'm new to SoapUI/readyAPI. I'm working on Java code that generates a soapUI project from a wdsl. At the moment my tests fail cause the request contains optional attributes specified in the wdsl, and I need to manually delete them in the GUI. Currently the fields are automatically filled with a question mark, while a char isn't accepted for these attributes. I want to generate a project automatically while ignoring these optional fields. How can I do this? Any hints will be appreciated! Thanks in advance!5 years agoPlace ReadyAPI QuestionsReadyAPI Questions909Views0likes2Comments