Package org.apache.soap.util

Examples of org.apache.soap.util.Bean


    Iterator it = objects.iterator();

    Object o;
    // assumethat there was one object encoded at most
    if( it.hasNext() )
      return new Bean((o=it.next()).getClass(), o);
    else
      throw new IllegalArgumentException("Unable to unmarshall XMI-encoded " +
                                         "object.");
                           
  }
View Full Code Here


    if (elTypeNS != null && elTypeLP != null) {
      qname = new QName (elTypeNS, elTypeLP);
    }

    return new Bean (TypeMapping.class,
                     new TypeMapping (encodingStyle,
                                      qname,
                                      javaType,
                                      java2XMLClassName, xml2JavaClassName));
  }
View Full Code Here

       throws SOAPException {
    try {
      BSFManager mgr = (BSFManager) target;
      BSFEngine eng = mgr.loadScriptingEngine (dd.getScriptLanguage ());
      Object result = eng.call (null, methodName, args);
      return new Bean ((result != null) ? result.getClass () : Object.class,
                       result);
    } catch (BSFException e) {
      throw new SOAPException (Constants.FAULT_CODE_SERVER,
                               "BSF Error: " + e.getMessage (), e);
    }
View Full Code Here

    String prefix = value.substring(0,idx);
    String uri = DOMUtils.getNamespaceURIFromPrefix(src, prefix);
   
    QName qName = new QName(uri, value.substring(idx + 1));

    return new Bean(QName.class, qName);
 
View Full Code Here

      respEncStyle = Constants.NS_URI_SOAP_ENC;
    }
   
    // invoke the method (directly for Java and via InvokeBSF for script
    // methods)
    Bean result = null;
    try {
      if (providerType == DeploymentDescriptor.PROVIDER_JAVA ||
          providerType == DeploymentDescriptor.PROVIDER_USER_DEFINED) {
        Method m = null ;
        try {
          m = MethodUtils.getMethod (targetObject,
                                     call.getMethodName(),
                                     argTypes);
        } catch (NoSuchMethodException e) {
          try {
            int paramsCount = 0 ;
            if ( params != null ) paramsCount = params.size();
            Class[]   tmpArgTypes = new Class[paramsCount+1];
            Object[]  tmpArgs     = new Object[paramsCount+1];
            for ( int i = 0 ; i < paramsCount ; i++ )
              tmpArgTypes[i+1] = argTypes[i] ;
            argTypes = tmpArgTypes ;
            argTypes[0] = SOAPContext.class ;
            m = MethodUtils.getMethod (targetObject,call.getMethodName(),
                                       argTypes);
            for ( int i = 0 ; i < paramsCount ; i++ )
              tmpArgs[i+1] = args[i] ;
            tmpArgs[0] = reqCtx ;
            args = tmpArgs ;
          } catch (NoSuchMethodException e2) {
            /*
              Don't want the "No Signature Match" error message to include
              the SOAPContext argument.
            */
            throw e;
          } catch (Exception e2) {
            throw e2;
          }
        } catch (Exception e) {
          throw e;
        }

        result = new Bean (m.getReturnType (), m.invoke (targetObject, args));
      } else {
        // find the class that provides the BSF services (done
        // this way via reflection to avoid a compile-time dependency on BSF)
        Class bc = Class.forName ("org.apache.soap.server.InvokeBSF");

View Full Code Here

                        SOAPEncSerializerWrapper) partSerializer)
                            .setTargetSerializer(
                    (Serializer) o);
            }

            Bean bean = new Bean(partSerializer.getClass(), partSerializer);
            vect.add(bean);
        }

        // create message envelope and body
        URL url = portInstance.getEndPoint();
        Envelope env = null;
        msgBody.setBodyEntries(vect);
        msgEnv.setBody(msgBody);

        SOAPTransport st = getTransport();

        if (st instanceof SOAPJMSConnection) {
           SOAPJMSConnection sjt = (SOAPJMSConnection) st;
           sjt.setSyncTimeout(WSIFProperties.getSyncTimeout());
           sjt.setAsyncTimeout(WSIFProperties.getAsyncTimeout());
        }

        if (inJmsPropVals != null && !inJmsPropVals.isEmpty()) {
        checkForTimeoutProperties(st, inJmsPropVals);
           ((SOAPJMSConnection) st).setJmsProperties(inJmsPropVals);
        }

        //TODO docstyle headers
        //setCallContext( call );

        if ( url != null && !isHostInNonProxyProperty( url ) ) {
           setSOAPProxy( st );
        }

        // create and send message
        try {
            Message msg = new Message();
            if (st != null)
                msg.setSOAPTransport(st);

            Trc.event(
                this,
                "Invoking operation ",
                getName(),
                " url ",
                url,
                " soapaction ",
                getSoapActionURI(),
                " envelope ",
                msgEnv,
                " message ",
                msg);

            msg.send(url, getSoapActionURI(), msgEnv);

            // receive response envelope
            env = msg.receiveEnvelope();
        } catch (SOAPException exn) {
            Trc.exception(exn);
            WSIFException e =
                new WSIFException("SOAP Exception: " + exn.getMessage());
            e.setTargetException(exn);
            throw e;
        }

        Trc.event(this, "Returned from operation, envelope ", env);

        Body retbody = env.getBody();
        java.util.Vector v = retbody.getBodyEntries();
        int index = 0;

        String encoding = null;
        if ("literal".equals(outputUse)) {
            // Should also include namespace
            encoding = "literal";
        } else {
            encoding = this.outputEncodingStyle;
        }

        iterator =
            operation.getOutput().getMessage().getParts().keySet().iterator();
        while (iterator.hasNext()) {
            Element element = (Element) v.get(index++);
            String partName = (String) iterator.next();
            Part modelPart =
                operation.getOutput().getMessage().getPart(partName);
            javax.xml.namespace.QName partType = modelPart.getTypeName();
            if (partType == null)
                partType = modelPart.getElementName();

            PartSerializer partSerializer = null;
            Object o =
                this.portInstance.getSOAPMappingRegistry().queryDeserializer(
                    new org.apache.soap.util.xml.QName(
                        partType.getNamespaceURI(),
                        partType.getLocalPart()),
                    encoding);

            if (o instanceof PartSerializer) {
                PartSerializer tmp = (PartSerializer) o;
                try {
                    partSerializer =
                        (PartSerializer) tmp.getClass().newInstance();
                } catch (InstantiationException e) {
                    Trc.ignoredException(e);
                } catch (IllegalAccessException e) {
                    Trc.ignoredException(e);
                }
                partSerializer.setPartQName(partType);
                partSerializer.unmarshall(null, null, element, null, null);
                Object retBean = partSerializer.getPart();
                output.setObjectPart(partName, retBean);
            } else // document with soap encoding - never been tried 
                {
                Bean bean =
                    ((Deserializer) o).unmarshall(
                        null,
                        null,
                        element,
                        null,
View Full Code Here

        Node src,
        XMLJavaMappingRegistry xjmr,
        SOAPContext ctx)
        throws IllegalArgumentException {
        Trc.entry(this, inScopeEncStyle, elementType, xjmr, ctx);
        Bean b = null;
        if (this.targetDeserializer != null)
            b =
                this.targetDeserializer.unmarshall(
                    inScopeEncStyle,
                    elementType,
View Full Code Here

        // Invoke utility method to get the FormatHandler
        // PartFormatHandler fh = getFormatHandler(customBean, customBeanQName);
        PartFormatHandler fh = new ShortZipCodeResponseFormatHandler();
        fh.setElement((Element) src);
        this.customBean = fh.getCustomBean();
        return new Bean(this.customBean.getClass(), this.customBean);
    }
View Full Code Here

  throw new IllegalArgumentException ("unknown element '" +
              tagName + "' while " +
              "unmarshalling a TypeMapping");
      }
    }
    return new Bean (TypeMapping.class,
         new TypeMapping (encodingStyle,
              new QName (elTypeNS, elTypeLP),
              javaType,
              java2XMLClassName, xml2JavaClassName));
  }
View Full Code Here

       throws SOAPException {
    try {
      BSFManager mgr = (BSFManager) target;
      BSFEngine eng = mgr.loadScriptingEngine (dd.getScriptLanguage ());
      Object result = eng.call (null, methodName, args);
      return new Bean ((result != null) ? result.getClass () : Object.class,
           result);
    } catch (BSFException e) {
      throw new SOAPException (Constants.FAULT_CODE_SERVER,
             "BSF Error: " + e.getMessage (), e);
    }
View Full Code Here

TOP

Related Classes of org.apache.soap.util.Bean

Copyright © 2018 www.massapicom. 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.