axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ghershony, Arie" <Arie.Ghersh...@GDC4S.Com>
Subject RE: Type Jeff Greif [jgreif@alumni.princeton.edu]
Date Wed, 12 Feb 2003 21:55:21 GMT
I try to call this function and I get an error:      
 
public static void main(String [] args) throws Exception {
         OrderB client = new OrderB();
                System.out.println(client.getBattleService(args[0]));
                   
     }



getBattleService(java.lang.String[]) in clientaxis.Battle.OrderB cannot be
applied to <java.lang.String>
 
System.out.println(client.getBattleService(args[0]));
 
 
Error 1
 
Thanks,
Aria

-----Original Message-----
From: Ghershony, Arie 
Sent: Wednesday, February 12, 2003 4:20 PM
To: 'axis-user@ws.apache.org'
Subject: RE: Type Jeff Greif [jgreif@alumni.princeton.edu]


thank you

-----Original Message-----
From: Jeff Greif [mailto:jgreif@alumni.princeton.edu]
Sent: Wednesday, February 12, 2003 4:19 PM
To: axis-user@ws.apache.org
Subject: Re: Type Jeff Greif [jgreif@alumni.princeton.edu]


use XMLUtils.PrettyElementToWriter
 

----- Original Message ----- 
From: Ghershony, Arie <mailto:Arie.Ghershony@GDC4S.Com>  
To: 'axis-user@ws.apache.org' <mailto:'axis-user@ws.apache.org'>  
Sent: Wednesday, February 12, 2003 12:49 PM
Subject: Type Jeff Greif [jgreif@alumni.princeton.edu]

Hi,
I still receive an error:

clientaxis\Battle\OrderB.java:322:
PrettyElementToStream(org.w3c.dom.Element,jav
a.io.OutputStream) in org.apache.axis.utils.XMLUtils cannot be applied to
(org.w
3c.dom.Element,java.io.StringWriter)
      XMLUtils.PrettyElementToStream(result, w);
              ^
1 error

Thank you for your time. 
 
 
here is some of the code relavant to this issue:  perhaps you could
understand what I am exactly doing: 
 
 
package clientaxis.Battle;
import java.util.Vector;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.Iterator;
import java.io.StringWriter;
import java.net.URL;
 
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
 
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.utils.XMLUtils;
 
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
//import com.wrox.jws.stockcore.StockCore;
import clientaxis.Battle.BCore;
public class OrderB {
 
... some code goes here...
 
public String getBattleService(String[] uniqb) throws Exception {
   //final String methodName = "OrderB.main";
     StringWriter w = new StringWriter();
    try {
 
  DocumentBuilderFactory documentBuilderFactory = null;
      DocumentBuilder  parser                 = null;
 
      // We need a namespace-aware parser
      documentBuilderFactory = DocumentBuilderFactory.newInstance();
      documentBuilderFactory.setNamespaceAware(true);
      parser = documentBuilderFactory.newDocumentBuilder();
 
      // We create the document for the request (the XML document that will 
      // be embedded inside the SOAP body).
      Document document = parser.newDocument();
      Element  element  = document.getDocumentElement();
 
      // The <portfolio/> element is the root of our document;
      Element requestElement = document.createElementNS(nameSpaceURI, 
       orderbattleTag);
     // Element command        = document.createElement(args[0]);
     Element command        = document.createElement(uniqb[0]);
      requestElement.appendChild(command);
 
      // We add the list of ticker symbols
      for(int index = 1; index < uniqb.length; index++) {
        Element ticker = document.createElement(tickerTag);
 
       // ticker.appendChild(document.createTextNode(args[index]));
       ticker.appendChild(document.createTextNode(uniqb[index]));
      command.appendChild(ticker);
      }
 
      // Unless the command is a get, we add the get command
      if(!uniqb.equals(getCommand)) {
        requestElement.appendChild(document.createElement(getCommand));
      }
 
      Element result = null;
      boolean local  = false;  // set to true for local test (inproc)
 
      if(local) {
        // Local test, no SOAP
        result = orderbattle(requestElement, 
  (Element)requestElement.cloneNode(true));
      } else {
        // We create a SOAP request to submit the XML document to the

    // server. You might need to replace the following URL with what is 
        // suitable for your environment
        String  endpointURL = 
    " http://localhost:8080/axis/servlet/AxisServlet
<http://localhost:8080/axis/servlet/AxisServlet> ";
        Service service     = new Service();
        Call    call        = (Call)service.createCall();
 
        // Create a SOAP envelope to wrap the newly formed document
        SOAPEnvelope    requestEnvelope = new SOAPEnvelope();
        SOAPBodyElement requestBody     = 
     new SOAPBodyElement(requestElement);
        requestEnvelope.addBodyElement(requestBody);
 
        // Set the endpoint URL (address we are talking to) and method name
        call.setTargetEndpointAddress(new URL(endpointURL));
        call.setSOAPActionURI(orderbattleTag); // method name = tag name
 
        // Submit the document to the remote server
        SOAPEnvelope responseEnvelope = call.invoke(requestEnvelope);
 
        // Get the <orderbattle/> element from the response
        SOAPBodyElement responseBody =
          (SOAPBodyElement)responseEnvelope.getBodyElements().get(0);
        result = responseBody.getAsDOM();
      } 
    
      XMLUtils.PrettyElementToStream(result, w);
      return w.toString();
 
        } catch (Exception exception) {
         throw exception;
    }
  }

 ...some code here....
 


Mime
View raw message