I have been trying to use Apache SOAP classes as a client to a MS .NET service without much luck. There are some .NET services listed on the XMethods site ( http://www.xmethods.com), they are: Prasad's Stock Quote Service, Breaking News Service, and ZipCodes. I have included the code that I have tried to use for these services. Because I am new to SOAP, I know I'm missing something trivial but I just can't see it. Can anyone see where I am going wrong? Thanks, Blair Tingey [EMAIL PROTECTED] ============= Client ============ // // Sample client for the GetStock Quote -> MS .NET Service // import java.io.*; import java.net.*; import java.util.*; import org.apache.soap.util.xml.*; import org.apache.soap.*; import org.apache.soap.rpc.*; public class GetStockQuote{ public static String GetStock (URL url, String symbol) throws Exception{ Call call = new Call (); // This service uses standard SOAP encoding String encodingStyleURI = Constants.NS_URI_SOAP_ENC; call.setEncodingStyleURI(encodingStyleURI); call.setTargetObjectURI ("GetNasdaqQuotes"); call.setMethodName ("GetNasdaqQuotes"); // Create input parameter vector Vector params = new Vector (); params.addElement (new Parameter("SymbolsAsString", String.class, symbol, null)); call.setParams (params); // Evoke the service... Response resp = call.invoke (url," http://localhost/webservices/GetNasdaqQuotes"); // ... and evaluate the result if (resp.generatedFault ()) { Fault fault = resp.getFault(); System.err.println("Generated fault: "); System.out.println(" Fault Code = " + fault.getFaultCode()); System.out.println(" Fault String = " + fault.getFaultString()); throw new Exception(); }else { // Successful call. Extract result and return value Parameter result = resp.getReturnValue (); String location = (String) result.getValue(); return(location); } } public static void main(String[] args) { try { URL url=new URL(" http://www22.brinkster.com/prasads/LiveQuoteService.asmx"); String stockNews = GetStock(url,"AAPL"); System.out.println(stockNews); }catch (Exception e) {e.printStackTrace();} } }
