????????????????????????????“??????”?????????ó?????????ó????????????Extract Class???????????????????????SOAPEndPoint????

public class SOAPEndPoint {
  public String post(String soapAction?? String requestBody) {
    PostMethod postMethod = getPostMethod(soapAction?? requestBody);
    new HttpClient().executeMethod(postMethod);
    String responseBody = postMethod.getResponseBodyAsString();
    if (responseBodyAsString.contains("faultstring")) {
      throw new WmbException();
    }
    return responseBody;
  }

?????????????????????μ???

??// 1. prepare request body
    String requestBody = renderTemplate(velocityContext?? templateName);
 
    // 2. execute a post method and get back response body
    // soapEndPoint is dependency injected by Spring Framework
    String responseBody = soapEndPoint.post(soapAction?? requestBody);
 
    // 3. deal with response body
    Document document = parseResponse(responseBody);
    return document;

????????????????????????????Moco??SOAPEndPoint??????????????????SOAPEndPoint?????????????????????????POST???????URL???????????????“faultstring”?????????????????????????????????????????“SOAPEndPoint”??post???????????????????????????????????SOAPЭ?飬????????????????????????????Moco???????SOAPЭ????????????????????????????“faultstring”?????????????????ɡ?

??????????????????post???????????????????????????????SOAPЭ?飬?????????SOAPEndPoint??????????????и??????????getPostMethod?????У?????????????ЩHTTP????????Щ?????????Web Services?????????????????ЩHTTP????????????ó????????????Content-Type????????????з?????????????????????getPostMethod?????С?

???????????????д?Щ??????????????????mock?????????“???SOAPEndPoint????”?????????????????????????????????????е????????????????????????????????????????????????????????????????????????????????????????????????????????????

????С??

????????????“?????”??JavaEE Web????????У???????????ж????????????????ù????????????????????????????????????????????????????????????????????????????????????????????Moco???????????????????????????????????????????????????????????

?????????????????????е??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????е??????????????????????????????