Exemplo n.º 1
0
 private void soapToRpcResult(SOAPMessage response, RpcInvokeAction action, SimpleRpcResult result)
     throws Exception {
   logMessage("Response message:", response);
   SOAPBody responseBody = response.getSOAPBody();
   checkForFailureReponse(responseBody);
   actionData =
       WsRpcActionUtil.getWsRpcActionData(((SimpleRpcInvokeAction) action).getProperties());
   getFields(action.getFields(), responseBody.getChildElements());
   result.setRpcFields(action.getFields());
 }
Exemplo n.º 2
0
  private SOAPMessage actionToSoap(RpcInvokeAction action) throws Exception {
    useFirstElementPrefix = true;

    SOAPMessage message = messageFactory.createMessage();
    actionData =
        WsRpcActionUtil.getWsRpcActionData(((SimpleRpcInvokeAction) action).getProperties());

    SOAPEnvelope env = message.getSOAPPart().getEnvelope();
    env.addNamespaceDeclaration(ACTION_PREFIX, actionData.getMethodInputNameSpace());

    setFields(action.getFields(), env.getBody());

    if (actionData.getSoapAction().length() > 0) {
      message.getMimeHeaders().addHeader("SOAPAction", actionData.getSoapAction());
    }

    // Base auth headers from http://www.whitemesa.com/soapauth.html#S322
    /*
     * all auth standarts: http://www.soapui.org/testing-dojo/best-practices/authentication.html
     */
    if (props.getPassword() != null
        && props.getUserName() != null
        && !props.getUserName().trim().equals("")) {
      SOAPHeaderElement auth =
          message
              .getSOAPHeader()
              .addHeaderElement(
                  new QName("http://soap-authentication.org/basic/2001/10/", "BasicAuth", "h"));
      auth.setMustUnderstand(true);
      auth.addChildElement("Name").setValue(props.getUserName());
      auth.addChildElement("Password").setValue(props.getPassword());
    }

    logMessage("Request message:", message);

    return message;
  }