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>