0

How to remove namespace (here ws in request xml)

public class SOAPInputGenerator2 {

    public static void main(String[] args) throws Exception {

        WsdlProject project = new WsdlProject();

        String url = new String("http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx?WSDL");

        WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, url);
        WsdlInterface wsdl = wsdls[0];

        Iterator<com.eviware.soapui.model.iface.Operation> itr = wsdl.getOperationList().iterator();
        WsdlOperation op;
        while (itr.hasNext()) {
            op = (WsdlOperation) itr.next();


            System.out.println("Operation: " + op.getName());

            System.out.println("Request here: ");
            System.out.println(op.createRequest(true));


            System.out.println("Response here: ");
            System.out.println(op.createResponse(true));
        }

    }

I have above class which generates request like this:

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" **xmlns:ws="http://ws.cdyne.com/">**
   <soap:Header/>
   <soap:Body>
      **<ws:AdvancedVerifyEmail>**
         <!--Optional:-->
         **<ws:email>?</ws:email>**
         **<ws:timeout>?</ws:timeout>**
         <!--Optional:-->
         **<ws:LicenseKey>?</ws:LicenseKey>
      </ws:AdvancedVerifyEmail>**
   </soap:Body>
</soap:Envelope>

but expected result is without namespace. I have already tried solutions from [Customising JAX-WS prefix of a SOAP response and [Removing namespace prefix in the output of Spring WS web service, but not getting expected output like

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ws="http://ws.cdyne.com/">
   <soap:Header/>
   <soap:Body>
      <AdvancedVerifyEmail>
         <!--Optional:-->
         <email>?</email>
         <timeout>?</timeout>
         <!--Optional:-->
         <LicenseKey>?</LicenseKey>
      </AdvancedVerifyEmail>
   </soap:Body>
</soap:Envelope>
Community
  • 1
  • 1
Sonal
  • 262
  • 5
  • 22

1 Answers1

0

You cannot remove the namespace of the original response XML. Try to transform the response xml as per your requirement using any data transformation APIs like Smooks or dozer.