Forum Discussion

dsindhumathi's avatar
New Contributor
3 years ago

SOAP XML Request with Basic Authentication in java

I am using SoapUI java client to automate soap based web services and trying generate XML at run time. Here is my xml which I have generated at run time



and calling this xml through wsdl 

WsdlProject wsdlProject = new WsdlProject("C:\\SC\\Indhu\\XmlPOC\\sms_qa_selenium\\my-file.xml");
        WsdlProject wsdlProject = new WsdlProject(serviceXmlPath);
        WsdlTestSuite wsdlTestSuite1 = wsdlProject.getTestSuiteByName("CSRLogin");
        WsdlTestCase wsdlTestCase1 = wsdlTestSuite1.getTestCaseByName("CSRLogin");
        WsdlTestStep wsdlTestStep = wsdlTestCase1.getTestStepByName("CreateCustomer");
        WsdlTestCaseRunner wsdlTestCaseRunner = new WsdlTestCaseRunner(wsdlTestCase1,
                new StringToObjectMap(wsdlTestCase1.getProperties()));
        wsdlProject.setPropertyValue("username", "esbuser");
        wsdlProject.setPropertyValue("password", "password");
        wsdlProject.setPropertyValue("wssPasswordType", "PasswordText");
        TestStepResult testStepResult = wsdlTestCaseRunner.runTestStep(wsdlTestStep);

5 Replies

    • dsindhumathi's avatar
      New Contributor

      I dont know how to set  and where to set request properties in xml. 

      • ChrisAdams's avatar
        Champion Level 3



        Authentication should be in the headers of your payload.

        ReadyAPI/SoapUI make this as easy as it's in the UI for a request....



        This can also be applied from the Project level and propagated down to all requests below if you have a licensed copy.  If you do have the licensed version, look at environments.