Examples of RPCParam


Examples of org.apache.axis.message.RPCParam

                QName returnParamQName = operation.getReturnQName();
                if (args != null && args.size() > 0) {

                    if (returnParamQName == null) {
                        RPCParam param = (RPCParam) args.get(0);
                        result = param.getObjectValue();
                    } else {
                        for (int i = 0; i < args.size(); i++) {
                            RPCParam param = (RPCParam) args.get(i);
                            if (returnParamQName.equals(param.getQName())) {
                                result = param.getObjectValue();
                                break;
                            }
                        }
                    }
View Full Code Here

Examples of org.apache.axis.message.RPCParam

public class TestSerialization {

    public static void main(String[] args) throws Exception {
        MessageContext msgContext = new MessageContext(new AxisServer());
        SOAPEnvelope msg = new SOAPEnvelope();
        RPCParam arg1 = new RPCParam("urn:myNamespace", "testParam", "this is a string");
        //QName dataQName = new QName("typeNS", "Data");

        Document doc = msg.getAsDocument();

        UsernameToken userToken = new UsernameToken(WSSConfig.getDefaultWSConfig(),doc);
        userToken.setName("bob");
        userToken.setPassword("bobspass");

        RequestSecurityTokenResponse tokenResponse = new RequestSecurityTokenResponse(doc, new SecurityTokenOrReference(userToken));
        tokenResponse.setContext(new URI("http://context.context"));
        tokenResponse.setTokenType(TokenTypes.USERNAME);
   
        /*
        Data data = new Data();
        Data data2 = new Data();
        data.stringMember = "String member";
        data.floatMember = new Float("1.23");
        data.dataMember = data2;
       
        data2.stringMember = "another str member";
        data2.floatMember = new Float("4.56");
        data2.dataMember = null;  // "data;" for loop-test of multi-refs
*/
        RPCParam arg2 = new RPCParam("", "struct", tokenResponse);
        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[]{arg1, arg2});
        msg.addBodyElement(body);

        try {
            Reader reader = null;

            if (args.length == 0) {
                Writer stringWriter = new StringWriter();
                SerializationContext context = new SerializationContext(stringWriter, msgContext);

                TypeMappingRegistry reg = context.getTypeMappingRegistry();
                TypeMapping tm = (TypeMapping) reg.getTypeMapping(Constants.URI_SOAP11_ENC);
                if (tm == null) {
                    tm = (TypeMapping) reg.createTypeMapping();
                    reg.register(Constants.URI_DEFAULT_SOAP_ENC, tm);
                }
                tm.register(RequestSecurityTokenResponse.class, TrustConstants.RESPONSE_NAME, new RSTResponseSerializerFactory(), new RSTResponseDeserializerFactory());

                msg.output(context);

                String msgString = stringWriter.toString();
                System.out.println("Serialized msg:");
                System.out.println(msgString);

                System.out.println("-------");
                System.out.println("Testing deserialization...");

                reader = new StringReader(msgString);
            } else {
                reader = new FileReader(args[0]);
            }

            DeserializationContext dser = new DeserializationContext(new InputSource(reader), msgContext, org.apache.axis.Message.REQUEST);
            dser.parse();
            SOAPEnvelope env = dser.getEnvelope();
            //System.out.println("********\n" + DOM2Writer.nodeToString(env, true) + "\n********");
           
            RPCElement rpcElem = (RPCElement) env.getFirstBody();
            RPCParam struct = rpcElem.getParam("struct");
            if (struct == null)
                throw new Exception("No <struct> param");

            if (!(struct.getObjectValue() instanceof RequestSecurityTokenResponse)) {
                System.out.println("Not a RST object! ");
                System.out.println(struct.getValue());
                System.exit(1);
            }

            RequestSecurityTokenResponse val = (RequestSecurityTokenResponse) struct.getObjectValue();
            if (val == null)
                throw new Exception("No value for struct param");

            System.out.println(val.toString());
        } catch (Exception e) {
View Full Code Here

Examples of org.apache.axis.message.RPCParam

                }

                Object[] argValues = new Object[operation.getNumParams()];

                for (int i = 0; i < args.size(); i++) {
                    RPCParam rpcParam = (RPCParam) args.get(i);
                    Object value = rpcParam.getObjectValue();

                    ParameterDesc paramDesc = rpcParam.getParamDesc();

                    if (paramDesc != null && paramDesc.getJavaType() != null) {
                        value = JavaUtils.convert(value, paramDesc.getJavaType());
                        rpcParam.setObjectValue(value);
                    }
                    int order = (paramDesc == null || paramDesc.getOrder() == -1) ? i : paramDesc.getOrder();
                    argValues[order] = value;
                }
                return argValues;
View Full Code Here

Examples of org.apache.axis.message.RPCParam

                QName returnParamQName = operation.getReturnQName();
                if (args != null && args.size() > 0) {

                    if (returnParamQName == null) {
                        RPCParam param = (RPCParam) args.get(0);
                        result = param.getObjectValue();
                    } else {
                        for (int i = 0; i < args.size(); i++) {
                            RPCParam param = (RPCParam) args.get(i);
                            if (returnParamQName.equals(param.getQName())) {
                                result = param.getObjectValue();
                                break;
                            }
                        }
                    }
View Full Code Here

Examples of org.apache.axis.message.RPCParam

                        resBody.setPrefix(body.getPrefix());
                        resBody.setNamespaceURI(body.getNamespaceURI());

                        for (Map.Entry<String, Object> entry: result.entrySet()) {
                            RPCParam par = new RPCParam(entry.getKey(), entry.getValue());

                            resBody.addParam(par);
                        }
                        resEnv.addBodyElement(resBody);
                        resEnv.setEncodingStyle(Constants.URI_LITERAL_ENC);
View Full Code Here

Examples of org.apache.axis.message.RPCParam

                    List params = null;
                    params = body.getParams();

                    Iterator p = params.iterator();
                    while (p.hasNext()) {
                        RPCParam param = (RPCParam) p.next();
                        mRet.put(param.getName(), param.getValue());
                        if (Debug.verboseOn()) {
                            Debug.log("SOAP Client Param - " + param.getName() + "=" + param.getValue(), module);
                        }
                    }
                }
            }
        } catch (org.apache.axis.AxisFault e) {
View Full Code Here

Examples of org.apache.axis.message.RPCParam

      Object result = null;
      HashMap outParams;
      Vector resArgs = body.getParams();

      if (resArgs != null && resArgs.size() > 0) {
        RPCParam param = (RPCParam) resArgs.get(0);
        result = param.getValue();

        if (resArgs.size() > 1) {
          outParams = new HashMap();
          for (int i = 1; i < resArgs.size(); i++) {
            RPCParam p = (RPCParam) resArgs.get(i);
            outParams.put(p.getName(), p.getValue());
          }
          setResponseMessageParameters(outParams);
        }
      }
      return result;
View Full Code Here

Examples of org.apache.axis.message.RPCParam

          throw new WSIFException(
            "no attachments found in response element: " + rpcEl);
        }
       
        //TODO: will there ever be more than 1?
        RPCParam rpcParam = (RPCParam) params.get(0);       

        QName qn = rpcParam.getQName();
        Part p = findPart(outputMIMEParts, qn);
      if (p != null) {
          Object responseValue = rpcParam.getValue();
        if (responseValue instanceof AttachmentPart) {
          try {
                    Object attachment = ((AttachmentPart)responseValue).getDataHandler();
                String partName = p.getName();
                outMsg.setObjectPart(partName, attachment);
View Full Code Here

Examples of org.apache.axis.message.RPCParam

                        nsp = serviceDesc.getDefaultNamespace();
                    }
                    returnQName = new QName(msgContext.isEncoded() ? "" : nsp, methodName + "Return");
                }

                RPCParam param = new RPCParam(returnQName, objRes);
                param.setParamDesc(operation.getReturnParamDesc());

                if (!operation.isReturnHeader())
                {
                    // For SOAP 1.2 rpc style, add a result
                    if (msgContext.getSOAPConstants() == SOAPConstants.SOAP12_CONSTANTS
                        && (serviceDesc.getStyle().equals(Style.RPC)))
                    {
                        RPCParam resultParam = new RPCParam(Constants.QNAME_RPC_RESULT, returnQName);
                        resultParam.setXSITypeGeneration(Boolean.FALSE);
                        resBody.addParam(resultParam);
                    }
                    resBody.addParam(param);
                }
                else
                {
                    resEnv.addHeader(new RPCHeaderParam(param));
                }

            }

            // Then any other out params
            if (!outs.isEmpty())
            {
                for (Iterator i = outs.iterator(); i.hasNext();)
                {
                    // We know this has a holder, so just unwrap the value
                    RPCParam param = (RPCParam)i.next();
                    Holder holder = (Holder)param.getObjectValue();
                    Object value = JavaUtils.getHolderValue(holder);
                    ParameterDesc paramDesc = param.getParamDesc();

                    param.setObjectValue(value);
                    if (paramDesc != null && paramDesc.isOutHeader())
                    {
                        resEnv.addHeader(new RPCHeaderParam(param));
                    }
                    else
View Full Code Here

Examples of org.apache.axis.message.RPCParam

        bean.setID(1.15F);
        bean.setMale(true);
        bean.company = "Majesty's Secret Service";
        bean.setName("James Bond");

        RPCParam arg = new RPCParam("", "struct", bean);
        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[]{ arg });
        msg.addBodyElement(body);
        body.setEncodingStyle(null);

        Writer stringWriter = new StringWriter();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.