0
如何删除命名空间(在这里请求XML WS)删除命名空间前缀
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));
}
}
我有上面的类生成这样的请求:
<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>
但预期结果为:没有命名空间。我已经尝试从[Customising JAX-WS prefix of a SOAP response和[Removing namespace prefix in the output of Spring WS web service解决方案,但没有得到像
<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>