Package org.apache.axis.message

Examples of org.apache.axis.message.SOAPBodyElement


    public void testNodeWithAttribute() throws Exception
    {
        org.w3c.dom.Element element = XMLUtils.newDocument().createElement("tmp");
        element.setAttribute("attrib", "foo");
        SOAPBodyElement body = new SOAPBodyElement(element);
        assertXMLEqual("<tmp attrib=\"foo\"/>",body.toString());
    }
View Full Code Here


                // we're probably a non-wrapped doc/lit service.  In this case,
                // we deserialize the element, and create an RPCElement "wrapper"
                // around it which points to the correct method.
                // FIXME : There should be a cleaner way to do this...
                if (!(bodies.get(bNum) instanceof RPCElement)) {
                    SOAPBodyElement bodyEl = (SOAPBodyElement) bodies.get(bNum);
                    // igors: better check if bodyEl.getID() != null
                    // to make sure this loop does not step on SOAP-ENC objects
                    // that follow the parameters! FIXME?
                    if (bodyEl.isRoot() && operation != null && bodyEl.getID() == null) {
                        ParameterDesc param = operation.getParameter(bNum);
                        // at least do not step on non-existent parameters!
                        if (param != null) {
                            Object val = bodyEl.getValueAsType(param.getTypeQName());
                            body = new RPCElement("",
                                    operation.getName(),
                                    new Object[]{val});
                        }
                    }
View Full Code Here

      service = new Service();
      call = (Call)service.createCall();
      call.setTargetEndpointAddress(endpointURL);

      String requestString = XMLUtils.ElementToString(request);
      SOAPBodyElement body = new SOAPBodyElement(new ByteArrayInputStream(requestString.getBytes("UTF-8")));
      Object[] soapBodies = new Object[] { body };

      Vector result = (Vector)call.invoke(soapBodies);
      response = ((SOAPBodyElement)result.elementAt(0)).getAsDOM();
    }
View Full Code Here

       
      service = new Service();
      call = (Call)service.createCall();
      call.setTargetEndpointAddress(endpointURL);
   
      SOAPBodyElement body = new SOAPBodyElement(new ByteArrayInputStream(request.getBytes("UTF-8")));
      Object[] soapBodies = new Object[] { body };
   
      Vector result = (Vector)call.invoke(soapBodies);
      response = ((SOAPBodyElement)result.elementAt(0)).getAsString();
    }
View Full Code Here

      soapResEnv = soapResponse.getSOAPEnvelope();

      // pull the uddi request xml element from
      // the body of the soapRequest

      SOAPBodyElement requestBody = soapReqEnv.getFirstBody();
      request = requestBody.getAsDOM();

      // grab the function name from this element -
      // we'll need this to lookup the xml handler
      // to use to unmarshal the xml into a juddi
      // object.

      function = request.getLocalName();

      // grab the generic value - we'll need it in
      // the event that an exception is thrown.

      generic = request.getAttribute("generic");
      if (generic == null)
        generic = IRegistry.UDDI_V2_GENERIC;

      // lookup the appropriate xml handler, throw
      // an UnsupportedException if one could not be
      // located.

      IHandler requestHandler = maker.lookup(function);
      if (requestHandler == null)
        throw new UnsupportedException("The request " +
          "type is unknown: " +function);

      // unmarshal the raw xml into an associated
      // jUDDI request object.

      RegistryObject uddiRequest = requestHandler.unmarshal(request);

      // Determine if this message came from through
      // the Publish, Inquiry or Admin API and handle
      // it appropriately.

      Object juddiServlet = messageContext.getProperty("transport.http.servlet");

      // confirm that the the appropriate endpoint
      // was used to invoke the selected jUDDI/UDDI
      // function.

      if((juddiServlet instanceof InquiryServlet) &&
         (!(uddiRequest instanceof org.apache.juddi.datatype.request.Inquiry)))
      {
        throw new RegistryException("Inquiry API " +
          "does not support function: "+function);
      }
      else if (juddiServlet instanceof PublishServlet &&
         (!(uddiRequest instanceof org.apache.juddi.datatype.request.Publish) &&
          !(uddiRequest instanceof org.apache.juddi.datatype.request.SecurityPolicy)))
      {
        throw new RegistryException("Publish API " +
          "does not support function: "+function);
      }
      else if ((juddiServlet instanceof AdminServlet) &&    // Admin
         (!(uddiRequest instanceof org.apache.juddi.datatype.request.Admin)))
      {
        throw new RegistryException("Admin API " +
          "does not support function: "+function);
      }

      // grab a reference to the shared jUDDI registry
      // instance (make sure it's running) and execute
      // the requested UDDI function.

      RegistryObject uddiResponse = null;
     
      RegistryEngine registry = RegistryServlet.getRegistry();
      if ((registry != null) && (registry.isAvailable()))
        uddiResponse = registry.execute(uddiRequest);
      else
        throw new BusyException("The Registry is unavailable");

      // create a new 'temp' XML element. This
      // element is used as a container in which
      // to marshal the UDDI response into.

      Document document = XMLUtils.createDocument();
      Element element = document.createElement("temp");

      // lookup the appropriate response handler
      // and marshal the juddi object into the
      // appropriate xml format (we only support
      // uddi v2.0 at this time) attaching results
      // to the temporary 'temp' element.

      IHandler responseHandler = maker.lookup(uddiResponse.getClass().getName());
      responseHandler.marshal(uddiResponse,element);

      // grab a reference to the 'temp' element's
      // only child here (this has the effect of
      // discarding the temp element) and appending
      // this child to the soap response body.

      response = (Element)element.getFirstChild();     
      SOAPBodyElement soapRespBody = new SOAPBodyElement(response);
      SOAPEnvelope soapRespEnv = soapResponse.getSOAPEnvelope();
      soapRespEnv.addBodyElement(soapRespBody);      
    }
    catch(Exception ex)
    {
View Full Code Here

       
        call.setUseSOAPAction( true);
        call.setSOAPActionURI( "AdminService");

        Vector result = null ;
        Object[]  params = new Object[] { new SOAPBodyElement(input) };
        result = (Vector) call.invoke( params );

        input.close();

        if (result == null || result.isEmpty())
            throw new AxisFault(Messages.getMessage("nullResponse00"));

        SOAPBodyElement body = (SOAPBodyElement) result.elementAt(0);
        return body.toString();
    }
View Full Code Here

                    argObjects[0] = bodyElements;
                    SOAPBodyElement [] bodyResult =
                            (SOAPBodyElement [])method.invoke(obj, argObjects);
                    if (bodyResult != null) {
                        for (int i = 0; i < bodyResult.length; i++) {
                            SOAPBodyElement bodyElement = bodyResult[i];
                            resEnv.addBodyElement(bodyElement);
                        }
                    }
                    return;

                // Element [] / Element []
                case OperationDesc.MSG_METHOD_ELEMENTARRAY:
                    Element [] elements = new Element [bodies.size()];
                    for (int i = 0; i < elements.length; i++) {
                        SOAPBodyElement body = (SOAPBodyElement)bodies.get(i);
                        elements[i] = body.getAsDOM();
                    }
                    argObjects[0] = elements;
                    Element[] elemResult =
                            (Element[]) method.invoke( obj, argObjects );
                    if (elemResult != null) {
                        for ( int i = 0 ; i < elemResult.length ; i++ ) {
                            if(elemResult[i] != null)
                                resEnv.addBodyElement(
                                        new SOAPBodyElement(elemResult[i]));
                        }
                    }
                    return;

                // Element [] / Element []
                case OperationDesc.MSG_METHOD_DOCUMENT:
                    Document doc = ((SOAPBodyElement)bodies.get(0)).getAsDocument();
                    argObjects[0] = doc;
                    Document resultDoc =
                            (Document) method.invoke( obj, argObjects );
                    if (resultDoc != null) {
                        resEnv.addBodyElement(new SOAPBodyElement(
                                resultDoc.getDocumentElement()));
                    }
                    return;
            }
        } else {
View Full Code Here

       Element operationWrapper = doc.createElementNS("urn:operationNS","operation");
       doc.appendChild(operationWrapper);
       Node node = doc.importNode(element,true);
       operationWrapper.appendChild(node);

       message.addBodyElement(new SOAPBodyElement(operationWrapper));
      
       StringWriter stringWriter = new StringWriter();
       SerializationContext context = new SerializationContextImpl(stringWriter, messageContext);
       context.setDoMultiRefs(false);
       message.output(context);
View Full Code Here

            // we're probably a non-wrapped doc/lit service.  In this case,
            // we deserialize the element, and create an RPCElement "wrapper"
            // around it which points to the correct method.
            // FIXME : There should be a cleaner way to do this...
            if (!(bodies.get(bNum) instanceof RPCElement)) {
                SOAPBodyElement bodyEl = (SOAPBodyElement)bodies.get(bNum);
                // igors: better check if bodyEl.getID() != null
                // to make sure this loop does not step on SOAP-ENC objects
                // that follow the parameters! FIXME?
                if (bodyEl.isRoot() && operation != null && bodyEl.getID() == null) {
                    ParameterDesc param = operation.getParameter(bNum);
                    // at least do not step on non-existent parameters!
                    if(param != null) {
                        Object val = bodyEl.getValueAsType(param.getTypeQName());
                        body = new RPCElement("",
                                              operation.getName(),
                                              new Object [] { val });
                    }
                }
View Full Code Here

    public SOAPBodyElement [] testBody(SOAPBodyElement [] bodies)
            throws Exception {

        String xml = "<m:bodyResult xmlns:m=\"http://db.com\"/>" ;
        InputStream is = new ByteArrayInputStream(xml.getBytes());
        SOAPBodyElement result = new SOAPBodyElement(is);
        return new SOAPBodyElement [] { result };
    }
View Full Code Here

TOP

Related Classes of org.apache.axis.message.SOAPBodyElement

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.